From 58237db6757230eae2cba51ab053c87e89ac4b68 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 26 Aug 2010 23:27:21 -0700 Subject: [PATCH] Remove unused methods in environment and their translations --- lib/vagrant/environment.rb | 14 ---------- templates/strings.yml | 48 -------------------------------- test/vagrant/environment_test.rb | 39 -------------------------- 3 files changed, 101 deletions(-) diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index e73beb86f..c4b6d8313 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -362,19 +362,5 @@ module Vagrant # Also add to the global store # active_list.add(vm) end - - #--------------------------------------------------------------- - # Methods to check for properties and error - #--------------------------------------------------------------- - - def require_root_path - error_and_exit(:rootfile_not_found) if !root_path - end - - def require_persisted_vm - require_root_path - - error_and_exit(:environment_not_created) if !vm - end end end diff --git a/templates/strings.yml b/templates/strings.yml index fc11beba1..e546d338c 100644 --- a/templates/strings.yml +++ b/templates/strings.yml @@ -30,8 +30,6 @@ :box_already_exists: |- This box appears to already exist! Please call `vagrant box remove <%= box_name %>` and then try to add it again. -:box_add_already_exists: |- - A box with the name '<%= box_name %>' already exists, please use another name or use `vagrant box remove <%= box_name %>` :box_download_unknown_type: |- Unknown URI type for box download. :box_download_http_socket_error: |- @@ -107,11 +105,6 @@ The given box does not exist on the file system: <%= source_url %> -:environment_not_created: |- - The task you're trying to run requires that the vagrant environment - already be created, but unfortunately this vagrant still appears to - have no box! You can setup the environment by setting up your - <%= Vagrant::Environment::ROOTFILE_NAME %> and running `vagrant up` :nfs_host_required: |- A host class is required for NFS shared folders. By default, these are auto-detected, but can be overriden with `config.vagrant.host`. @@ -135,11 +128,6 @@ a bridged or non-hostonly network. :package_include_file_doesnt_exist: |- File specified to include: '<%= filename %>' does not exist! -:package_multivm: |- - Because this Vagrant environment represents multiple VMs, a - specific VM must be specified. This can be done by calling - `vagrant package NAME` where NAME is a valid VM represented by - your Vagrantfile. :package_output_exists: |- The specified file to save the package as already exists. Please remove this file or specify a different filename for outputting. @@ -153,14 +141,6 @@ Provisioners must be an instance of Vagrant::Provisioners::Base :provisioner_unknown_type: |- Unknown provisioner type: <%= provisioner %> -:rootfile_already_exists: |- - It looks like this directory is already setup for vagrant! (A <%= Vagrant::Environment::ROOTFILE_NAME %> - already exists.) -:rootfile_not_found: |- - A `<%= Vagrant::Environment::ROOTFILE_NAME %>` was not found! This file is required for vagrant to run - since it describes the expected environment that vagrant is supposed - to manage. Please create a `<%= Vagrant::Environment::ROOTFILE_NAME %>` and place it in your project - root. :ssh_bad_permissions: |- The private key to connect to this box via SSH has invalid permissions set on it. The permissions of the private key should be set to 0600, otherwise SSH will @@ -187,24 +167,6 @@ For a more detailed guide please consult: http://vagrantup.com/docs/getting-started/windows.html -:ssh_multivm: |- - Because this Vagrant environment represents multiple VMs, a - specific VM must be specified. This can be done by calling - `vagrant ssh NAME` where NAME is a valid VM represented by - your Vagrantfile. - - Alternatively, if you mark one of your VMs as 'primary,' - then Vagrant will default to that VM. This can be done by - specifying `:primary => true` when defining the VM. Example: - - config.vm.define(:foo, :primary => true) do |config| - ... - end -:ssh_config_multivm: |- - Because this Vagrant environment represents multiple VMs, a - specific VM must be specified. This can be done by calling - `vagrant ssh-config NAME` where NAME is a valid VM represented by - your Vagrantfile. :system_invalid_class: |- The specified system does not inherit from `Vagrant::Systems::Base`. The specified system class must inherit from this class. @@ -221,19 +183,11 @@ for folder syncing via unison. Please install unison on your system to use folder syncing. You may also disable folder syncing, install unison, re-enable syncing, then call a `vagrant reload` to enable syncing. -:unknown_vm: |- - The specified VM could not be found: <%= vm %> :virtualbox_import_failure: |- The VM import failed! Try running `VBoxManage import` on the box file manually for more verbose error output. :vm_failed_to_boot: |- Failed to connect to VM! Failed to boot? -:vm_base_not_found: |- - The specified base VM "<%= name %>" was not found. -:vm_not_running_for_suspend: |- - The vagrant virtual environment you are trying to suspend must be running to be suspended. -:vm_not_suspended: |- - The vagrant virtual environment you are trying to resume is not in a suspended state. :vm_port_auto_empty: |- Vagrant found a port collision for the specified port and virtual machine. While this port was marked to be auto-corrected, the ports in the @@ -256,8 +210,6 @@ port. Example, where '1234' would be replaced by a unique host port: config.vm.forward_port("<%= name %>", <%= guestport %>, 1234) -:vm_power_off_to_move_hd: |- - The virtual machine must be powered off to move its disk. :vm_power_off_to_package: |- The vagrant virtual environment you are trying to package must be powered off. :vm_mount_fail: |- diff --git a/test/vagrant/environment_test.rb b/test/vagrant/environment_test.rb index 68564b3a4..5f4990898 100644 --- a/test/vagrant/environment_test.rb +++ b/test/vagrant/environment_test.rb @@ -645,45 +645,6 @@ class EnvironmentTest < Test::Unit::TestCase end end - context "requiring properties" do - setup do - @env = mock_environment - end - - context "requiring root_path" do - should "error and exit if no root_path is set" do - @env.expects(:root_path).returns(nil) - @env.expects(:error_and_exit).with(:rootfile_not_found).once - @env.require_root_path - end - - should "not error and exit if root_path is set" do - @env.expects(:root_path).returns("foo") - @env.expects(:error_and_exit).never - @env.require_root_path - end - end - - context "requiring a persisted VM" do - setup do - @env.stubs(:vm).returns("foo") - @env.stubs(:require_root_path) - end - - should "require a root path" do - @env.expects(:require_root_path).once - @env.expects(:error_and_exit).never - @env.require_persisted_vm - end - - should "error and exit if the VM is not set" do - @env.expects(:vm).returns(nil) - @env.expects(:error_and_exit).once - @env.require_persisted_vm - end - end - end - context "managing VM" do setup do @env = mock_environment