lib/simple_deploy/cli/update.rb in simple_deploy-0.6.4 vs lib/simple_deploy/cli/update.rb in simple_deploy-0.6.5

- old
+ new

@@ -1,12 +1,15 @@ require 'trollop' module SimpleDeploy module CLI + class Update + include Shared + def update - opts = Trollop::options do + @opts = Trollop::options do version SimpleDeploy::VERSION banner <<-EOS Update the attributes for one more stacks. @@ -22,26 +25,35 @@ :default => 'info' opt :name, "Stack name(s) of stack to deploy", :type => :string, :multi => true end - CLI::Shared.valid_options? :provided => opts, - :required => [:environment, :name] + valid_options? :provided => @opts, + :required => [:environment, :name] - config = Config.new.environment opts[:environment] + config = Config.new.environment @opts[:environment] - logger = SimpleDeployLogger.new :log_level => opts[:log_level] + attributes = parse_attributes :attributes => @opts[:attributes] - attributes = CLI::Shared.parse_attributes :attributes => opts[:attributes], - :logger => logger - - opts[:name].each do |name| - stack = Stack.new :environment => opts[:environment], + @opts[:name].each do |name| + stack = Stack.new :environment => @opts[:environment], :name => name, :config => config, :logger => logger - stack.update :force => opts[:force], :attributes => attributes + rescue_stackster_exceptions_and_exit do + stack.update :force => @opts[:force], :attributes => attributes + end end end + + def logger + @logger ||= SimpleDeployLogger.new :log_level => @opts[:log_level] + end + + def command_summary + 'Update the attributes for one more stacks' + end + end + end end