summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/hcl1
-rw-r--r--lib/hcl.rb10
2 files changed, 8 insertions, 3 deletions
diff --git a/bin/hcl b/bin/hcl
index a968c5f..0e9346a 100755
--- a/bin/hcl
+++ b/bin/hcl
@@ -5,5 +5,6 @@ $:.unshift File.dirname(__FILE__) + '/../ext/harvest/lib'
require 'hcl'
+HCl.conf_file = File.dirname(__FILE__) + '/../hcl_conf.yml'
HCl.command *ARGV
diff --git a/lib/hcl.rb b/lib/hcl.rb
index c9fcf94..09bef74 100644
--- a/lib/hcl.rb
+++ b/lib/hcl.rb
@@ -8,13 +8,17 @@ require 'hcl/day_entry'
class HCl
class UnknownCommand < StandardError; end
+ def self.conf_file= filename
+ @@conf_file = filename
+ end
+
def self.command *args
command = args.shift
unless command
help
return
end
- hcl = new.process_args *args
+ hcl = new(@@conf_file).process_args *args
if hcl.respond_to? command
hcl.send command
else
@@ -22,8 +26,8 @@ class HCl
end
end
- def initialize
- config = YAML::load(File.read('hcl_conf.yml'))
+ def initialize conf_file
+ config = YAML::load File.read(conf_file)
TimesheetResource.configure config
end