lib/nightcrawler_swift/cli/runner.rb in nightcrawler_swift-0.5.0 vs lib/nightcrawler_swift/cli/runner.rb in nightcrawler_swift-0.6.0

- old
+ new

@@ -32,11 +32,11 @@ @options = OpenStruct.new @options.configured = true @options.default_config_file = true @options.config_file = File.expand_path(File.join(user_home_dir, CONFIG_FILE)) @options.cache_file = File.expand_path(File.join(user_home_dir, CACHE_FILE)) - @options.bucket = nil + @options.config_hash = {} end def validate_command_and_options if @command_name.nil? or argv.nil? log @opt_parser.help @@ -53,15 +53,14 @@ exit 1 end end def config_hash - @config_hash ||= JSON.parse(File.read(options.config_file)) + @config_hash ||= JSON.parse(File.read(options.config_file), symbolize_names: true) rescue {} end def execute_command - NightcrawlerSwift.configure config_hash - NightcrawlerSwift.options.bucket = @options.bucket if @options.bucket + NightcrawlerSwift.configure config_hash.merge(@options.config_hash) connect_and_execute do command_method = "command_#{command_name_normalized}" command_class = COMMANDS[@command_name][:command] Formatters::Basic.new(self).send(command_method, command_class)