Class: Opsicle::Deploy
- Inherits:
-
Object
- Object
- Opsicle::Deploy
- Defined in:
- lib/opsicle/commands/deploy.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #execute(options = { monitor: true }) ⇒ Object
-
#initialize(environment) ⇒ Deploy
constructor
A new instance of Deploy.
- #open_deploy(deployment_id) ⇒ Object
Constructor Details
#initialize(environment) ⇒ Deploy
Returns a new instance of Deploy.
5 6 7 8 |
# File 'lib/opsicle/commands/deploy.rb', line 5 def initialize(environment) @environment = environment @client = Client.new(environment) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/opsicle/commands/deploy.rb', line 3 def client @client end |
Instance Method Details
#execute(options = { monitor: true }) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/opsicle/commands/deploy.rb', line 10 def execute(={ monitor: true }) Output.say "Starting OpsWorks deploy..." response = client.run_command('deploy') # Monitoring preferences if [:browser] open_deploy(response[:deployment_id]) elsif [:monitor] # Default option Output.say_verbose "Starting Stack Monitor..." @monitor = Opsicle::Monitor::App.new(@environment, ) @monitor.start end end |
#open_deploy(deployment_id) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/opsicle/commands/deploy.rb', line 25 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 end |