Fix issues with Ruby 1.8.7 where Vagrant wouldn't even run

This commit is contained in:
Mitchell Hashimoto 2010-09-27 12:10:17 -07:00
parent caa80d54ac
commit 1199c89a4a
4 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
## 0.6.1 (unreleased) ## 0.6.1 (unreleased)
- Fix issues with Ruby 1.8.7 where Vagrant simply failed.
## 0.6.0 (September 27, 2010) ## 0.6.0 (September 27, 2010)

View File

@ -116,19 +116,19 @@ module Vagrant
# #
# If you're looking to create your own configuration class, see {Base}. # If you're looking to create your own configuration class, see {Base}.
class Top < Base class Top < Base
@@configures = [] @@configures = {} if !defined?(@@configures)
class << self class << self
# The list of registered configuration classes as well as the key # The list of registered configuration classes as well as the key
# they're registered under. # they're registered under.
def configures_list def configures_list
@@configures ||= [] @@configures ||= {}
end end
# Registers a configuration class with the given key. This method shouldn't # Registers a configuration class with the given key. This method shouldn't
# be called. Instead, inherit from {Base} and call {Base.configures}. # be called. Instead, inherit from {Base} and call {Base.configures}.
def configures(key, klass) def configures(key, klass)
configures_list << [key, klass] configures_list[key] = klass
attr_reader key.to_sym attr_reader key.to_sym
end end
end end

View File

@ -28,7 +28,7 @@ module Vagrant
[[:warn, :yellow], [:error, :red], [:info, nil], [:confirm, :green]].each do |method, color| [[:warn, :yellow], [:error, :red], [:info, nil], [:confirm, :green]].each do |method, color|
class_eval <<-CODE class_eval <<-CODE
def #{method}(message, opts=nil) def #{method}(message, opts=nil)
@shell.say("\#{line_reset}\#{format_message(message, opts)}", color) @shell.say("\#{line_reset}\#{format_message(message, opts)}", "#{color}")
end end
CODE CODE
end end

View File

@ -138,7 +138,7 @@ class ConfigTest < Test::Unit::TestCase
context "top config class" do context "top config class" do
setup do setup do
@configures_list = [] @configures_list = {}
@klass::Top.stubs(:configures_list).returns(@configures_list) @klass::Top.stubs(:configures_list).returns(@configures_list)
end end
@ -149,8 +149,8 @@ class ConfigTest < Test::Unit::TestCase
end end
should "add key and klass to configures list" do should "add key and klass to configures list" do
@configures_list.expects(:<<).with([@key, @config_klass])
@klass::Top.configures(@key, @config_klass) @klass::Top.configures(@key, @config_klass)
assert_equal @config_klass, @configures_list[@key]
end end
end end
@ -168,7 +168,7 @@ class ConfigTest < Test::Unit::TestCase
instance = mock("instance#{i}") instance = mock("instance#{i}")
instance.expects(:env=).with(env) instance.expects(:env=).with(env)
klass.expects(:new).returns(instance) klass.expects(:new).returns(instance)
@configures_list << [key, klass] @configures_list[key] = klass
end end
@klass::Top.new(env) @klass::Top.new(env)