diff --git a/lib/vagrant/config.rb b/lib/vagrant/config.rb index b01e2d397..d08e1907d 100644 --- a/lib/vagrant/config.rb +++ b/lib/vagrant/config.rb @@ -1,4 +1,5 @@ require 'vagrant/config/base' +require 'vagrant/config/error_recorder' module Vagrant # The config class is responsible for loading Vagrant configurations @@ -35,7 +36,6 @@ module Vagrant config_object ||= config run_procs!(config_object) - config_object.loaded! config_object end end @@ -89,23 +89,8 @@ module Vagrant instance_variable_set("@#{key}".to_sym, config) end - @loaded = false @env = env end - - def loaded? - @loaded - end - - def loaded! - @loaded = true - end - - # Deep clones the entire configuration tree using the marshalling - # trick. All subclasses must be able to marshal properly. - def deep_clone - Marshal.load(Marshal.dump(self)) - end end end end diff --git a/lib/vagrant/util/resource_logger.rb b/lib/vagrant/util/resource_logger.rb index 3a256fc3a..ba3a75396 100644 --- a/lib/vagrant/util/resource_logger.rb +++ b/lib/vagrant/util/resource_logger.rb @@ -31,11 +31,7 @@ module Vagrant # instantiated, then the given environment will be used to # create a new logger. def singleton_logger(env=nil) - if env && env.config && env.config.loaded? - @@singleton_logger ||= PlainLogger.new(env.config.vagrant.log_output) - else - PlainLogger.new(nil) - end + @@singleton_logger ||= PlainLogger.new(env.config.vagrant.log_output) end # Resets the singleton logger (only used for testing). diff --git a/test/vagrant/config_test.rb b/test/vagrant/config_test.rb index 587d279fb..1163b0e0f 100644 --- a/test/vagrant/config_test.rb +++ b/test/vagrant/config_test.rb @@ -124,16 +124,6 @@ class ConfigTest < Test::Unit::TestCase @klass.execute! end - should "not be loaded, initially" do - assert !@klass.config.loaded? - end - - should "be loaded after running" do - @klass.run {} - @klass.execute! - assert @klass.config.loaded? - end - should "return the configuration on execute!" do @klass.run {} result = @klass.execute! @@ -198,40 +188,5 @@ class ConfigTest < Test::Unit::TestCase assert_equal instance, config.send(key) end end - - context "loaded status" do - setup do - @top= @klass::Top.new - end - - should "not be loaded by default" do - assert !@top.loaded? - end - - should "be loaded after calling loaded!" do - @top.loaded! - assert @top.loaded? - end - end - - context "deep cloning" do - class DeepCloneConfig < Vagrant::Config::Base - attr_accessor :attribute - end - - setup do - @klass::Top.configures :deep, DeepCloneConfig - @top = @klass::Top.new - @top.deep.attribute = [1,2,3] - end - - should "deep clone the object" do - copy = @top.deep_clone - copy.deep.attribute << 4 - assert_not_equal @top.deep.attribute, copy.deep.attribute - assert_equal 3, @top.deep.attribute.length - assert_equal 4, copy.deep.attribute.length - end - end end end diff --git a/test/vagrant/util/resource_logger_test.rb b/test/vagrant/util/resource_logger_test.rb index 0784ae0a2..a39900681 100644 --- a/test/vagrant/util/resource_logger_test.rb +++ b/test/vagrant/util/resource_logger_test.rb @@ -12,11 +12,6 @@ class ResourceLoggerUtilTest < Test::Unit::TestCase @result = mock("result") end - should "return a nil plain logger if no environment is given" do - Vagrant::Util::PlainLogger.expects(:new).with(nil).returns(@result) - assert_equal @result, @klass.singleton_logger - end - should "return a nil plain logger if the config is not loaded" do env = mock_environment env.config.stubs(:loaded?).returns(false)