class Management::Server::Destroy

Public Instance Methods

run(*server_names) click to toggle source
# File lib/management/commands/server/destroy.rb, line 11
def run(*server_names)
  servers = server_names.map{|server_name| get_server(server_name)}

  puts "You are about to delete the following servers:"
  puts ['', *servers.map{ |server| " - #{server.name}" }, '', ''].join("\n")

  print "Are you sure you want to do this? Type 'Yes' to continue, or anything else to abort: "
  abort "Aborted." if $stdin.gets.chomp != 'Yes'

  servers.each do |server|
    puts "Destroying #{server.name}..."
    server.destroy
    puts "Done."
  end
end