Skip to content

Commit

Permalink
Change symbols inside hashes to Ruby 1.9 syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
legal90 committed Jul 6, 2014
1 parent 7a0942e commit 1f068b2
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 90 deletions.
4 changes: 2 additions & 2 deletions lib/vagrant-parallels/action/customize.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def call(env)
env[:machine].provider.driver.execute_prlctl(*processed_command)
rescue VagrantPlugins::Parallels::Errors::ExecutionError => e
raise Vagrant::Errors::VMCustomizationFailed, {
:command => command,
:error => e.inspect
command: command,
error: e.inspect
}
end
end
Expand Down
92 changes: 46 additions & 46 deletions lib/vagrant-parallels/action/network.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ def call(env)

def bridged_config(options)
return {
:auto_config => true,
:bridge => nil,
:mac => nil,
:nic_type => nil,
:use_dhcp_assigned_default_route => false
auto_config: true,
bridge: nil,
mac: nil,
nic_type: nil,
use_dhcp_assigned_default_route: false
}.merge(options || {})
end

Expand Down Expand Up @@ -204,39 +204,39 @@ def bridged_adapter(config)

# Given the choice we can now define the adapter we're using
return {
:adapter => config[:adapter],
:type => :bridged,
:bridge => chosen_bridge,
:mac_address => config[:mac],
:nic_type => config[:nic_type]
adapter: config[:adapter],
type: :bridged,
bridge: chosen_bridge,
mac_address: config[:mac],
nic_type: config[:nic_type]
}
end

def bridged_network_config(config)
if config[:ip]
options = {
:auto_config => true,
:mac => nil,
:netmask => "255.255.255.0",
:type => :static
auto_config: true,
mac: nil,
netmask: "255.255.255.0",
type: :static
}.merge(config)
options[:type] = options[:type].to_sym
return options
end

return {
:type => :dhcp,
:use_dhcp_assigned_default_route => config[:use_dhcp_assigned_default_route]
type: :dhcp,
use_dhcp_assigned_default_route: config[:use_dhcp_assigned_default_route]
}
end

def hostonly_config(options)
options = {
:auto_config => true,
:mac => nil,
:nic_type => nil,
:netmask => "255.255.255.0",
:type => :static
auto_config: true,
mac: nil,
nic_type: nil,
netmask: "255.255.255.0",
type: :static
}.merge(options)

# Make sure the type is a symbol
Expand Down Expand Up @@ -289,13 +289,13 @@ def hostonly_config(options)
end

return {
:adapter_ip => options[:adapter_ip],
:auto_config => options[:auto_config],
:ip => options[:ip],
:mac => options[:mac],
:netmask => options[:netmask],
:nic_type => options[:nic_type],
:type => options[:type]
adapter_ip: options[:adapter_ip],
auto_config: options[:auto_config],
ip: options[:ip],
mac: options[:mac],
netmask: options[:netmask],
nic_type: options[:nic_type],
type: options[:type]
}.merge(dhcp_options)
end

Expand All @@ -318,34 +318,34 @@ def hostonly_adapter(config)
end

return {
:adapter => config[:adapter],
:hostonly => interface[:name],
:mac_address => config[:mac],
:nic_type => config[:nic_type],
:type => :hostonly
adapter: config[:adapter],
hostonly: interface[:name],
mac_address: config[:mac],
nic_type: config[:nic_type],
type: :hostonly
}
end

def hostonly_network_config(config)
return {
:type => config[:type],
:adapter_ip => config[:adapter_ip],
:ip => config[:ip],
:netmask => config[:netmask]
type: config[:type],
adapter_ip: config[:adapter_ip],
ip: config[:ip],
netmask: config[:netmask]
}
end


def shared_config(options)
return {
:auto_config => false
auto_config: false
}
end

def shared_adapter(config)
return {
:adapter => config[:adapter],
:type => :shared
adapter: config[:adapter],
type: :shared
}
end

Expand Down Expand Up @@ -414,16 +414,16 @@ def next_network_id
# This creates a host only network for the given configuration.
def hostonly_create_network(config)
options = {
:network_id => next_network_id,
:adapter_ip => config[:adapter_ip],
:netmask => config[:netmask],
network_id: next_network_id,
adapter_ip: config[:adapter_ip],
netmask: config[:netmask],
}

if config[:type] == :dhcp
options[:dhcp] = {
:ip => config[:dhcp_ip],
:lower => config[:dhcp_lower],
:upper => config[:dhcp_upper]
ip: config[:dhcp_ip],
lower: config[:dhcp_lower],
upper: config[:dhcp_upper]
}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/vagrant-parallels/driver/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def raw(*command, &block)
end

# Append in the options for subprocess
command << { :notify => [:stdout, :stderr] }
command << {notify: [:stdout, :stderr]}

Vagrant::Util::Busy.busy(int_callback) do
Vagrant::Util::Subprocess.execute(*command, &block)
Expand Down
20 changes: 10 additions & 10 deletions lib/vagrant-parallels/driver/pd_8.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ def create_host_only_network(options)

# Return the details
return {
:name => iface_name,
:ip => options[:adapter_ip],
:netmask => options[:netmask],
:dhcp => options[:dhcp]
name: iface_name,
ip: options[:adapter_ip],
netmask: options[:netmask],
dhcp: options[:dhcp]
}
end

Expand Down Expand Up @@ -240,9 +240,9 @@ def read_guest_ip
def read_guest_tools_iso_path(guest_os)
guest_os = guest_os.to_sym
iso_name ={
:linux => "prl-tools-lin.iso",
:darwin => "prl-tools-mac.iso",
:windows => "prl-tools-win.iso"
linux: "prl-tools-lin.iso",
darwin: "prl-tools-mac.iso",
windows: "prl-tools-win.iso"
}
return nil if !iso_name[guest_os]

Expand Down Expand Up @@ -289,9 +289,9 @@ def read_host_only_interfaces
if network_address(info[:ip], info[:netmask]) ==
network_address(dhcp_ip, info[:netmask])
info[:dhcp] = {
:ip => dhcp_ip,
:lower => net_info['DHCPv4 server']['IP scope start address'],
:upper => net_info['DHCPv4 server']['IP scope end address']
ip: dhcp_ip,
lower: net_info['DHCPv4 server']['IP scope start address'],
upper: net_info['DHCPv4 server']['IP scope end address']
}
end
hostonly_ifaces << info
Expand Down
14 changes: 7 additions & 7 deletions test/unit/driver/pd_10_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
let(:hostonly_iface) {'vnic10'}

let(:vnic_options) do {
:name => 'vagrant_vnic6',
:adapter_ip => '11.11.11.11',
:netmask => '255.255.252.0',
:dhcp => {
:ip => '11.11.11.11',
:lower => '11.11.8.1',
:upper => '11.11.11.254'
name: 'vagrant_vnic6',
adapter_ip: '11.11.11.11',
netmask: '255.255.252.0',
dhcp: {
ip: '11.11.11.11',
lower: '11.11.8.1',
upper: '11.11.11.254'
}
} end

Expand Down
14 changes: 7 additions & 7 deletions test/unit/driver/pd_8_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
let(:hostonly_iface) {'vnic10'}

let(:vnic_options) do {
:name => 'vagrant_vnic6',
:adapter_ip => '11.11.11.11',
:netmask => '255.255.252.0',
:dhcp => {
:ip => '11.11.11.11',
:lower => '11.11.8.1',
:upper => '11.11.11.254'
name: 'vagrant_vnic6',
adapter_ip: '11.11.11.11',
netmask: '255.255.252.0',
dhcp: {
ip: '11.11.11.11',
lower: '11.11.8.1',
upper: '11.11.11.254'
}
} end

Expand Down
14 changes: 7 additions & 7 deletions test/unit/driver/pd_9_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
let(:hostonly_iface) {'vnic10'}

let(:vnic_options) do {
:name => 'vagrant_vnic6',
:adapter_ip => '11.11.11.11',
:netmask => '255.255.252.0',
:dhcp => {
:ip => '11.11.11.11',
:lower => '11.11.8.1',
:upper => '11.11.11.254'
name: 'vagrant_vnic6',
adapter_ip: '11.11.11.11',
netmask: '255.255.252.0',
dhcp: {
ip: '11.11.11.11',
lower: '11.11.8.1',
upper: '11.11.11.254'
}
} end

Expand Down
20 changes: 10 additions & 10 deletions test/unit/support/shared/pd_driver_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
let(:hostonly_iface) {'vnic12'}
it "creates host-only NIC with dhcp server configured" do
vnic_opts = {
:network_id => 'vagrant_vnic8',
:adapter_ip => '11.11.11.11',
:netmask => '255.255.252.0',
:dhcp => {
:ip => '11.11.11.11',
:lower => '11.11.8.1',
:upper => '11.11.11.254'
network_id: 'vagrant_vnic8',
adapter_ip: '11.11.11.11',
netmask: '255.255.252.0',
dhcp: {
ip: '11.11.11.11',
lower: '11.11.8.1',
upper: '11.11.11.254'
}
}

Expand Down Expand Up @@ -66,9 +66,9 @@

it "creates host-only NIC without dhcp" do
vnic_options = {
:network_id => 'vagrant_vnic3',
:adapter_ip => '22.22.22.22',
:netmask => '255.255.254.0',
network_id: 'vagrant_vnic3',
adapter_ip: '22.22.22.22',
netmask: '255.255.254.0',
}

subprocess.should_receive(:execute).
Expand Down

0 comments on commit 1f068b2

Please sign in to comment.