Class: EbDeployer::Component

Inherits:
Object
  • Object
show all
Defined in:
lib/eb_deployer/component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, env, creation_opts, eb_settings, strategy_name, eb_driver) ⇒ Component

Returns a new instance of Component.



5
6
7
8
9
10
11
12
# File 'lib/eb_deployer/component.rb', line 5

def initialize(name, env, creation_opts, eb_settings, strategy_name, eb_driver)
  @name = name
  @env = env
  @eb_driver = eb_driver
  @creation_opts = creation_opts
  @eb_settings = eb_settings
  @strategy = DeploymentStrategy.create(self, strategy_name)
end

Instance Attribute Details

#name ⇒ Object (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/eb_deployer/component.rb', line 3

def name
  @name
end

Instance Method Details

#cname_prefix ⇒ Object



14
15
16
# File 'lib/eb_deployer/component.rb', line 14

def cname_prefix
  @creation_opts[:cname_prefix] || default_cname_prefix
end

#deploy(version_label, eb_settings) ⇒ Object



18
19
20
# File 'lib/eb_deployer/component.rb', line 18

def deploy(version_label, eb_settings)
  @strategy.deploy(version_label, eb_settings + @eb_settings)
end

#new_eb_env(suffix = nil, cname_prefix_overriding = nil) ⇒ Object



22
23
24
25
26
27
# File 'lib/eb_deployer/component.rb', line 22

def new_eb_env(suffix=nil, cname_prefix_overriding=nil)
  EbEnvironment.new(@env.app_name,
                    [@env.name, @name, suffix].compact.join('-'),
                    @eb_driver,
                    @creation_opts.merge(:cname_prefix => cname_prefix_overriding || cname_prefix))
end