exe/sumomo in sumomo-0.9.0 vs exe/sumomo in sumomo-0.10.0

- old
+ new

@@ -3,16 +3,16 @@ require 'trollop' require 'sumomo' require 'yaml' -SUB_COMMANDS = %w[delete create update outputs testapi].freeze +SUB_COMMANDS = %w[delete create update outputs show diff testapi].freeze global_opts = Trollop.options do banner <<-USAGE Sumomo v#{Sumomo::VERSION} - Usage: sumomo [options] <create|update|delete|outputs> <stackname> + Usage: sumomo [options] <#{SUB_COMMANDS.join('|')}> <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' @@ -28,25 +28,16 @@ cmd_opts = case cmd when 'delete' Sumomo.delete_stack(name: ARGV[0], region: global_opts[:region]) - when 'create' + when 'create', 'update', 'show', 'diff' 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 {} - eval File.read(local_opts[:filename]), proc.binding, local_opts[:filename] - end - - when 'update' - local_opts = Trollop.options do - opt :filename, 'File that describes the stack', type: :string, default: 'Sumomofile' opt :changeset, 'Create a changeset instead of directly update', type: :boolean, default: false end - Sumomo.update_stack(name: ARGV[0], changeset: !!local_opts[:changeset], region: global_opts[:region]) do + Sumomo.manage_stack(name: ARGV[0], cmd: cmd, changeset: !!local_opts[:changeset], region: global_opts[:region]) do proc = proc {} eval File.read(local_opts[:filename]), proc.binding, local_opts[:filename] end when 'outputs' @@ -78,6 +69,8 @@ exit(0) else Trollop.die "Unknown subcommand #{cmd.inspect}" end -Sumomo.wait_for_stack(name: ARGV[0], region: global_opts[:region]) +unless %w[show diff].include?(cmd) + Sumomo.wait_for_stack(name: ARGV[0], region: global_opts[:region]) +end