Class: Phase::Deploy::Deployment

Inherits:
Object
  • Object
show all
Includes:
Util::Console, Util::Shell
Defined in:
lib/phase/kit/deploy/deployment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util::Shell

#shell

Methods included from Util::Console

#ask, #fail, #log

Constructor Details

#initialize(role_name, version_tag, options = {}) ⇒ Deployment

Returns a new instance of Deployment.



10
11
12
# File 'lib/phase/kit/deploy/deployment.rb', line 10

def initialize(role_name, version_tag, options = {})
  @role_name, @version_tag, @options = role_name, version_tag, options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



8
9
10
# File 'lib/phase/kit/deploy/deployment.rb', line 8

def options
  @options
end

#role_nameObject (readonly)

Returns the value of attribute role_name.



8
9
10
# File 'lib/phase/kit/deploy/deployment.rb', line 8

def role_name
  @role_name
end

#version_tagObject (readonly)

Returns the value of attribute version_tag.



8
9
10
# File 'lib/phase/kit/deploy/deployment.rb', line 8

def version_tag
  @version_tag
end

Instance Method Details

#execute!Object



14
15
16
17
18
19
20
21
22
# File 'lib/phase/kit/deploy/deployment.rb', line 14

def execute!
  hosts = ::Phase::Adapters::AWS::Server.where(role: role_name).map do |host|
    "deploy@#{host.resource.dns_name}"
  end

  fail "No instance with role `role_name' found" if hosts.blank?

  deploy_image(hosts)
end