Class: Murk::Builder::StackBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/murk/builder/stack_builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(stack_name, user:, env:) ⇒ StackBuilder

Returns a new instance of StackBuilder.



7
8
9
10
11
12
# File 'lib/murk/builder/stack_builder.rb', line 7

def initialize(stack_name, user:, env:)
  @stack_name = stack_name
  @env = env
  @user = user
  @parameters_builder = ParametersBuilder.new(env: @env, user: user)
end

Instance Method Details

#buildObject



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

def build
  stack = Murk::Model::Stack.new(@stack_name, env: @env, user: @user)

  if @template_filename
    stack.template_filename = @template_filename
  end
  @parameters_builder.build.each do |parameter|
    stack.add_parameter(parameter)
  end
  stack
end

#parameters(&block) ⇒ Object



31
32
33
34
# File 'lib/murk/builder/stack_builder.rb', line 31

def parameters(&block)
  @parameters_builder.instance_eval(&block)
  self
end

#template(template_filename) ⇒ Object



26
27
28
29
# File 'lib/murk/builder/stack_builder.rb', line 26

def template(template_filename)
  @template_filename = template_filename
  self
end