Get rid of all Ruby warnings in Vagrant

This commit is contained in:
Mitchell Hashimoto 2010-08-25 23:21:23 -07:00
parent 3784eb82fb
commit aaac5fbf1e
8 changed files with 22 additions and 15 deletions

View File

@ -13,6 +13,7 @@ module Vagrant
@env = env
@env["download.classes"] ||= []
@env["download.classes"] += [Downloaders::HTTP, Downloaders::File]
@downloader = nil
end
def call(env)

View File

@ -12,6 +12,7 @@ module Vagrant
# Creates the instance of the ActiveList, with the given environment
# if specified
def initialize(env=nil)
@list = nil
@env = env
end
@ -80,4 +81,4 @@ module Vagrant
File.join(env.home_path, FILENAME)
end
end
end
end

View File

@ -66,7 +66,7 @@ module Vagrant
attr_accessor :forwarded_port_key
attr_accessor :max_tries
attr_accessor :timeout
attr_accessor :private_key_path
attr_writer :private_key_path
attr_accessor :forward_agent
# The attribute(s) below do nothing. They are just kept here to
@ -103,11 +103,11 @@ module Vagrant
attr_reader :forwarded_ports
attr_reader :shared_folders
attr_reader :network_options
attr_accessor :hd_location
attr_reader :hd_location
attr_accessor :disk_image_format
attr_accessor :provisioner
attr_accessor :shared_folder_uid
attr_accessor :shared_folder_gid
attr_writer :shared_folder_uid
attr_writer :shared_folder_gid
attr_accessor :system
# Represents a SubVM. This class is only used here in the VMs
@ -197,9 +197,13 @@ module Vagrant
class VagrantConfig < Base
attr_accessor :dotfile_name
attr_accessor :log_output
attr_accessor :home
attr_writer :home
attr_accessor :host
def initialize
@home = nil
end
def home
@home ? File.expand_path(@home) : nil
end

View File

@ -15,13 +15,12 @@ module Vagrant
attr_reader :parent # Parent environment (in the case of multi-VMs)
attr_reader :vm_name # The name of the VM (internal name) which this environment represents
attr_accessor :cwd
attr_writer :cwd
attr_reader :root_path
attr_reader :config
attr_reader :host
attr_reader :box
attr_accessor :vm
attr_reader :vms
attr_reader :active_list
attr_reader :logger
attr_reader :actions
@ -340,8 +339,8 @@ module Vagrant
return parent.update_dotfile if parent
# Generate and save the persisted VM info
data = vms.inject({}) do |acc, data|
key, value = data
data = vms.inject({}) do |acc, values|
key, value = values
acc[key] = value.uuid if value.created?
acc
end

View File

@ -37,7 +37,7 @@ class PackageGeneralActionTest < Test::Unit::TestCase
assert_equal [], @env["package.include"]
end
should "not set the output path if it is already set" do
should "not set the include path if it is already set" do
@env["package.include"] = "foo"
@klass.new(@app, @env)
assert_equal "foo", @env["package.include"]

View File

@ -44,8 +44,8 @@ class BoxTest < Test::Unit::TestCase
files = [true, false]
Dir.expects(:open).yields(dir)
dir_sequence = sequence("directory")
dir.each_with_index do |dir, index|
File.expects(:directory?).with(File.join(@boxes_path, dir)).returns(files[index]).in_sequence(dir_sequence)
dir.each_with_index do |value, index|
File.expects(:directory?).with(File.join(@boxes_path, value)).returns(files[index]).in_sequence(dir_sequence)
end
result = Vagrant::Box.all(@env)

View File

@ -240,6 +240,8 @@ class ConfigTest < Test::Unit::TestCase
context "VM configuration" do
setup do
@username = "mitchellh"
@env = mock_environment
@config = @env.config.vm
@env.config.ssh.username = @username

View File

@ -581,10 +581,10 @@ class EnvironmentTest < Test::Unit::TestCase
should "blank the VMs" do
@env = mock_environment do |config|
config.vm.define :foo do |config|
config.vm.define :foo do |foo_config|
end
config.vm.define :bar do |config|
config.vm.define :bar do |bar_config|
end
end