bin/kumogata in kumogata-0.4.19 vs bin/kumogata in kumogata-0.5.0

- old
+ new

@@ -1,11 +1,10 @@ #!/usr/bin/env ruby $: << File.expand_path("#{File.dirname __FILE__}/../lib") require 'rubygems' require 'kumogata' require 'kumogata/argument_parser' -require 'kumogata/config_parser' options = nil parsed = Kumogata::ArgumentParser.parse! {|parser, cmd, args, opts| if (opts.access_key_id? and not opts.secret_access_key?) or @@ -20,41 +19,16 @@ String.colorize = options.color? Diffy::Diff.default_format = options.color? ? :color : :text aws_opts = {} - config_parser = Kumogata::ConfigParser.new - # Set config file path - if options.config_path? - unless File.exist?(options.config_path) - raise "No such config file: #{options.config_path}" - end + if options.config_profile + provider = AWS::Core::CredentialProviders::SharedCredentialFileProvider.new( + :profile_name => profile_name + ) - config_parser.path = options.config_path - end - - # Load .aws/config - # See http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html - if config_parser.path.exist? - config_parser.parse! - - if options.config_profile and not config_parser[options.config_profile] - raise "No profile: #{config_parser.path} => #{options.config_profile}" - end - - profile_name = options.config_profile || :default - - if (profile = config_parser[profile_name]) - { - 'aws_access_key_id' => :access_key_id, - 'aws_secret_access_key' => :secret_access_key, - 'region' => :region, - }.each do |config_key, option_key| - option_value = profile[config_key] - aws_opts[option_key] = option_value if option_value - end - end + aws_opts[:credential_provider] = provider end [:access_key_id, :secret_access_key, :region].each do |key| aws_opts[key] = options[key] if options[key] end