class Mortar::YankCommand

Public Instance Methods

execute() click to toggle source
# File lib/mortar/yank_command.rb, line 16
def execute
  unless force?
    if $stdin.tty?
      print "enter '#{pastel.cyan(name)}' to confirm yank: "
      begin
        signal_error("confirmation did not match #{pastel.cyan(name)}.") unless $stdin.gets.chomp == name
      rescue Interrupt
        puts
        abort 'Canceled'
      end
    else
      signal_usage_error '--force required when running in a non-interactive mode'
    end
  end

  K8s::Stack.new(
    name, [],
    debug: debug?,
    label: LABEL,
    checksum_annotation: CHECKSUM_ANNOTATION
  ).prune(client, keep_resources: false)

  puts "yanked #{pastel.cyan(name)} successfully!" if $stdout.tty?
end