Sha256: ef507be3ac8a34fb774fe923cc54deb2d098bee43e73891dd20d4ed3fa160082

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 KB

Contents

#!/usr/bin/env ruby

require "trollop"
require "sumomo"
require "yaml"

SUB_COMMANDS = %w(delete create update)
global_opts = Trollop::options do
  banner <<-USAGE
  Sumomo v#{Sumomo::VERSION}

  Usage: sumomo [options] <create|update|delete|outputs> <stackname>
  USAGE

  opt :region, "AWS region to use", type: :string, default: "ap-northeast-1"
  opt :profile, "AWS credential profile to use", type: :string, default: "default"

  stop_on SUB_COMMANDS
end

ENV["AWS_PROFILE"] = global_opts[:profile]

puts "Using profile:"
p ENV["AWS_PROFILE"]

cmd = ARGV.shift # get the subcommand

cmd_opts = case cmd
when "delete"
	Sumomo::delete_stack(name: ARGV[0], region: global_opts[:region])

when "create", "update"
	local_opts = Trollop::options do
		opt :filename, "File that describes the stack", type: :string, default: "Sumomofile"
	end
	Sumomo::create_stack(name: ARGV[0], region: global_opts[:region]) do
		proc = Proc.new {}
		eval File.read(local_opts[:filename]), proc.binding, local_opts[:filename]
	end

when "outputs"
	puts "Outputs for stack #{ARGV[0]}"
	puts Sumomo::get_stack_outputs(name: ARGV[0], region: global_opts[:region]).to_yaml

else
	Trollop::die "Unknown subcommand #{cmd.inspect}"
end

Sumomo::wait_for_stack(name: ARGV[0], region: global_opts[:region])

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sumomo-0.6.3 exe/sumomo
sumomo-0.6.2 exe/sumomo
sumomo-0.6.1 exe/sumomo
sumomo-0.6.0 exe/sumomo
sumomo-0.5.2 exe/sumomo
sumomo-0.5.1 exe/sumomo
sumomo-0.5.0 exe/sumomo