Class: Opsicle::Deploy

Inherits:
Object
  • Object
show all
Includes:
DeployHelper
Defined in:
lib/opsicle/commands/deploy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DeployHelper

#launch_stack_monitor, #open_deploy

Constructor Details

#initialize(environment) ⇒ Deploy

Returns a new instance of Deploy.



8
9
10
11
# File 'lib/opsicle/commands/deploy.rb', line 8

def initialize(environment)
  @environment = environment
  @client = Client.new(environment)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/opsicle/commands/deploy.rb', line 6

def client
  @client
end

Instance Method Details

#execute(options = { monitor: true }) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/opsicle/commands/deploy.rb', line 13

def execute(options={ monitor: true })
  Output.say "Starting OpsWorks deploy..."

  #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]
  command_opts = {}
  command_opts["custom_json"] = options.delete(:json) if options[:json]
  response = client.run_command('deploy', command_args, command_opts)

  launch_stack_monitor(response, options)
end