Skip to content

Commit

Permalink
Change symbols inside hashes to 1.9 JSON-like syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
kalmanh committed May 22, 2014
1 parent 6fd1c05 commit bb05236
Show file tree
Hide file tree
Showing 173 changed files with 761 additions and 761 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -15,4 +15,4 @@ Dir["#{task_dir}/**/*.rake"].each do |task_file|
load task_file
end

task :default => "test:unit"
task default: "test:unit"
2 changes: 1 addition & 1 deletion bin/vagrant
Expand Up @@ -185,7 +185,7 @@ rescue Exception => e
logger.error(e.backtrace.join("\n"))

if env
opts = { :prefix => false }
opts = { prefix: false }
env.ui.error e.message, opts if e.message
env.ui.machine("error-exit", e.class.to_s, e.message.to_s)
else
Expand Down
6 changes: 3 additions & 3 deletions lib/vagrant/action/builtin/box_remove.rb
Expand Up @@ -102,9 +102,9 @@ def call(env)
end

env[:ui].info(I18n.t("vagrant.commands.box.removing",
:name => box.name,
:provider => box.provider,
:version => box.version))
name: box.name,
provider: box.provider,
version: box.version))
box.destroy!

# Passes on the removed box to the rest of the middleware chain
Expand Down
4 changes: 2 additions & 2 deletions lib/vagrant/action/builtin/config_validate.rb
Expand Up @@ -16,9 +16,9 @@ def call(env)

if errors && !errors.empty?
raise Errors::ConfigInvalid,
:errors => Util::TemplateRenderer.render(
errors: Util::TemplateRenderer.render(
"config/validation_failed",
:errors => errors)
errors: errors)
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/action/builtin/destroy_confirm.rb
Expand Up @@ -11,7 +11,7 @@ class DestroyConfirm < Confirm
def initialize(app, env)
force_key = :force_confirm_destroy
message = I18n.t("vagrant.commands.destroy.confirmation",
:name => env[:machine].name)
name: env[:machine].name)

super(app, env, message, force_key, allowed: ["y", "n", "Y", "N"])
end
Expand Down
16 changes: 8 additions & 8 deletions lib/vagrant/action/builtin/handle_forwarded_port_collisions.rb
Expand Up @@ -111,8 +111,8 @@ def handle(env)
if in_use
if !repair || !options[:auto_correct]
raise Errors::ForwardPortCollision,
:guest_port => guest_port.to_s,
:host_port => host_port.to_s
guest_port: guest_port.to_s,
host_port: host_port.to_s
end

@logger.info("Attempting to repair FP collision: #{host_port}")
Expand All @@ -139,9 +139,9 @@ def handle(env)
# If we have no usable ports then we can't repair
if !repaired_port && usable_ports.empty?
raise Errors::ForwardPortAutolistEmpty,
:vm_name => env[:machine].name,
:guest_port => guest_port.to_s,
:host_port => host_port.to_s
vm_name: env[:machine].name,
guest_port: guest_port.to_s,
host_port: host_port.to_s
end

# Modify the args in place
Expand All @@ -151,9 +151,9 @@ def handle(env)

# Notify the user
env[:ui].info(I18n.t("vagrant.actions.vm.forward_ports.fixed_collision",
:host_port => host_port.to_s,
:guest_port => guest_port.to_s,
:new_port => repaired_port.to_s))
host_port: host_port.to_s,
guest_port: guest_port.to_s,
new_port: repaired_port.to_s))
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/vagrant/action/general/package.rb
Expand Up @@ -62,14 +62,14 @@ def copy_include_files
# We place the file in the include directory
to = include_directory.join(dest)

@env[:ui].info I18n.t("vagrant.actions.general.package.packaging", :file => from)
@env[:ui].info I18n.t("vagrant.actions.general.package.packaging", file: from)
FileUtils.mkdir_p(to.parent)

# Copy direcotry contents recursively.
if File.directory?(from)
FileUtils.cp_r(Dir.glob(from), to.parent, :preserve => true)
FileUtils.cp_r(Dir.glob(from), to.parent, preserve: true)
else
FileUtils.cp(from, to, :preserve => true)
FileUtils.cp(from, to, preserve: true)
end
end
rescue Errno::EEXIST => e
Expand All @@ -81,7 +81,7 @@ def copy_include_files

# Compress the exported file into a package
def compress
@env[:ui].info I18n.t("vagrant.actions.general.package.compressing", :tar_path => tar_path)
@env[:ui].info I18n.t("vagrant.actions.general.package.compressing", tar_path: tar_path)

# Copy over the included files
copy_include_files
Expand Down
10 changes: 5 additions & 5 deletions lib/vagrant/batch_action.rb
Expand Up @@ -145,18 +145,18 @@ def run
message += "\n#{e.backtrace.join("\n")}"

errors << I18n.t("vagrant.general.batch_unexpected_error",
:machine => thread[:machine].name,
:message => message)
machine: thread[:machine].name,
message: message)
else
errors << I18n.t("vagrant.general.batch_vagrant_error",
:machine => thread[:machine].name,
:message => thread[:error].message)
machine: thread[:machine].name,
message: thread[:error].message)
end
end
end

if !errors.empty?
raise Errors::BatchMultiError, :message => errors.join("\n\n")
raise Errors::BatchMultiError, message: errors.join("\n\n")
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/box.rb
Expand Up @@ -62,7 +62,7 @@ def initialize(name, provider, version, directory, **opts)
@metadata_url = opts[:metadata_url]

metadata_file = directory.join("metadata.json")
raise Errors::BoxMetadataFileNotFound, :name => @name if !metadata_file.file?
raise Errors::BoxMetadataFileNotFound, name: @name if !metadata_file.file?

begin
@metadata = JSON.parse(directory.join("metadata.json").read)
Expand Down
4 changes: 2 additions & 2 deletions lib/vagrant/box_collection.rb
Expand Up @@ -141,7 +141,7 @@ def add(path, name, version, **opts)
if !found
@logger.error("Added box provider doesnt match expected: #{log_provider}")
raise Errors::BoxProviderDoesntMatch,
:expected => log_provider, :actual => box_provider
expected: log_provider, actual: box_provider
end
else
# Verify the box doesn't already exist
Expand Down Expand Up @@ -400,7 +400,7 @@ def v1_upgrade(dir)
if !metadata_file.file?
metadata_file.open("w") do |f|
f.write(JSON.generate({
:provider => "virtualbox"
provider: "virtualbox"
}))
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/bundler.rb
Expand Up @@ -113,7 +113,7 @@ def install_local(path)
# Bundler shouldn't attempt to get it remotely.
with_isolated_gem do
installer = Gem::DependencyInstaller.new(
:document => [], :prerelease => false)
document: [], prerelease: false)
installer.install(path, "= #{pkg.spec.version}")
end

Expand Down
8 changes: 4 additions & 4 deletions lib/vagrant/capability_host.rb
Expand Up @@ -92,17 +92,17 @@ def capability(cap_name, *args)
cap_mod = capability_module(cap_name.to_sym)
if !cap_mod
raise Errors::CapabilityNotFound,
:cap => cap_name.to_s,
:host => @cap_host_chain[0][0].to_s
cap: cap_name.to_s,
host: @cap_host_chain[0][0].to_s
end

cap_method = nil
begin
cap_method = cap_mod.method(cap_name)
rescue NameError
raise Errors::CapabilityInvalid,
:cap => cap_name.to_s,
:host => @cap_host_chain[0][0].to_s
cap: cap_name.to_s,
host: @cap_host_chain[0][0].to_s
end

args = @cap_args + args
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/cli.rb
Expand Up @@ -90,7 +90,7 @@ def help
o.separator "`vagrant list-commands`."
end

@env.ui.info(opts.help, :prefix => false)
@env.ui.info(opts.help, prefix: false)
end
end
end
6 changes: 3 additions & 3 deletions lib/vagrant/config/loader.rb
Expand Up @@ -197,7 +197,7 @@ def procs_for_path(path)
Kernel.load path
rescue SyntaxError => e
# Report syntax errors in a nice way.
raise Errors::VagrantfileSyntaxError, :file => e.message
raise Errors::VagrantfileSyntaxError, file: e.message
rescue SystemExit
# Continue raising that exception...
raise
Expand All @@ -211,8 +211,8 @@ def procs_for_path(path)

# Report the generic exception
raise Errors::VagrantfileLoadError,
:path => path,
:message => e.message
path: path,
message: e.message
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/config/v2/loader.rb
Expand Up @@ -130,7 +130,7 @@ def self.upgrade(old)
end

old.__internal_state["missing_key_calls"].to_a.sort.each do |key|
warnings << I18n.t("vagrant.config.loader.bad_v1_key", :key => key)
warnings << I18n.t("vagrant.config.loader.bad_v1_key", key: key)
end

[root, warnings, errors]
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/config/v2/root.rb
Expand Up @@ -80,7 +80,7 @@ def validate(machine)
# If we have missing keys, record those as errors
if !@missing_key_calls.empty?
errors["Vagrant"] = @missing_key_calls.to_a.sort.map do |key|
I18n.t("vagrant.config.root.bad_key", :key => key)
I18n.t("vagrant.config.root.bad_key", key: key)
end
end

Expand Down
42 changes: 21 additions & 21 deletions lib/vagrant/environment.rb
Expand Up @@ -70,11 +70,11 @@ class Environment
# to the `Dir.pwd` (which is the cwd of the executing process).
def initialize(opts=nil)
opts = {
:cwd => nil,
:home_path => nil,
:local_data_path => nil,
:ui_class => nil,
:vagrantfile_name => nil,
cwd: nil,
home_path: nil,
local_data_path: nil,
ui_class: nil,
vagrantfile_name: nil,
}.merge(opts || {})

# Set the default working directory to look for the vagrantfile
Expand Down Expand Up @@ -162,16 +162,16 @@ def inspect
def action_runner
@action_runner ||= Action::Runner.new do
{
:action_runner => action_runner,
:box_collection => boxes,
:hook => method(:hook),
:host => host,
:machine_index => machine_index,
:gems_path => gems_path,
:home_path => home_path,
:root_path => root_path,
:tmp_path => tmp_path,
:ui => @ui
action_runner: action_runner,
box_collection: boxes,
hook: method(:hook),
host: host,
machine_index: machine_index,
gems_path: gems_path,
home_path: home_path,
root_path: root_path,
tmp_path: tmp_path,
ui: @ui
}
end
end
Expand Down Expand Up @@ -604,7 +604,7 @@ def setup_home_path
@logger.info("Creating: #{dir}")
FileUtils.mkdir_p(dir)
rescue Errno::EACCES
raise Errors::HomeDirectoryNotAccessible, :home_path => @home_path.to_s
raise Errors::HomeDirectoryNotAccessible, home_path: @home_path.to_s
end
end

Expand Down Expand Up @@ -686,7 +686,7 @@ def setup_local_data_path
FileUtils.mkdir_p(@local_data_path)
rescue Errno::EACCES
raise Errors::LocalDataDirectoryNotAccessible,
:local_data_path => @local_data_path.to_s
local_data_path: @local_data_path.to_s
end
end

Expand All @@ -710,8 +710,8 @@ def copy_insecure_private_key
FileUtils.cp(source, destination)
rescue Errno::EACCES
raise Errors::CopyPrivateKeyFailed,
:source => source,
:destination => destination
source: source,
destination: destination
end
end

Expand Down Expand Up @@ -779,7 +779,7 @@ def upgrade_v1_dotfile(path)
# The file could've been tampered with since Vagrant 1.0.x is
# supposed to ensure that the contents are valid JSON. Show an error.
raise Errors::DotfileUpgradeJSONError,
:state_file => path.to_s
state_file: path.to_s
end

# Alright, let's upgrade this guy to the new structure. Start by
Expand Down Expand Up @@ -810,7 +810,7 @@ def upgrade_v1_dotfile(path)

# Upgrade complete! Let the user know
@ui.info(I18n.t("vagrant.general.upgraded_v1_dotfile",
:backup_path => backup_file.to_s))
backup_path: backup_file.to_s))
end
end
end
12 changes: 6 additions & 6 deletions lib/vagrant/machine.rb
Expand Up @@ -166,8 +166,8 @@ def action(name, extra_env=nil)
# must be raised.
if callable.nil?
raise Errors::UnimplementedProviderAction,
:action => name,
:provider => @provider.to_s
action: name,
provider: @provider.to_s
end

action_raw(name, callable, extra_env)
Expand Down Expand Up @@ -347,10 +347,10 @@ def inspect
# not documented here:
#
# {
# :host => "1.2.3.4",
# :port => "22",
# :username => "mitchellh",
# :private_key_path => "/path/to/my/key"
# host: "1.2.3.4",
# port: "22",
# username: "mitchellh",
# private_key_path: "/path/to/my/key"
# }
#
# Note that Vagrant makes no guarantee that this info works or is
Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant/plugin/state_file.rb
Expand Up @@ -14,7 +14,7 @@ def initialize(path)
@data = JSON.parse(@path.read)
rescue JSON::ParserError => e
raise Vagrant::Errors::PluginStateFileParseError,
:path => path, :message => e.message
path: path, message: e.message
end

upgrade_v0! if !@data["version"]
Expand Down
4 changes: 2 additions & 2 deletions lib/vagrant/plugin/v1/command.rb
Expand Up @@ -51,7 +51,7 @@ def parse_options(opts=nil)
opts.parse!(argv)
return argv
rescue OptionParser::InvalidOption
raise Errors::CLIInvalidOptions, :help => opts.help.chomp
raise Errors::CLIInvalidOptions, help: opts.help.chomp
end

# Yields a VM for each target VM for the command.
Expand Down Expand Up @@ -91,7 +91,7 @@ def with_target_vms(names=nil, options=nil)
else
# String name, just look for a specific VM
vms << @env.vms[name.to_sym]
raise Errors::VMNotFoundError, :name => name if !vms[0]
raise Errors::VMNotFoundError, name: name if !vms[0]
end
end
else
Expand Down

0 comments on commit bb05236

Please sign in to comment.