From e09dbfa3675d27dbfd176b547005501eddbdb518 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 12 Mar 2010 21:03:49 -0800 Subject: [PATCH] Vagrantfile in the home path is now injected into the vagrantfile load sequence --- lib/vagrant/env.rb | 7 +++++-- test/vagrant/env_test.rb | 5 +++++ 2 files changed, 10 insertions(+), 2 deletions(-) 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