lib/simple_deploy/cli.rb in simple_deploy-0.3.5 vs lib/simple_deploy/cli.rb in simple_deploy-0.3.6

- old
+ new

@@ -67,12 +67,14 @@ opt :help, "Display Help" opt :attributes, "= seperated attribute and it's value", :type => :string, :multi => true opt :environment, "Set the target environment", :type => :string opt :force, "Force a deployment to proceed" - opt :limit, "Add limit to results returned by events.", :type => :integer, - :default => 3 + opt :count, "Count of events returned.", :type => :integer, + :default => 3 + opt :log_level, "Log level to output. Valid levels: debug, info, warn, error", :type => :string, + :default => 'info' opt :name, "Stack name to manage", :type => :string opt :template, "Path to the template file", :type => :string end @cmd = ARGV.shift @@ -100,13 +102,24 @@ @config = Config.new.environment @opts[:environment] end @stacks = Stackster::StackLister.new(:config => @config).all.sort - @logger = SimpleDeployLogger.new + case @cmd + when 'ssh' + @log_level = 'warn' + else + @log_level = 'info' + end + + @log_level = @opts[:log_level] if @opts[:log_level] + + @logger = SimpleDeployLogger.new :log_level => @log_level + + case @cmd when 'create', 'delete', 'deploy', 'destroy', 'instances', 'status', 'attributes', 'events', 'resources', 'outputs', 'template', 'update', 'parameters', 'ssh' @@ -125,10 +138,11 @@ @logger.info "#{@opts[:name]} created." when 'delete', 'destroy' @stack.destroy @logger.info "#{@opts[:name]} destroyed." when 'deploy' + @stack.update :attributes => attributes @stack.deploy @opts[:force] when 'environments' Config.new.environments.keys.each { |e| puts e } when 'update' @stack.update :attributes => attributes @@ -142,10 +156,10 @@ when 'outputs', 'resources', 'status', 'parameters' puts (@stack.send @cmd.to_sym).to_yaml when 'ssh' puts @stack.send @cmd.to_sym when 'events' - puts (@stack.events @opts[:limit]).to_yaml + puts (@stack.events @opts[:count]).to_yaml else puts "Unknown command. Use -h for help." end end