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, options, eb_driver) ⇒ Component

Returns a new instance of Component.



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

def initialize(name, env, options, eb_driver)
  @name = name
  @env = env
  @eb_driver = eb_driver
  @options = options.dup
  @component_eb_settings = @options.delete(:option_settings) || []
  @component_inactive_settings = @options.delete(:inactive_settings) || []
  strategy_name = @options[:strategy] || @env.strategy_name
  @strategy = DeploymentStrategy.create(self, strategy_name)
end

Instance Attribute Details

#nameObject (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_prefixObject



16
17
18
# File 'lib/eb_deployer/component.rb', line 16

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

#deploy(version_label, eb_settings, inactive_settings = []) ⇒ Object



20
21
22
23
24
25
# File 'lib/eb_deployer/component.rb', line 20

def deploy(version_label, eb_settings, inactive_settings=[])
  @strategy.test_compatibility(create_options)
  @strategy.deploy(version_label,
                   eb_settings + @component_eb_settings,
                   inactive_settings + @component_inactive_settings)
end

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



27
28
29
30
31
32
33
# File 'lib/eb_deployer/component.rb', line 27

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

end