Class: Ufo::Destroy

Inherits:
Base
  • Object
show all
Defined in:
lib/ufo/destroy.rb

Instance Method Summary collapse

Methods inherited from Base

#info, #initialize, #no_service_message, #switch_current

Methods included from Stack::Helper

#adjust_stack_name, #find_stack, #status

Methods included from Util

#default_cluster, #display_params, #execute, #pretty_time, #settings, #task_definition_arns, #user_params

Methods included from AwsService

#cloudformation, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb

Constructor Details

This class inherits a constructor from Ufo::Base

Instance Method Details

#are_you_sure?Boolean

Returns:

  • (Boolean)


21
22
23
24
25
26
27
# File 'lib/ufo/destroy.rb', line 21

def are_you_sure?
  return true if @options[:sure]
  puts "You are about to destroy #{@pretty_service_name.colorize(:green)} service on the #{@cluster.colorize(:green)} cluster."
  print "Are you sure you want to do this? (y/n) "
  answer = $stdin.gets.strip
  answer =~ /^y/
end

#byeObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ufo/destroy.rb', line 3

def bye
  unless are_you_sure?
    puts "Phew, that was close"
    return
  end

  stack = find_stack(@stack_name)
  unless stack
    puts "Stack #{@stack_name} does not exit"
    exit
  end

  cloudformation.delete_stack(stack_name: @stack_name)
  puts "Deleting CloudFormation stack with ECS resources: #{@stack_name}."
  return unless @options[:wait]
  status.wait
end