From fd5b2dee275ce8e326cf7b8a95230f5cf78df562 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 24 Aug 2010 23:05:40 -0700 Subject: [PATCH] `vagrant destroy` --- lib/vagrant/command/destroy.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/vagrant/command/destroy.rb diff --git a/lib/vagrant/command/destroy.rb b/lib/vagrant/command/destroy.rb new file mode 100644 index 000000000..8f7c3f726 --- /dev/null +++ b/lib/vagrant/command/destroy.rb @@ -0,0 +1,18 @@ +module Vagrant + module Command + class DestroyCommand < Base + desc "Destroy the environment, deleting the created virtual machines." + register "destroy" + + def execute + target_vms.each do |vm| + if vm.created? + vm.destroy + else + vm.env.ui.info "VM not created. Moving on..." + end + end + end + end + end +end