Vagrantfile in the home path is now injected into the vagrantfile load sequence
This commit is contained in:
parent
5995191972
commit
e09dbfa367
|
@ -58,14 +58,17 @@ msg
|
||||||
# Prepare load paths for config files
|
# Prepare load paths for config files
|
||||||
load_paths = [File.join(PROJECT_ROOT, "config", "default.rb")]
|
load_paths = [File.join(PROJECT_ROOT, "config", "default.rb")]
|
||||||
load_paths << File.join(box.directory, ROOTFILE_NAME) if box
|
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
|
load_paths << File.join(root_path, ROOTFILE_NAME) if root_path
|
||||||
|
|
||||||
# Then clear out the old data
|
# Then clear out the old data
|
||||||
Config.reset!
|
Config.reset!
|
||||||
|
|
||||||
load_paths.each do |path|
|
load_paths.each do |path|
|
||||||
logger.info "Loading config from #{path}..."
|
if File.exist?(path)
|
||||||
load path if File.exist?(path)
|
logger.info "Loading config from #{path}..."
|
||||||
|
load path
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Execute the configurations
|
# Execute the configurations
|
||||||
|
|
|
@ -107,6 +107,11 @@ class EnvTest < Test::Unit::TestCase
|
||||||
Vagrant::Env.load_config!
|
Vagrant::Env.load_config!
|
||||||
end
|
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
|
should "not load from the root path if nil" do
|
||||||
Vagrant::Env.stubs(:root_path).returns(nil)
|
Vagrant::Env.stubs(:root_path).returns(nil)
|
||||||
File.expects(:exist?).with(File.join(@root_path, Vagrant::Env::ROOTFILE_NAME)).never
|
File.expects(:exist?).with(File.join(@root_path, Vagrant::Env::ROOTFILE_NAME)).never
|
||||||
|
|
Loading…
Reference in New Issue