Vagrantfile in the home path is now injected into the vagrantfile load sequence

This commit is contained in:
Mitchell Hashimoto 2010-03-12 21:03:49 -08:00
parent 5995191972
commit e09dbfa367
2 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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