Class: Jack::Terminate

Inherits:
Object
  • Object
show all
Includes:
Util
Defined in:
lib/jack/terminate.rb

Instance Method Summary collapse

Methods included from Util

#app_name_convention, #aws_bin, #check_aws_setup, #confirm, #eb, #eb_base_flags, #eb_bin, #ensure_folder_exist, #get_answer, #get_region, #prerequisites, #settings, #sh

Constructor Details

#initialize(options = {}) ⇒ Terminate

Returns a new instance of Terminate.



5
6
7
8
9
10
# File 'lib/jack/terminate.rb', line 5

def initialize(options={})
  @options = options
  @root = options[:root] || '.'
  @env_name = options[:env_name]
  @app_name = options[:app] || app_name_convention(@env_name)
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
# File 'lib/jack/terminate.rb', line 12

def run
  check_aws_setup
  message = "Are you sure you want to delete the environment #{@env_name}?".colorize(:yellow)
  if confirm(message) && !@options[:noop]
    eb.terminate_environment(environment_name: @env_name)
    UI.say("Environment #{@env_name} is terminating!")
  else
    UI.say("Whew that was close. Environment #{@env_name} was not deleted.")
  end
end