From 575a9f1021d289b646fb651b2a1ee68133bcc770 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 13 Apr 2010 23:24:36 -0700 Subject: [PATCH] Readded `vagrant down` but as an error message to assist users in migrating to `vagrant destroy` --- lib/vagrant/commands/down.rb | 16 ++++++++++++++++ templates/errors.yml | 3 +++ test/vagrant/commands/down_test.rb | 17 +++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 lib/vagrant/commands/down.rb create mode 100644 test/vagrant/commands/down_test.rb diff --git a/lib/vagrant/commands/down.rb b/lib/vagrant/commands/down.rb new file mode 100644 index 000000000..75e760c2b --- /dev/null +++ b/lib/vagrant/commands/down.rb @@ -0,0 +1,16 @@ +module Vagrant + class Commands + # `vagrant down` is now `vagrant destroy` + class Down < Base + Base.subcommand "down", self + + def execute(args=[]) + error_and_exit(:command_deprecation_down) + end + + def options_spec(opts) + opts.banner = "Usage: vagrant down" + end + end + end +end \ No newline at end of file diff --git a/templates/errors.yml b/templates/errors.yml index 18959e875..d11ee2d0c 100644 --- a/templates/errors.yml +++ b/templates/errors.yml @@ -42,6 +42,9 @@ vagrant box add name uri vagrant box remove name vagrant box list +:command_deprecation_down: |- + `vagrant down` is now `vagrant destroy`. Please use that command instead. This + warning will be removed in future versions. :dotfile_error: |- The dotfile which Vagrant uses to store the UUID of the project's virtual machine already exists and is not a file! The dotfile is diff --git a/test/vagrant/commands/down_test.rb b/test/vagrant/commands/down_test.rb new file mode 100644 index 000000000..634608d17 --- /dev/null +++ b/test/vagrant/commands/down_test.rb @@ -0,0 +1,17 @@ +require File.join(File.dirname(__FILE__), '..', '..', 'test_helper') + +class CommandsDownTest < Test::Unit::TestCase + setup do + @klass = Vagrant::Commands::Down + + @env = mock_environment + @instance = @klass.new(@env) + end + + context "executing" do + should "just error and exit" do + @instance.expects(:error_and_exit).with(:command_deprecation_down) + @instance.execute + end + end +end