Properly reload configuration once all the basics are loaded
This commit is contained in:
parent
e09dbfa367
commit
98d8c1978b
|
@ -24,6 +24,7 @@ module Vagrant
|
|||
load_config!
|
||||
load_home_directory!
|
||||
load_box!
|
||||
load_config!
|
||||
check_virtualbox!
|
||||
load_vm!
|
||||
end
|
||||
|
@ -58,7 +59,7 @@ 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(home_path, ROOTFILE_NAME) if Vagrant.config.vagrant.home
|
||||
load_paths << File.join(root_path, ROOTFILE_NAME) if root_path
|
||||
|
||||
# Then clear out the old data
|
||||
|
@ -93,11 +94,6 @@ msg
|
|||
return unless root_path
|
||||
|
||||
@@box = Box.find(Vagrant.config.vm.box) if Vagrant.config.vm.box
|
||||
|
||||
if @@box
|
||||
logger.info("Reloading configuration to account for loaded box...")
|
||||
load_config!
|
||||
end
|
||||
end
|
||||
|
||||
def load_vm!
|
||||
|
|
|
@ -112,6 +112,15 @@ class EnvTest < Test::Unit::TestCase
|
|||
Vagrant::Env.load_config!
|
||||
end
|
||||
|
||||
should "not load from the home directory if the home config is nil" do
|
||||
mock_config do |config|
|
||||
config.vagrant.home = nil
|
||||
end
|
||||
|
||||
File.expects(:exist?).with(File.join(Vagrant::Env.home_path, Vagrant::Env::ROOTFILE_NAME)).never
|
||||
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
|
||||
|
@ -158,6 +167,7 @@ class EnvTest < Test::Unit::TestCase
|
|||
Vagrant::Env.expects(:load_config!).once.in_sequence(call_seq)
|
||||
Vagrant::Env.expects(:load_home_directory!).once.in_sequence(call_seq)
|
||||
Vagrant::Env.expects(:load_box!).once.in_sequence(call_seq)
|
||||
Vagrant::Env.expects(:load_config!).once.in_sequence(call_seq)
|
||||
Vagrant::Env.expects(:check_virtualbox!).once.in_sequence(call_seq)
|
||||
Vagrant::Env.expects(:load_vm!).once.in_sequence(call_seq)
|
||||
Vagrant::Env.load!
|
||||
|
@ -315,12 +325,6 @@ class EnvTest < Test::Unit::TestCase
|
|||
Vagrant::Env.load_box!
|
||||
assert @box.equal?(Vagrant::Env.box)
|
||||
end
|
||||
|
||||
should "load the config if a box is loaded" do
|
||||
Vagrant::Env.expects(:load_config!).once
|
||||
Vagrant::Box.expects(:find).returns(@box)
|
||||
Vagrant::Env.load_box!
|
||||
end
|
||||
end
|
||||
|
||||
context "requiring boxes" do
|
||||
|
|
Loading…
Reference in New Issue