lib/opsicle/commands/deploy.rb in opsicle-0.2.1 vs lib/opsicle/commands/deploy.rb in opsicle-0.3.0
- old
+ new
@@ -5,37 +5,31 @@
def initialize(environment)
@environment = environment
@client = Client.new(environment)
end
- def execute(options={})
+ def execute(options={ monitor: true })
+ Output.say "Starting OpsWorks deploy..."
response = client.run_command('deploy')
+ # Monitoring preferences
if options[:browser]
open_deploy(response[:deployment_id])
- end
-
- if options[:monitor]
+ elsif options[:monitor] # Default option
+ Output.say_verbose "Starting Stack Monitor..."
@monitor = Opsicle::Monitor::App.new(@environment, options)
-
- begin
- @monitor.start
- rescue => e
- say "<%= color('Uh oh, an error occurred while starting the Opsicle Stack Monitor.', RED) %>"
- say "<%= color('Use --trace to view stack trace.', RED) %>"
-
- if options.trace
- raise
- end
- end
+ @monitor.start
end
+
end
def open_deploy(deployment_id)
if deployment_id
- exec "open 'https://console.aws.amazon.com/opsworks/home?#/stack/#{client.config.opsworks_config[:stack_id]}/deployments'"
+ command = "open 'https://console.aws.amazon.com/opsworks/home?#/stack/#{client.config.opsworks_config[:stack_id]}/deployments'"
+ Output.say_verbose "Executing shell command: #{command}"
+ %x(#{command})
else
- puts 'deploy failed'
+ Output.say "Deploy failed. No deployment_id was received from OpsWorks", "RED"
end
end
end
end