Class: Cody::Stack

Inherits:
Object
  • Object
show all
Includes:
AwsServices
Defined in:
lib/cody/stack.rb,
lib/cody/stack/base.rb,
lib/cody/stack/create.rb,
lib/cody/stack/update.rb

Defined Under Namespace

Classes: Base, Create, Update

Instance Method Summary collapse

Methods included from AwsServices

#cfn, #codebuild

Methods included from AwsServices::Helpers

#are_you_sure?, #find_stack, #inferred_project_name, #inferred_stack_name, #normalize_stack_name, #project_name_convention, #stack_exists?

Constructor Details

#initialize(options) ⇒ Stack

Returns a new instance of Stack.



7
8
9
10
11
# File 'lib/cody/stack.rb', line 7

def initialize(options)
  @options = options
  @project_name = @options[:project_name] || inferred_project_name
  @stack_name = normalize_stack_name(options[:stack_name] || inferred_stack_name(@project_name))
end

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
# File 'lib/cody/stack.rb', line 13

def run
  handle_rollback_completed!
  if stack_exists?(@stack_name)
    Update.new(@options).run
  else
    Create.new(@options).run
  end
end