Class: EbDeployer::Environment

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/eb_deployer/environment.rb

Constant Summary

Constants included from Utils

Utils::BACKOFF_INITIAL_SLEEP

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

#backoff, #reject_nil, #symbolize_keys

Constructor Details

#initialize(app, name, stack_name, eb_driver) {|_self| ... } ⇒ Environment

Returns a new instance of Environment.

Yields:

  • (_self)

Yield Parameters:



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/eb_deployer/environment.rb', line 10

def initialize(app, name, stack_name, eb_driver, &block)
  @app = app
  @name = name
  @stack_name = stack_name
  @eb_driver = eb_driver
  @creation_opts = {}
  @settings = []
  @inactive_settings = []
  @strategy_name = :blue_green
  @components = nil
  yield(self) if block_given?
  unless @components
    @components = [DefaultComponent.new(self, @creation_opts, @strategy_name, @eb_driver)]
  end
end

Instance Attribute Details

#component_under_deploy=(value) ⇒ Object (writeonly)

Sets the attribute component_under_deploy

Parameters:

  • value

    the value to set the attribute component_under_deploy to.



6
7
8
# File 'lib/eb_deployer/environment.rb', line 6

def component_under_deploy=(value)
  @component_under_deploy = value
end

#creation_optsObject

Returns the value of attribute creation_opts.



4
5
6
# File 'lib/eb_deployer/environment.rb', line 4

def creation_opts
  @creation_opts
end

#inactive_settings=(value) ⇒ Object (writeonly)

Sets the attribute inactive_settings

Parameters:

  • value

    the value to set the attribute inactive_settings to.



6
7
8
# File 'lib/eb_deployer/environment.rb', line 6

def inactive_settings=(value)
  @inactive_settings = value
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/eb_deployer/environment.rb', line 8

def name
  @name
end

#resource_stacks=(value) ⇒ Object (writeonly)

Sets the attribute resource_stacks

Parameters:

  • value

    the value to set the attribute resource_stacks to.



6
7
8
# File 'lib/eb_deployer/environment.rb', line 6

def resource_stacks=(value)
  @resource_stacks = value
end

#settings=(value) ⇒ Object (writeonly)

Sets the attribute settings

Parameters:

  • value

    the value to set the attribute settings to.



6
7
8
# File 'lib/eb_deployer/environment.rb', line 6

def settings=(value)
  @settings = value
end

#strategy_nameObject

Returns the value of attribute strategy_name.



4
5
6
# File 'lib/eb_deployer/environment.rb', line 4

def strategy_name
  @strategy_name
end

Instance Method Details

#app_nameObject



26
27
28
# File 'lib/eb_deployer/environment.rb', line 26

def app_name
  @app.name
end

#components=(components_attrs) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/eb_deployer/environment.rb', line 37

def components=(components_attrs)
  return unless components_attrs
  @components = components_attrs.map do |attrs|
    attrs = symbolize_keys(attrs)
    Component.new(attrs.delete(:name), self, attrs, @eb_driver)
  end
end

#deploy(version_label) ⇒ Object



30
31
32
33
34
35
# File 'lib/eb_deployer/environment.rb', line 30

def deploy(version_label)
  resource_settings = @resource_stacks.provision(@stack_name)
  components_to_deploy.each do |component|
    component.deploy(version_label, @settings + resource_settings, @inactive_settings)
  end
end