Class: Oops::OpsworksDeploy
- Inherits:
-
Object
- Object
- Oops::OpsworksDeploy
- Defined in:
- lib/oops/opsworks_deploy.rb
Defined Under Namespace
Classes: Deployment
Instance Attribute Summary collapse
-
#app_name ⇒ Object
Returns the value of attribute app_name.
-
#stack_name ⇒ Object
Returns the value of attribute stack_name.
Instance Method Summary collapse
- #deploy(file_url) ⇒ Object
-
#initialize(app_name, stack_name) ⇒ OpsworksDeploy
constructor
A new instance of OpsworksDeploy.
Constructor Details
#initialize(app_name, stack_name) ⇒ OpsworksDeploy
Returns a new instance of OpsworksDeploy.
4 5 6 7 8 |
# File 'lib/oops/opsworks_deploy.rb', line 4 def initialize(app_name, stack_name) @client = AWS::OpsWorks::Client.new self.stack_name = stack_name self.app_name = app_name end |
Instance Attribute Details
#app_name ⇒ Object
Returns the value of attribute app_name.
2 3 4 |
# File 'lib/oops/opsworks_deploy.rb', line 2 def app_name @app_name end |
#stack_name ⇒ Object
Returns the value of attribute stack_name.
2 3 4 |
# File 'lib/oops/opsworks_deploy.rb', line 2 def stack_name @stack_name end |
Instance Method Details
#deploy(file_url) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/oops/opsworks_deploy.rb', line 10 def deploy(file_url) @client.update_app(app_id: app_id, app_source: { url: file_url }) instance_ids = @client.describe_instances(stack_id: stack_id).instances.map(&:instance_id).to_a deployment = @client.create_deployment(stack_id: stack_id, app_id: app_id, command: { name: 'deploy', args: { "migrate"=>["true"] } }, instance_ids: instance_ids ) Deployment.new(@client, deployment) end |