Class: Ufo::Stack::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/ufo/stack/builder.rb,
lib/ufo/stack/builder/base.rb,
lib/ufo/stack/builder/outputs.rb,
lib/ufo/stack/builder/resources.rb,
lib/ufo/stack/builder/conditions.rb,
lib/ufo/stack/builder/parameters.rb

Defined Under Namespace

Classes: Base, Conditions, Outputs, Parameters, Resources

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ Builder

Returns a new instance of Builder.



5
6
7
8
9
10
11
12
13
# File 'lib/ufo/stack/builder.rb', line 5

def initialize(context)
  @context = context
  # This builder class is really used as a singleton.
  # To avoid having to pass context to all the builder classes.
  self.class.context = @context
  @template = {
    Description: "Ufo ECS stack #{context.stack_name}",
  }
end

Instance Method Details

#buildObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/ufo/stack/builder.rb', line 15

def build
  @template[:Parameters] = Parameters.new.build
  @template[:Conditions] = Conditions.new.build
  @template[:Resources] = Resources.new.build
  @template[:Outputs] = Outputs.new.build
  @template.deep_stringify_keys!
  @template = Ufo::Utils::Squeezer.new(@template).squeeze
  @template = CustomProperties.new(@template, @context.stack_name).apply
  YAML.dump(@template)
end