From c32bdade26fbf53587e9f8ccc67c5f22c6d45b80 Mon Sep 17 00:00:00 2001 From: Zack Hobson Date: Thu, 21 Nov 2013 15:57:17 -0800 Subject: app: add option to force auth refresh --- lib/hcl/app.rb | 10 ++++++---- lib/hcl/timesheet_resource.rb | 2 -- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3