Module: Bauble::Cli::Commands::Destroy
- Included in:
- BaubleCli
- Defined in:
- lib/bauble/cli/commands/destroy.rb
Overview
Up command
Class Method Summary collapse
Class Method Details
.included(thor) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/bauble/cli/commands/destroy.rb', line 13 def included(thor) thor.class_eval do desc 'destroy', 'Destroy the application' method_option :stack, type: :string, desc: 'The stack to destroy', aliases: '-s' def destroy Logger.logo Logger.nl setup_app # check for any stacks raise 'No stacks found' if @app.stacks.empty? # check for multiple stacks if @app.stacks.length > 1 && [:stack].nil? Logger.error 'Must provide a stack when multiple are defined' exit(1) end unless yes?('Are you sure you want to destroy the application? [y/N]') Logger.log('Destroy aborted') exit(0) end Logger.block_log('Destroying application...') # set up stack stack_name = [:stack] || @app.stacks.first.name @app.change_current_stack(stack_name) # initialize pulumi pulumi.init! # create or select stack pulumi.create_or_select_stack(stack_name) # destroy the stack pulumi.destroy Logger.log "Destroy complete\n" end end end |