Sha256: 949d4213f25ced4f4fed1abb996932c7ed6efd8596095a716cb2360da6b5645f
Contents?: true
Size: 1.59 KB
Versions: 5
Compression:
Stored size: 1.59 KB
Contents
#!/usr/bin/env ruby $: << File.expand_path("#{File.dirname __FILE__}/../lib") require 'rubygems' require 'kumogata' require 'kumogata/argument_parser' options = nil parsed = Kumogata::ArgumentParser.parse! {|parser, cmd, args, opts| if (opts.access_key_id? and not opts.secret_access_key?) or (not opts.access_key_id? and opts.secret_access_key?) puts parser.help exit 1 end } begin command, arguments, options, output_result = parsed String.colorize = options.color? Diffy::Diff.default_format = options.color? ? :color : :text aws_opts = {} if options.config_profile provider = AWS::Core::CredentialProviders::SharedCredentialFileProvider.new( :profile_name => options.config_profile ) 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 AWS.config(aws_opts) unless aws_opts.empty? if options.debug? Kumogata.logger.set_debug(true) AWS.config({ :http_wire_trace => true, :logger => Kumogata.logger, }) end out = Kumogata::Client.new(options).send(command, *arguments) if [:create, :update, :delete].include?(command) and options.detach? puts '[detached]' elsif output_result and out puts out end rescue Exception => e $stderr.puts("[ERROR] #{e.message}".red) unless e.kind_of?(Interrupt) if options and options.debug? raise e else backtrace = Kumogata::Utils.filter_backtrace(e.backtrace) unless backtrace.empty? $stderr.puts " from #{backtrace.first}".red end end exit 1 end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
kumogata-0.5.3 | bin/kumogata |
kumogata-0.5.2 | bin/kumogata |
kumogata-0.5.2.beta2 | bin/kumogata |
kumogata-0.5.2.beta | bin/kumogata |
kumogata-0.5.1 | bin/kumogata |