Class: LonoCfn::Delete

Inherits:
Object
  • Object
show all
Includes:
AwsServices, Util
Defined in:
lib/lono-cfn/delete.rb

Instance Method Summary collapse

Methods included from Util

#are_you_sure?

Methods included from AwsServices

#cfn, #stack_exists?, #testing_update?

Constructor Details

#initialize(stack_name, options = {}) ⇒ Delete

Returns a new instance of Delete.



6
7
8
9
10
# File 'lib/lono-cfn/delete.rb', line 6

def initialize(stack_name, options={})
  @stack_name = stack_name
  @options = options
  @project_root = options[:project_root] || '.'
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/lono-cfn/delete.rb', line 12

def run
  message = "Deleted #{@stack_name} stack."
  if @options[:noop]
    puts "NOOP #{message}"
  else
    are_you_sure?(:delete)

    if stack_exists?(@stack_name)
      cfn.delete_stack(stack_name: @stack_name)
      puts message
    else
      puts "#{@stack_name.inspect} stack does not exist".colorize(:red)
    end
  end
end