vagrant-parallels 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -8
  3. data/Rakefile +2 -2
  4. data/lib/vagrant-parallels.rb +7 -44
  5. data/lib/vagrant-parallels/action.rb +45 -45
  6. data/lib/vagrant-parallels/action/boot.rb +1 -2
  7. data/lib/vagrant-parallels/action/clear_network_interfaces.rb +1 -1
  8. data/lib/vagrant-parallels/action/customize.rb +1 -1
  9. data/lib/vagrant-parallels/action/destroy.rb +1 -1
  10. data/lib/vagrant-parallels/action/destroy_unused_network_interfaces.rb +2 -2
  11. data/lib/vagrant-parallels/action/forced_halt.rb +1 -1
  12. data/lib/vagrant-parallels/action/forward_ports.rb +2 -2
  13. data/lib/vagrant-parallels/action/handle_guest_tools.rb +9 -10
  14. data/lib/vagrant-parallels/action/import.rb +36 -24
  15. data/lib/vagrant-parallels/action/network.rb +37 -37
  16. data/lib/vagrant-parallels/action/package.rb +3 -3
  17. data/lib/vagrant-parallels/action/package_config_files.rb +3 -2
  18. data/lib/vagrant-parallels/action/prepare_nfs_settings.rb +2 -2
  19. data/lib/vagrant-parallels/action/resume.rb +1 -1
  20. data/lib/vagrant-parallels/action/sane_defaults.rb +0 -1
  21. data/lib/vagrant-parallels/action/set_name.rb +7 -7
  22. data/lib/vagrant-parallels/action/setup_package_files.rb +6 -6
  23. data/lib/vagrant-parallels/action/suspend.rb +1 -1
  24. data/lib/vagrant-parallels/config.rb +9 -11
  25. data/lib/vagrant-parallels/driver/meta.rb +1 -1
  26. data/lib/vagrant-parallels/driver/pd_10.rb +1 -1
  27. data/lib/vagrant-parallels/driver/pd_11.rb +1 -1
  28. data/lib/vagrant-parallels/driver/pd_8.rb +19 -19
  29. data/lib/vagrant-parallels/driver/pd_9.rb +1 -1
  30. data/lib/vagrant-parallels/errors.rb +2 -2
  31. data/lib/vagrant-parallels/guest_cap/linux/install_parallels_tools.rb +5 -5
  32. data/lib/vagrant-parallels/guest_cap/linux/mount_parallels_shared_folder.rb +3 -3
  33. data/lib/vagrant-parallels/model/forwarded_port.rb +1 -1
  34. data/lib/vagrant-parallels/plugin.rb +65 -30
  35. data/lib/vagrant-parallels/provider.rb +8 -8
  36. data/lib/vagrant-parallels/synced_folder.rb +6 -6
  37. data/lib/vagrant-parallels/util/compile_forwarded_ports.rb +1 -1
  38. data/lib/vagrant-parallels/version.rb +1 -1
  39. data/tasks/acceptance.rake +4 -4
  40. data/tasks/test.rake +1 -1
  41. data/test/acceptance/base.rb +2 -2
  42. data/test/acceptance/provider/linked_clone_spec.rb +2 -2
  43. data/test/acceptance/shared/context_parallels.rb +1 -1
  44. data/test/acceptance/skeletons/linked_clone/Vagrantfile +3 -3
  45. data/test/unit/base.rb +6 -6
  46. data/test/unit/config_test.rb +22 -22
  47. data/test/unit/driver/pd_10_test.rb +7 -7
  48. data/test/unit/driver/pd_8_test.rb +4 -4
  49. data/test/unit/driver/pd_9_test.rb +6 -6
  50. data/test/unit/support/shared/pd_driver_examples.rb +97 -97
  51. data/test/unit/synced_folder_test.rb +11 -11
  52. data/vagrant-parallels.gemspec +17 -19
  53. metadata +2 -32
  54. data/config/i18n-tasks.yml.erb +0 -18
  55. data/test/unit/locales/locales_test.rb +0 -14
@@ -1,9 +1,9 @@
1
- require "log4r"
2
- require "vagrant"
1
+ require 'log4r'
2
+ require 'vagrant'
3
3
 
4
4
  module VagrantPlugins
5
5
  module Parallels
6
- class Provider < Vagrant.plugin("2", :provider)
6
+ class Provider < Vagrant.plugin('2', :provider)
7
7
  attr_reader :driver
8
8
 
9
9
  def self.usable?(raise_error=false)
@@ -21,7 +21,7 @@ module VagrantPlugins
21
21
  end
22
22
 
23
23
  def initialize(machine)
24
- @logger = Log4r::Logger.new("vagrant::provider::parallels")
24
+ @logger = Log4r::Logger.new('vagrant::provider::parallels')
25
25
  @machine = machine
26
26
 
27
27
  # This method will load in our driver, so we call it now to
@@ -50,7 +50,7 @@ module VagrantPlugins
50
50
  rescue VagrantPlugins::Parallels::Driver::Meta::VMNotFound
51
51
  # The virtual machine doesn't exist, so we probably have a stale
52
52
  # ID. Just clear the id out of the machine and reload it.
53
- @logger.debug("VM not found! Clearing saved machine ID and reloading.")
53
+ @logger.debug('VM not found! Clearing saved machine ID and reloading.')
54
54
  id = nil
55
55
  retry
56
56
  end
@@ -68,7 +68,7 @@ module VagrantPlugins
68
68
  return nil if !detected_ip
69
69
 
70
70
  # Return ip from running machine, use ip from config if available
71
- return {
71
+ {
72
72
  host: detected_ip,
73
73
  port: @driver.ssh_port(@machine.config.ssh.guest_port)
74
74
  }
@@ -86,7 +86,7 @@ module VagrantPlugins
86
86
  state_id = :unknown if !state_id
87
87
 
88
88
  # Translate into short/long descriptions
89
- short = state_id.to_s.gsub("_", " ")
89
+ short = state_id.to_s.gsub('_', ' ')
90
90
  long = I18n.t("vagrant_parallels.commands.status.#{state_id}")
91
91
 
92
92
  # If machine is not created, then specify the special ID flag
@@ -113,7 +113,7 @@ module VagrantPlugins
113
113
  #
114
114
  # @return [String]
115
115
  def to_s
116
- id = @machine.id ? @machine.id : "new VM"
116
+ id = @machine.id ? @machine.id : 'new VM'
117
117
  "Parallels (#{id})"
118
118
  end
119
119
  end
@@ -1,8 +1,8 @@
1
- require "vagrant/util/platform"
1
+ require 'vagrant/util/platform'
2
2
 
3
3
  module VagrantPlugins
4
4
  module Parallels
5
- class SyncedFolder < Vagrant.plugin("2", :synced_folder)
5
+ class SyncedFolder < Vagrant.plugin('2', :synced_folder)
6
6
  def usable?(machine, raise_errors=false)
7
7
  # These synced folders only work if the provider is Parallels
8
8
  machine.provider_name == :parallels &&
@@ -48,7 +48,7 @@ module VagrantPlugins
48
48
  end
49
49
 
50
50
  # Go through each folder and mount
51
- machine.ui.output(I18n.t("vagrant.actions.vm.share_folders.mounting"))
51
+ machine.ui.output(I18n.t('vagrant.actions.vm.share_folders.mounting'))
52
52
  folders.each do |_ , data|
53
53
  # Parallels specific: get id from the VM setting
54
54
  # It allows to mount one host folder more then one time [GH-105]
@@ -56,7 +56,7 @@ module VagrantPlugins
56
56
 
57
57
  if data[:guestpath] and id
58
58
  # Guest path specified, so mount the folder to specified point
59
- machine.ui.detail(I18n.t("vagrant.actions.vm.share_folders.mounting_entry",
59
+ machine.ui.detail(I18n.t('vagrant.actions.vm.share_folders.mounting_entry',
60
60
  guestpath: data[:guestpath],
61
61
  hostpath: data[:hostpath]))
62
62
 
@@ -73,7 +73,7 @@ module VagrantPlugins
73
73
  :mount_parallels_shared_folder, id, data[:guestpath], data)
74
74
  else
75
75
  # If no guest path is specified, then automounting is disabled
76
- machine.ui.detail(I18n.t("vagrant.actions.vm.share_folders.nomount_entry",
76
+ machine.ui.detail(I18n.t('vagrant.actions.vm.share_folders.nomount_entry',
77
77
  :hostpath => data[:hostpath]))
78
78
  end
79
79
  end
@@ -94,7 +94,7 @@ module VagrantPlugins
94
94
  end
95
95
 
96
96
  def cleanup(machine, opts)
97
- driver(machine).clear_shared_folders if machine.id && machine.id != ""
97
+ driver(machine).clear_shared_folders if machine.id && machine.id != ''
98
98
  end
99
99
 
100
100
  protected
@@ -15,7 +15,7 @@ module VagrantPlugins
15
15
  if type == :forwarded_port
16
16
  guest_port = options[:guest]
17
17
  host_port = options[:host]
18
- protocol = options[:protocol] || "tcp"
18
+ protocol = options[:protocol] || 'tcp'
19
19
  options = scoped_hash_override(options, :parallels)
20
20
  id = options[:id]
21
21
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Parallels
3
- VERSION = '1.4.2'
3
+ VERSION = '1.4.3'
4
4
  end
5
5
  end
@@ -1,10 +1,10 @@
1
1
  namespace :acceptance do
2
- desc "shows components that can be tested separately"
2
+ desc 'shows components that can be tested separately'
3
3
  task :components do
4
- exec("vagrant-spec components")
4
+ exec('vagrant-spec components')
5
5
  end
6
6
 
7
- desc "runs acceptance tests using vagrant-spec"
7
+ desc 'runs acceptance tests using vagrant-spec'
8
8
  task :run do
9
9
  components = %w(
10
10
  basic
@@ -19,7 +19,7 @@ namespace :acceptance do
19
19
  package
20
20
  ).map{ |s| "provider/parallels/#{s}" }
21
21
 
22
- command = "vagrant-spec test --components=#{components.join(" ")}"
22
+ command = "vagrant-spec test --components=#{components.join(' ')}"
23
23
  puts command
24
24
  puts
25
25
  exec(command)
data/tasks/test.rake CHANGED
@@ -3,6 +3,6 @@ require 'rspec/core/rake_task'
3
3
 
4
4
  namespace :test do
5
5
  RSpec::Core::RakeTask.new(:unit) do |t|
6
- t.pattern = "test/unit/**/*_test.rb"
6
+ t.pattern = 'test/unit/**/*_test.rb'
7
7
  end
8
8
  end
@@ -1,2 +1,2 @@
1
- require "vagrant-spec/acceptance"
2
- require_relative "shared/context_parallels"
1
+ require 'vagrant-spec/acceptance'
2
+ require_relative 'shared/context_parallels'
@@ -18,8 +18,8 @@ shared_examples 'provider/linked_clone' do |provider, options|
18
18
  end
19
19
 
20
20
  it 'creates machine as linked clone' do
21
- status("Test: machine is running after up")
22
- result = execute("vagrant", "ssh", "-c", "echo foo")
21
+ status('Test: machine is running after up')
22
+ result = execute('vagrant', 'ssh', '-c', 'echo foo')
23
23
  expect(result).to exit_with(0)
24
24
  expect(result.stdout).to match(/foo\n$/)
25
25
  end
@@ -1,2 +1,2 @@
1
- shared_context "provider-context/parallels" do
1
+ shared_context 'provider-context/parallels' do
2
2
  end
@@ -1,7 +1,7 @@
1
- Vagrant.configure("2") do |config|
2
- config.vm.box = "basic"
1
+ Vagrant.configure('2') do |config|
2
+ config.vm.box = 'basic'
3
3
 
4
- config.vm.provider "parallels" do |prl|
4
+ config.vm.provider 'parallels' do |prl|
5
5
  prl.use_linked_clone = true
6
6
  end
7
7
  end
data/test/unit/base.rb CHANGED
@@ -1,17 +1,17 @@
1
- require "rubygems"
2
- require "rspec/autorun"
1
+ require 'rubygems'
2
+ require 'rspec/autorun'
3
3
 
4
4
  # Require Vagrant itself so we can reference the proper
5
5
  # classes to test.
6
- require "vagrant"
6
+ require 'vagrant'
7
7
  require 'vagrant-parallels'
8
8
 
9
9
  # Add the test directory to the load path
10
- $:.unshift File.expand_path("../../", __FILE__)
10
+ $:.unshift File.expand_path('../../', __FILE__)
11
11
 
12
12
  # Load in helpers
13
- require "unit/support/shared/parallels_context"
14
- require "unit/support/shared/pd_driver_examples"
13
+ require 'unit/support/shared/parallels_context'
14
+ require 'unit/support/shared/pd_driver_examples'
15
15
 
16
16
  # Do not buffer output
17
17
  $stdout.sync = true
@@ -1,9 +1,9 @@
1
- require_relative "base"
1
+ require_relative 'base'
2
2
 
3
3
  require VagrantPlugins::Parallels.source_root.join('lib/vagrant-parallels/config')
4
4
 
5
5
  describe VagrantPlugins::Parallels::Config do
6
- let(:machine) { double("machine") }
6
+ let(:machine) { double('machine') }
7
7
 
8
8
  def assert_invalid
9
9
  errors = subject.validate(machine)
@@ -20,23 +20,23 @@ describe VagrantPlugins::Parallels::Config do
20
20
  end
21
21
 
22
22
  def valid_defaults
23
- subject.image = "foo"
23
+ subject.image = 'foo'
24
24
  end
25
25
 
26
26
  before do
27
- vm_config = double("vm_config")
27
+ vm_config = double('vm_config')
28
28
  vm_config.stub(networks: [])
29
- config = double("config")
29
+ config = double('config')
30
30
  config.stub(vm: vm_config)
31
31
  machine.stub(config: config)
32
32
  end
33
33
 
34
- its "valid by default" do
34
+ its 'valid by default' do
35
35
  subject.finalize!
36
36
  assert_valid
37
37
  end
38
38
 
39
- context "defaults" do
39
+ context 'defaults' do
40
40
  before { subject.finalize! }
41
41
 
42
42
  it { expect(subject.check_guest_additions).to be_true }
@@ -44,45 +44,45 @@ describe VagrantPlugins::Parallels::Config do
44
44
  it { expect(subject.functional_psf).to be_true }
45
45
  it { expect(subject.optimize_power_consumption).to be_true }
46
46
 
47
- it "should have one Shared adapter" do
47
+ it 'should have one Shared adapter' do
48
48
  expect(subject.network_adapters).to eql({
49
49
  0 => [:shared, {}],
50
50
  })
51
51
  end
52
52
  end
53
53
 
54
- describe "#merge" do
54
+ describe '#merge' do
55
55
  let(:one) { described_class.new }
56
56
  let(:two) { described_class.new }
57
57
 
58
58
  subject { one.merge(two) }
59
59
 
60
- it "merges the customizations" do
61
- one.customize ["foo"]
62
- two.customize ["bar"]
60
+ it 'merges the customizations' do
61
+ one.customize ['foo']
62
+ two.customize ['bar']
63
63
 
64
64
  expect(subject.customizations).to eq([
65
- ["pre-boot", ["foo"]],
66
- ["pre-boot", ["bar"]]])
65
+ ['pre-boot', ['foo']],
66
+ ['pre-boot', ['bar']]])
67
67
  end
68
68
  end
69
69
 
70
- describe "memory=" do
71
- it "configures memory size (in Mb)" do
70
+ describe 'memory=' do
71
+ it 'configures memory size (in Mb)' do
72
72
  subject.memory=(1024)
73
- expect(subject.customizations).to include(["pre-boot", ["set", :id, "--memsize", '1024']])
73
+ expect(subject.customizations).to include(['pre-boot', ['set', :id, '--memsize', '1024']])
74
74
  end
75
75
  end
76
76
 
77
- describe "cpus=" do
78
- it "configures count of cpus" do
77
+ describe 'cpus=' do
78
+ it 'configures count of cpus' do
79
79
  subject.cpus=('4')
80
- expect(subject.customizations).to include(["pre-boot", ["set", :id, "--cpus", 4]])
80
+ expect(subject.customizations).to include(['pre-boot', ['set', :id, '--cpus', 4]])
81
81
  end
82
82
  end
83
83
 
84
- describe "#network_adapter" do
85
- it "configures additional adapters" do
84
+ describe '#network_adapter' do
85
+ it 'configures additional adapters' do
86
86
  subject.network_adapter(2, :bridged, auto_config: true)
87
87
  expect(subject.network_adapters[2]).to eql(
88
88
  [:bridged, auto_config: true])
@@ -1,17 +1,17 @@
1
- require_relative "../base"
1
+ require_relative '../base'
2
2
 
3
3
  describe VagrantPlugins::Parallels::Driver::PD_10 do
4
- include_context "parallels"
5
- let(:parallels_version) { "10" }
4
+ include_context 'parallels'
5
+ let(:parallels_version) { '10' }
6
6
 
7
7
  subject { VagrantPlugins::Parallels::Driver::Meta.new(uuid) }
8
8
 
9
- it_behaves_like "parallels desktop driver"
9
+ it_behaves_like 'parallels desktop driver'
10
10
 
11
- describe "set_power_consumption_mode" do
11
+ describe 'set_power_consumption_mode' do
12
12
  it "turns 'longer-battery-life' on" do
13
13
  subprocess.should_receive(:execute).
14
- with("prlctl", "set", uuid, "--longer-battery-life", "on",
14
+ with('prlctl', 'set', uuid, '--longer-battery-life', 'on',
15
15
  an_instance_of(Hash)).
16
16
  and_return(subprocess_result(exit_code: 0))
17
17
 
@@ -20,7 +20,7 @@ describe VagrantPlugins::Parallels::Driver::PD_10 do
20
20
 
21
21
  it "turns 'longer-battery-life' off" do
22
22
  subprocess.should_receive(:execute).
23
- with("prlctl", "set", uuid, "--longer-battery-life", "off",
23
+ with('prlctl', 'set', uuid, '--longer-battery-life', 'off',
24
24
  an_instance_of(Hash)).
25
25
  and_return(subprocess_result(exit_code: 0))
26
26
 
@@ -1,10 +1,10 @@
1
- require_relative "../base"
1
+ require_relative '../base'
2
2
 
3
3
  describe VagrantPlugins::Parallels::Driver::PD_8 do
4
- include_context "parallels"
5
- let(:parallels_version) { "8" }
4
+ include_context 'parallels'
5
+ let(:parallels_version) { '8' }
6
6
 
7
7
  subject { VagrantPlugins::Parallels::Driver::Meta.new(uuid) }
8
8
 
9
- it_behaves_like "parallels desktop driver"
9
+ it_behaves_like 'parallels desktop driver'
10
10
  end
@@ -1,16 +1,16 @@
1
- require_relative "../base"
1
+ require_relative '../base'
2
2
 
3
3
  describe VagrantPlugins::Parallels::Driver::PD_9 do
4
- include_context "parallels"
4
+ include_context 'parallels'
5
5
 
6
6
  subject { VagrantPlugins::Parallels::Driver::Meta.new(uuid) }
7
7
 
8
- it_behaves_like "parallels desktop driver"
8
+ it_behaves_like 'parallels desktop driver'
9
9
 
10
- describe "set_power_consumption_mode" do
10
+ describe 'set_power_consumption_mode' do
11
11
  it "turns 'longer-battery-life' on" do
12
12
  subprocess.should_receive(:execute).
13
- with("prlctl", "set", uuid, "--longer-battery-life", "on",
13
+ with('prlctl', 'set', uuid, '--longer-battery-life', 'on',
14
14
  an_instance_of(Hash)).
15
15
  and_return(subprocess_result(exit_code: 0))
16
16
 
@@ -19,7 +19,7 @@ describe VagrantPlugins::Parallels::Driver::PD_9 do
19
19
 
20
20
  it "turns 'longer-battery-life' off" do
21
21
  subprocess.should_receive(:execute).
22
- with("prlctl", "set", uuid, "--longer-battery-life", "off",
22
+ with('prlctl', 'set', uuid, '--longer-battery-life', 'off',
23
23
  an_instance_of(Hash)).
24
24
  and_return(subprocess_result(exit_code: 0))
25
25
 
@@ -1,35 +1,35 @@
1
- shared_examples "parallels desktop driver" do |options|
1
+ shared_examples 'parallels desktop driver' do |options|
2
2
  before do
3
- raise ArgumentError, "Need parallels context to use these shared examples." unless defined? parallels_context
3
+ raise ArgumentError, 'Need parallels context to use these shared examples.' unless defined? parallels_context
4
4
  end
5
5
 
6
- describe "compact" do
7
- settings = {"Hardware" => {"hdd0" => {"image" => "/path/to/disk0.hdd"},
8
- "hdd1" => {"image" => "/path/to/disk1.hdd"}}}
9
- it "compacts the VM disk drives" do
6
+ describe 'compact' do
7
+ settings = {'Hardware' => {'hdd0' => {'image' => '/path/to/disk0.hdd'},
8
+ 'hdd1' => {'image' => '/path/to/disk1.hdd'}}}
9
+ it 'compacts the VM disk drives' do
10
10
  driver.should_receive(:read_settings).and_return(settings)
11
11
 
12
12
  subprocess.should_receive(:execute).exactly(2).times.
13
- with("prl_disk_tool", 'compact', '--hdd', /^\/path\/to\/disk(0|1).hdd$/,
13
+ with('prl_disk_tool', 'compact', '--hdd', /^\/path\/to\/disk(0|1).hdd$/,
14
14
  an_instance_of(Hash)).
15
15
  and_return(subprocess_result(exit_code: 0))
16
16
  subject.compact(uuid)
17
17
  end
18
18
  end
19
19
 
20
- describe "clear_shared_folders" do
21
- it "deletes every shared folder assigned to the VM" do
20
+ describe 'clear_shared_folders' do
21
+ it 'deletes every shared folder assigned to the VM' do
22
22
  subprocess.should_receive(:execute).at_least(2).times.
23
- with("prlctl", "set", uuid, "--shf-host-del", an_instance_of(String),
23
+ with('prlctl', 'set', uuid, '--shf-host-del', an_instance_of(String),
24
24
  an_instance_of(Hash)).
25
25
  and_return(subprocess_result(exit_code: 0))
26
26
  subject.clear_shared_folders
27
27
  end
28
28
  end
29
29
 
30
- describe "create_host_only_network" do
30
+ describe 'create_host_only_network' do
31
31
  let(:hostonly_iface) {'vnic12'}
32
- it "creates host-only NIC with dhcp server configured" do
32
+ it 'creates host-only NIC with dhcp server configured' do
33
33
  vnic_opts = {
34
34
  network_id: 'vagrant_vnic8',
35
35
  adapter_ip: '11.11.11.11',
@@ -42,16 +42,16 @@ shared_examples "parallels desktop driver" do |options|
42
42
  }
43
43
 
44
44
  subprocess.should_receive(:execute).
45
- with("prlsrvctl", "net", "add", vnic_opts[:network_id],
46
- "--type", "host-only", an_instance_of(Hash)).
45
+ with('prlsrvctl', 'net', 'add', vnic_opts[:network_id],
46
+ '--type', 'host-only', an_instance_of(Hash)).
47
47
  and_return(subprocess_result(exit_code: 0))
48
48
 
49
49
  subprocess.should_receive(:execute).
50
- with("prlsrvctl", "net", "set", vnic_opts[:network_id],
51
- "--ip", "#{vnic_opts[:adapter_ip]}/#{vnic_opts[:netmask]}",
52
- "--dhcp-ip", vnic_opts[:dhcp][:ip],
53
- "--ip-scope-start", vnic_opts[:dhcp][:lower],
54
- "--ip-scope-end", vnic_opts[:dhcp][:upper], an_instance_of(Hash)).
50
+ with('prlsrvctl', 'net', 'set', vnic_opts[:network_id],
51
+ '--ip', "#{vnic_opts[:adapter_ip]}/#{vnic_opts[:netmask]}",
52
+ '--dhcp-ip', vnic_opts[:dhcp][:ip],
53
+ '--ip-scope-start', vnic_opts[:dhcp][:lower],
54
+ '--ip-scope-end', vnic_opts[:dhcp][:upper], an_instance_of(Hash)).
55
55
  and_return(subprocess_result(exit_code: 0))
56
56
 
57
57
  interface = subject.create_host_only_network(vnic_opts)
@@ -64,7 +64,7 @@ shared_examples "parallels desktop driver" do |options|
64
64
  # interface[:name].should =~ /^(vnic(\d+))$/
65
65
  end
66
66
 
67
- it "creates host-only NIC without dhcp" do
67
+ it 'creates host-only NIC without dhcp' do
68
68
  vnic_options = {
69
69
  network_id: 'vagrant_vnic3',
70
70
  adapter_ip: '22.22.22.22',
@@ -72,13 +72,13 @@ shared_examples "parallels desktop driver" do |options|
72
72
  }
73
73
 
74
74
  subprocess.should_receive(:execute).
75
- with("prlsrvctl", "net", "add", vnic_options[:network_id],
76
- "--type", "host-only", an_instance_of(Hash)).
75
+ with('prlsrvctl', 'net', 'add', vnic_options[:network_id],
76
+ '--type', 'host-only', an_instance_of(Hash)).
77
77
  and_return(subprocess_result(exit_code: 0))
78
78
 
79
79
  subprocess.should_receive(:execute).
80
- with("prlsrvctl", "net", "set", vnic_options[:network_id],
81
- "--ip", "#{vnic_options[:adapter_ip]}/#{vnic_options[:netmask]}",
80
+ with('prlsrvctl', 'net', 'set', vnic_options[:network_id],
81
+ '--ip', "#{vnic_options[:adapter_ip]}/#{vnic_options[:netmask]}",
82
82
  an_instance_of(Hash)).
83
83
  and_return(subprocess_result(exit_code: 0))
84
84
 
@@ -93,69 +93,69 @@ shared_examples "parallels desktop driver" do |options|
93
93
  end
94
94
  end
95
95
 
96
- describe "delete" do
97
- it "deletes the VM" do
96
+ describe 'delete' do
97
+ it 'deletes the VM' do
98
98
  subprocess.should_receive(:execute).
99
- with("prlctl", "delete", uuid, an_instance_of(Hash)).
99
+ with('prlctl', 'delete', uuid, an_instance_of(Hash)).
100
100
  and_return(subprocess_result(exit_code: 0))
101
101
  subject.delete
102
102
  end
103
103
  end
104
104
 
105
- describe "delete_disabled_adapters" do
106
- it "deletes disabled networks adapters from VM config" do
107
- settings = {"Hardware" => {"net0" => {"enabled" => false},
108
- "net1" => {"enabled" => false}}}
105
+ describe 'delete_disabled_adapters' do
106
+ it 'deletes disabled networks adapters from VM config' do
107
+ settings = {'Hardware' => {'net0' => {'enabled' => false},
108
+ 'net1' => {'enabled' => false}}}
109
109
  driver.should_receive(:read_settings).and_return(settings)
110
110
  subprocess.should_receive(:execute).exactly(2).times.
111
- with("prlctl", "set", uuid, "--device-del", /^net(0|1)$/,
111
+ with('prlctl', 'set', uuid, '--device-del', /^net(0|1)$/,
112
112
  an_instance_of(Hash)).
113
113
  and_return(subprocess_result(exit_code: 0))
114
114
  subject.delete_disabled_adapters
115
115
  end
116
116
  end
117
117
 
118
- describe "clone_vm" do
119
- it "clones VM to the new one" do
118
+ describe 'clone_vm' do
119
+ it 'clones VM to the new one' do
120
120
  subprocess.should_receive(:execute).
121
- with("prlctl", "clone", tpl_uuid, "--name", vm_name,
121
+ with('prlctl', 'clone', tpl_uuid, '--name', vm_name,
122
122
  an_instance_of(Hash)).
123
123
  and_return(subprocess_result(exit_code: 0))
124
124
  subject.clone_vm(tpl_uuid, vm_name).should == uuid
125
125
  end
126
126
 
127
- it "clones VM to template" do
127
+ it 'clones VM to template' do
128
128
  subprocess.should_receive(:execute).
129
- with("prlctl", "clone", uuid, "--name", tpl_name,
130
- "--template", "--dst", an_instance_of(String),
129
+ with('prlctl', 'clone', uuid, '--name', tpl_name,
130
+ '--template', '--dst', an_instance_of(String),
131
131
  an_instance_of(Hash)).
132
132
  and_return(subprocess_result(exit_code: 0))
133
133
  subject.clone_vm(uuid, tpl_name,
134
- {dst: "/path/to/template", template: true}).
134
+ {dst: '/path/to/template', template: true}).
135
135
  should == tpl_uuid
136
136
  end
137
137
  end
138
138
 
139
- describe "halt" do
140
- it "stops the VM" do
139
+ describe 'halt' do
140
+ it 'stops the VM' do
141
141
  subprocess.should_receive(:execute).
142
- with("prlctl", "stop", uuid, an_instance_of(Hash)).
142
+ with('prlctl', 'stop', uuid, an_instance_of(Hash)).
143
143
  and_return(subprocess_result(exit_code: 0))
144
144
  subject.halt
145
145
  end
146
146
 
147
- it "stops the VM force" do
147
+ it 'stops the VM force' do
148
148
  subprocess.should_receive(:execute).
149
- with("prlctl", "stop", uuid, "--kill", an_instance_of(Hash)).
149
+ with('prlctl', 'stop', uuid, '--kill', an_instance_of(Hash)).
150
150
  and_return(subprocess_result(exit_code: 0))
151
151
  subject.halt(force=true)
152
152
  end
153
153
  end
154
154
 
155
- describe "read_guest_tools_state" do
155
+ describe 'read_guest_tools_state' do
156
156
  let(:tools_state) {'outdated'}
157
157
 
158
- it "returns Guest Tools state as a symbol" do
158
+ it 'returns Guest Tools state as a symbol' do
159
159
  subject.read_guest_tools_state.should be(:outdated)
160
160
  end
161
161
 
@@ -165,46 +165,46 @@ shared_examples "parallels desktop driver" do |options|
165
165
  end
166
166
  end
167
167
 
168
- describe "read_guest_tools_iso_path" do
168
+ describe 'read_guest_tools_iso_path' do
169
169
  before do
170
170
  subprocess.stub(:execute).
171
- with("mdfind", /^kMDItemCFBundleIdentifier ==/, an_instance_of(Hash)).
172
- and_return(subprocess_result(stdout: "/Applications/Parallels Desktop.app"))
171
+ with('mdfind', /^kMDItemCFBundleIdentifier ==/, an_instance_of(Hash)).
172
+ and_return(subprocess_result(stdout: '/Applications/Parallels Desktop.app'))
173
173
  end
174
174
 
175
- it "returns a valid path to the ISO" do
175
+ it 'returns a valid path to the ISO' do
176
176
  File.stub(:exist?).and_return(true)
177
- iso_path = subject.read_guest_tools_iso_path("linux")
177
+ iso_path = subject.read_guest_tools_iso_path('linux')
178
178
  iso_path.should be_kind_of(String)
179
179
  iso_path.should match(/prl-tools-lin\.iso$/)
180
180
  end
181
181
 
182
- it "raises an exception if ISO file does not exists" do
182
+ it 'raises an exception if ISO file does not exists' do
183
183
  File.stub(:exist?).and_return(false)
184
- expect { subject.read_guest_tools_iso_path("windows") }.
184
+ expect { subject.read_guest_tools_iso_path('windows') }.
185
185
  to raise_error(VagrantPlugins::Parallels::Errors::ParallelsToolsIsoNotFound)
186
186
  end
187
187
 
188
- it "returns nil if guest OS is unsupported or invalid" do
189
- subject.read_guest_tools_iso_path("").should be_nil
190
- subject.read_guest_tools_iso_path("bolgenos").should be_nil
188
+ it 'returns nil if guest OS is unsupported or invalid' do
189
+ subject.read_guest_tools_iso_path('').should be_nil
190
+ subject.read_guest_tools_iso_path('bolgenos').should be_nil
191
191
  end
192
192
  end
193
193
 
194
- describe "read_mac_addresses" do
195
- it "returns MAC addresses of all network interface cards" do
194
+ describe 'read_mac_addresses' do
195
+ it 'returns MAC addresses of all network interface cards' do
196
196
  subject.read_mac_addresses.should be_kind_of(Array)
197
197
  subject.read_mac_addresses.should include('001C42B4B074')
198
198
  subject.read_mac_addresses.should include('001C42B4B090')
199
199
  end
200
200
  end
201
201
 
202
- describe "read_settings" do
203
- it "returns a hash with detailed info about the VM" do
202
+ describe 'read_settings' do
203
+ it 'returns a hash with detailed info about the VM' do
204
204
  subject.read_settings.should be_kind_of(Hash)
205
- subject.read_settings.should include("ID" => uuid)
206
- subject.read_settings.should include("Hardware")
207
- subject.read_settings.should include("GuestTools")
205
+ subject.read_settings.should include('ID' => uuid)
206
+ subject.read_settings.should include('Hardware')
207
+ subject.read_settings.should include('GuestTools')
208
208
  end
209
209
  end
210
210
 
@@ -229,16 +229,16 @@ shared_examples "parallels desktop driver" do |options|
229
229
  end
230
230
  end
231
231
 
232
- describe "read_vms" do
233
- it "returns the list of all registered VMs and templates" do
232
+ describe 'read_vms' do
233
+ it 'returns the list of all registered VMs and templates' do
234
234
  subject.read_vms.should be_kind_of(Hash)
235
235
  subject.read_vms.should have_at_least(2).items
236
236
  subject.read_vms.should include(vm_name => uuid)
237
237
  end
238
238
  end
239
239
 
240
- describe "read_vms_info" do
241
- it "returns detailed info about all registered VMs and templates" do
240
+ describe 'read_vms_info' do
241
+ it 'returns detailed info about all registered VMs and templates' do
242
242
  subject.read_vms_info.should be_kind_of(Array)
243
243
  subject.read_vms_info.should have_at_least(2).items
244
244
 
@@ -248,20 +248,20 @@ shared_examples "parallels desktop driver" do |options|
248
248
  end
249
249
  end
250
250
 
251
- describe "register" do
252
- it "registers specified virtual machine or template" do
251
+ describe 'register' do
252
+ it 'registers specified virtual machine or template' do
253
253
  subprocess.should_receive(:execute).
254
- with("prlctl", "register", an_instance_of(String), an_instance_of(Hash)).
254
+ with('prlctl', 'register', an_instance_of(String), an_instance_of(Hash)).
255
255
  and_return(subprocess_result(exit_code: 0))
256
256
 
257
- subject.register("/path/to/vm_image.pvm")
257
+ subject.register('/path/to/vm_image.pvm')
258
258
  end
259
259
  end
260
260
 
261
- describe "set_name" do
262
- it "sets new name for the VM" do
261
+ describe 'set_name' do
262
+ it 'sets new name for the VM' do
263
263
  subprocess.should_receive(:execute).
264
- with("prlctl", "set", uuid, '--name', an_instance_of(String),
264
+ with('prlctl', 'set', uuid, '--name', an_instance_of(String),
265
265
  an_instance_of(Hash)).
266
266
  and_return(subprocess_result(exit_code: 0))
267
267
 
@@ -269,19 +269,19 @@ shared_examples "parallels desktop driver" do |options|
269
269
  end
270
270
  end
271
271
 
272
- describe "ssh_ip" do
272
+ describe 'ssh_ip' do
273
273
  let(:content) {'10.200.0.100="1394546410,1800,001c420000ff,01001c420000ff
274
274
  10.200.0.99="1394547632,1800,001c420000ff,01001c420000ff"'}
275
275
 
276
- it "returns an IP address assigned to the specified MAC" do
277
- driver.should_receive(:read_mac_address).and_return("001C420000FF")
276
+ it 'returns an IP address assigned to the specified MAC' do
277
+ driver.should_receive(:read_mac_address).and_return('001C420000FF')
278
278
  File.should_receive(:open).with(an_instance_of(String)).
279
279
  and_return(StringIO.new(content))
280
280
 
281
- subject.ssh_ip.should == "10.200.0.99"
281
+ subject.ssh_ip.should == '10.200.0.99'
282
282
  end
283
283
 
284
- it "rises DhcpLeasesNotAccessible exception when file is not accessible" do
284
+ it 'rises DhcpLeasesNotAccessible exception when file is not accessible' do
285
285
  File.stub(:open).and_call_original
286
286
  File.should_receive(:open).with(an_instance_of(String)).
287
287
  and_raise(Errno::EACCES)
@@ -290,51 +290,51 @@ shared_examples "parallels desktop driver" do |options|
290
290
  end
291
291
  end
292
292
 
293
- describe "start" do
294
- it "starts the VM" do
293
+ describe 'start' do
294
+ it 'starts the VM' do
295
295
  subprocess.should_receive(:execute).
296
- with("prlctl", "start", uuid, an_instance_of(Hash)).
296
+ with('prlctl', 'start', uuid, an_instance_of(Hash)).
297
297
  and_return(subprocess_result(exit_code: 0))
298
298
  subject.start
299
299
  end
300
300
  end
301
301
 
302
- describe "suspend" do
303
- it "suspends the VM" do
302
+ describe 'suspend' do
303
+ it 'suspends the VM' do
304
304
  subprocess.should_receive(:execute).
305
- with("prlctl", "suspend", uuid, an_instance_of(Hash)).
305
+ with('prlctl', 'suspend', uuid, an_instance_of(Hash)).
306
306
  and_return(subprocess_result(exit_code: 0))
307
307
  subject.suspend
308
308
  end
309
309
  end
310
310
 
311
- describe "unregister" do
312
- it "suspends the VM" do
311
+ describe 'unregister' do
312
+ it 'suspends the VM' do
313
313
  subprocess.should_receive(:execute).
314
- with("prlctl", "unregister", an_instance_of(String),
314
+ with('prlctl', 'unregister', an_instance_of(String),
315
315
  an_instance_of(Hash)).
316
316
  and_return(subprocess_result(exit_code: 0))
317
- subject.unregister("template_or_vm_uuid")
317
+ subject.unregister('template_or_vm_uuid')
318
318
  end
319
319
  end
320
320
 
321
- describe "version" do
322
- it "parses the version from output" do
321
+ describe 'version' do
322
+ it 'parses the version from output' do
323
323
  subject.version.should match(/^#{parallels_version}.\d+\.\d+$/)
324
324
  end
325
325
 
326
- it "raises an exception for unsupported version" do
326
+ it 'raises an exception for unsupported version' do
327
327
  subprocess.should_receive(:execute).
328
- with("prlctl", "--version", an_instance_of(Hash)).
329
- and_return(subprocess_result(stdout: "prlctl version 7.0.12345"))
328
+ with('prlctl', '--version', an_instance_of(Hash)).
329
+ and_return(subprocess_result(stdout: 'prlctl version 7.0.12345'))
330
330
  expect { subject.version }.
331
331
  to raise_error(VagrantPlugins::Parallels::Errors::ParallelsUnsupportedVersion)
332
332
  end
333
333
 
334
- it "raises an exception for invalid version output" do
334
+ it 'raises an exception for invalid version output' do
335
335
  subprocess.should_receive(:execute).
336
- with("prlctl", "--version", an_instance_of(Hash)).
337
- and_return(subprocess_result(stdout: "prlctl version 1.2.foo.bar"))
336
+ with('prlctl', '--version', an_instance_of(Hash)).
337
+ and_return(subprocess_result(stdout: 'prlctl version 1.2.foo.bar'))
338
338
  expect { subject.version }.
339
339
  to raise_error(VagrantPlugins::Parallels::Errors::ParallelsInvalidVersion)
340
340
  end