lib/opsicle/commands/deploy.rb in opsicle-0.4.2 vs lib/opsicle/commands/deploy.rb in opsicle-0.5.0

- old
+ new

@@ -1,35 +1,25 @@ +require "opsicle/deploy_helper" + module Opsicle class Deploy + include DeployHelper attr_reader :client def initialize(environment) @environment = environment @client = Client.new(environment) end 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]) - elsif options[:monitor] # Default option - Output.say_verbose "Starting Stack Monitor..." - @monitor = Opsicle::Monitor::App.new(@environment, options) - @monitor.start - end + #so this is how to format the command arguments: + #http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/OpsWorks/Client.html#create_deployment-instance_method + command_args = {} + command_args["migrate"] = [options[:migrate].to_s] if options[:migrate] + response = client.run_command('deploy', command_args) - end - - def open_deploy(deployment_id) - if deployment_id - 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 - Output.say "Deploy failed. No deployment_id was received from OpsWorks", :error - end + launch_stack_monitor(response, options) end end end