diff --git a/lib/vagrant/env.rb b/lib/vagrant/env.rb index f0ee5168d..40a741fbb 100644 --- a/lib/vagrant/env.rb +++ b/lib/vagrant/env.rb @@ -58,14 +58,17 @@ msg # Prepare load paths for config files load_paths = [File.join(PROJECT_ROOT, "config", "default.rb")] load_paths << File.join(box.directory, ROOTFILE_NAME) if box + load_paths << File.join(home_path, ROOTFILE_NAME) load_paths << File.join(root_path, ROOTFILE_NAME) if root_path # Then clear out the old data Config.reset! load_paths.each do |path| - logger.info "Loading config from #{path}..." - load path if File.exist?(path) + if File.exist?(path) + logger.info "Loading config from #{path}..." + load path + end end # Execute the configurations diff --git a/test/vagrant/env_test.rb b/test/vagrant/env_test.rb index e7f7786c3..e5e3c6138 100644 --- a/test/vagrant/env_test.rb +++ b/test/vagrant/env_test.rb @@ -107,6 +107,11 @@ class EnvTest < Test::Unit::TestCase Vagrant::Env.load_config! end + should "load from the home directory" do + File.expects(:exist?).with(File.join(Vagrant::Env.home_path, Vagrant::Env::ROOTFILE_NAME)).once + Vagrant::Env.load_config! + end + should "not load from the root path if nil" do Vagrant::Env.stubs(:root_path).returns(nil) File.expects(:exist?).with(File.join(@root_path, Vagrant::Env::ROOTFILE_NAME)).never