summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/hcl/app.rb10
-rw-r--r--lib/hcl/timesheet_resource.rb2
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/hcl/app.rb b/lib/hcl/app.rb
index 4ff63d5..ac1b992 100644
--- a/lib/hcl/app.rb
+++ b/lib/hcl/app.rb
@@ -15,8 +15,8 @@ module HCl
OLD_SETTINGS_FILE = "#{ENV['HOME']}/.hcl_settings"
OLD_CONFIG_FILE = "#{ENV['HOME']}/.hcl_config"
- def configure
- FileUtils.mkdir_p(File.join(ENV['HOME'], ".hcl"))
+ def initialize
+ FileUtils.mkdir_p(HCL_DIR)
read_config
read_settings
self
@@ -24,7 +24,7 @@ module HCl
# Run the given command and arguments.
def self.command *args
- new.configure.process_args(*args).run
+ new.process_args(*args).run
end
# Return true if the string is a known command, false otherwise.
@@ -37,6 +37,7 @@ module HCl
# Start the application.
def run
+ request_config if @options[:reauth]
begin
if @command
if command? @command
@@ -71,7 +72,7 @@ module HCl
end
def process_args *args
- Trollop::options(args) do
+ @options = Trollop::options(args) do
stop_on Commands.instance_methods
version "HCl version #{VERSION}"
banner <<-EOM
@@ -119,6 +120,7 @@ Examples:
Options:
EOM
+ opt :reauth, "Force refresh of auth details"
end
@command = args.shift
@args = args
diff --git a/lib/hcl/timesheet_resource.rb b/lib/hcl/timesheet_resource.rb
index 7ab99ec..69eeb75 100644
--- a/lib/hcl/timesheet_resource.rb
+++ b/lib/hcl/timesheet_resource.rb
@@ -24,8 +24,6 @@ module HCl
self.password = opts['password']
self.subdomain = opts['subdomain']
self.ssl = opts['ssl']
- else
- yield self
end
end