summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorZack Hobson2009-08-09 10:42:09 -0700
committerZack Hobson2009-08-09 10:42:09 -0700
commite935571b7164d112a5e27589ff69cfec9cc13c24 (patch)
treec121272332577f8a7b1b6fdbcb8e79e16c2653ca /lib
parent2b7d0061e5b7c7a53a49e3d73b0af2397d991af6 (diff)
downloadhcl-e935571b7164d112a5e27589ff69cfec9cc13c24.tar.bz2
Removed the --version option, closes #27.
Diffstat (limited to 'lib')
-rw-r--r--lib/hcl/app.rb (renamed from lib/hcl.rb)17
-rw-r--r--lib/hcl/day_entry.rb2
-rw-r--r--lib/hcl/task.rb2
-rw-r--r--lib/hcl/timesheet_resource.rb2
-rw-r--r--lib/hcl/utility.rb2
5 files changed, 11 insertions, 14 deletions
diff --git a/lib/hcl.rb b/lib/hcl/app.rb
index e045328..1afe2b3 100644
--- a/lib/hcl.rb
+++ b/lib/hcl/app.rb
@@ -1,12 +1,15 @@
+## stdlib dependencies
require 'yaml'
require 'rexml/document'
require 'net/http'
require 'net/https'
+## gem dependencies
require 'chronic'
require 'trollop'
require 'highline/import'
+## app dependencies
require 'hcl/utility'
require 'hcl/timesheet_resource'
require 'hcl/project'
@@ -25,10 +28,10 @@ class Net::HTTP
end
end
-class HCl
- include Utility
+module HCl
+ class App
+ include HCl::Utility
- VERSION_FILE = File.dirname(__FILE__) + '/../VERSION.yml'
SETTINGS_FILE = "#{ENV['HOME']}/.hcl_settings"
CONFIG_FILE = "#{ENV['HOME']}/.hcl_config"
@@ -63,19 +66,12 @@ class HCl
end
def initialize
- @version = YAML::load(File.read(VERSION_FILE))
read_config
read_settings
end
- def version
- [:major, :minor, :patch].map { |v| @version[v] }.join('.')
- end
-
def process_args *args
- version_string = version
Trollop::options(args) do
- version "HCl #{version_string}"
stop_on %w[ show tasks set unset note add rm start stop ]
banner <<-EOM
HCl is a command-line client for manipulating Harvest time sheets.
@@ -233,5 +229,6 @@ EOM
puts "\t#{as_hours total_hours}\ttotal"
end
+ end
end
diff --git a/lib/hcl/day_entry.rb b/lib/hcl/day_entry.rb
index 874273f..bfc6dbf 100644
--- a/lib/hcl/day_entry.rb
+++ b/lib/hcl/day_entry.rb
@@ -1,5 +1,5 @@
-class HCl
+module HCl
class DayEntry < TimesheetResource
include Utility
diff --git a/lib/hcl/task.rb b/lib/hcl/task.rb
index bc32c0b..abd62a7 100644
--- a/lib/hcl/task.rb
+++ b/lib/hcl/task.rb
@@ -1,4 +1,4 @@
-class HCl
+module HCl
class Task < TimesheetResource
def self.cache_tasks doc
tasks = []
diff --git a/lib/hcl/timesheet_resource.rb b/lib/hcl/timesheet_resource.rb
index 3072d07..a589059 100644
--- a/lib/hcl/timesheet_resource.rb
+++ b/lib/hcl/timesheet_resource.rb
@@ -1,4 +1,4 @@
-class HCl
+module HCl
class TimesheetResource
class Failure < Exception; end
diff --git a/lib/hcl/utility.rb b/lib/hcl/utility.rb
index 2d8c28c..18782f6 100644
--- a/lib/hcl/utility.rb
+++ b/lib/hcl/utility.rb
@@ -1,4 +1,4 @@
-class HCl
+module HCl
module Utility
# Convert from decimal to a string of the form HH:MM.
def as_hours hours