class Codepipe::Delete

Public Class Methods

new(options) click to toggle source
# File lib/codepipe/delete.rb, line 5
def initialize(options)
  @options = options
  @pipeline_name = options[:pipeline_name] || inferred_pipeline_name
  @stack_name = options[:stack_name] || inferred_stack_name(@pipeline_name)
end

Public Instance Methods

run() click to toggle source
# File lib/codepipe/delete.rb, line 11
def run
  message = "Deleted #{@stack_name} stack."
  if @options[:noop]
    puts "NOOP #{message}"
  else
    are_you_sure?(@stack_name, :delete)

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