Sha256: 6839dbcc07f0a4b279d34c639f3ea7e64b7e18f709320ee21ac3ff6e5e537821

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 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"

  stop_on SUB_COMMANDS
end

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, required: true
	end
	Sumomo::create_stack(name: ARGV[0], region: global_opts[:region]) do
		eval File.read(local_opts[:filename]), 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

1 entries across 1 versions & 1 rubygems

Version Path
sumomo-0.3.0 exe/sumomo