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 = env
@env["download.classes"] ||= [] @env["download.classes"] ||= []
@env["download.classes"] += [Downloaders::HTTP, Downloaders::File] @env["download.classes"] += [Downloaders::HTTP, Downloaders::File]
@downloader = nil
end end
def call(env) def call(env)

View File

@ -12,6 +12,7 @@ module Vagrant
# Creates the instance of the ActiveList, with the given environment # Creates the instance of the ActiveList, with the given environment
# if specified # if specified
def initialize(env=nil) def initialize(env=nil)
@list = nil
@env = env @env = env
end end

View File

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

View File

@ -15,13 +15,12 @@ module Vagrant
attr_reader :parent # Parent environment (in the case of multi-VMs) 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_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 :root_path
attr_reader :config attr_reader :config
attr_reader :host attr_reader :host
attr_reader :box attr_reader :box
attr_accessor :vm attr_accessor :vm
attr_reader :vms
attr_reader :active_list attr_reader :active_list
attr_reader :logger attr_reader :logger
attr_reader :actions attr_reader :actions
@ -340,8 +339,8 @@ module Vagrant
return parent.update_dotfile if parent return parent.update_dotfile if parent
# Generate and save the persisted VM info # Generate and save the persisted VM info
data = vms.inject({}) do |acc, data| data = vms.inject({}) do |acc, values|
key, value = data key, value = values
acc[key] = value.uuid if value.created? acc[key] = value.uuid if value.created?
acc acc
end end

View File

@ -37,7 +37,7 @@ class PackageGeneralActionTest < Test::Unit::TestCase
assert_equal [], @env["package.include"] assert_equal [], @env["package.include"]
end 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" @env["package.include"] = "foo"
@klass.new(@app, @env) @klass.new(@app, @env)
assert_equal "foo", @env["package.include"] assert_equal "foo", @env["package.include"]

View File

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

View File

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

View File

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