vagrant-vsphere 0.19.0 → 0.19.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,14 +6,14 @@ describe VagrantPlugins::VSphere::Action::ConnectVSphere do
6
6
  end
7
7
 
8
8
  it 'should connect to vSphere' do
9
- expect(VIM).to have_received(:connect).with({
10
- :host => @env[:machine].provider_config.host,
11
- :user => @env[:machine].provider_config.user,
12
- :password => @env[:machine].provider_config.password,
13
- :insecure => @env[:machine].provider_config.insecure,
14
- :proxyHost => @env[:machine].provider_config.proxy_host,
15
- :proxyPort => @env[:machine].provider_config.proxy_port,
16
- })
9
+ expect(VIM).to have_received(:connect).with(
10
+ host: @env[:machine].provider_config.host,
11
+ user: @env[:machine].provider_config.user,
12
+ password: @env[:machine].provider_config.password,
13
+ insecure: @env[:machine].provider_config.insecure,
14
+ proxyHost: @env[:machine].provider_config.proxy_host,
15
+ proxyPort: @env[:machine].provider_config.proxy_port
16
+ )
17
17
  end
18
18
 
19
19
  it 'should add the vSphere connection to the environment' do
@@ -8,7 +8,7 @@ describe VagrantPlugins::VSphere::Action::GetSshInfo do
8
8
  it 'should set the ssh info to nil if machine ID is not set' do
9
9
  call
10
10
 
11
- expect(@env.has_key?(:machine_ssh_info)).to be true
11
+ expect(@env.key?(:machine_ssh_info)).to be true
12
12
  expect(@env[:machine_ssh_info]).to be nil
13
13
  end
14
14
 
@@ -17,7 +17,7 @@ describe VagrantPlugins::VSphere::Action::GetSshInfo do
17
17
 
18
18
  call
19
19
 
20
- expect(@env.has_key?(:machine_ssh_info)).to be true
20
+ expect(@env.key?(:machine_ssh_info)).to be true
21
21
  expect(@env[:machine_ssh_info]).to be nil
22
22
  end
23
23
 
data/spec/spec_helper.rb CHANGED
@@ -23,7 +23,6 @@ NAME = 'vm'
23
23
  IP_ADDRESS = '127.0.0.1'
24
24
 
25
25
  RSpec.configure do |config|
26
-
27
26
  # removes deprecation warnings.
28
27
  # http://stackoverflow.com/questions/20275510/how-to-avoid-deprecation-warning-for-stub-chain-in-rspec-3-0/20296359#20296359
29
28
  config.mock_with :rspec do |c|
@@ -36,111 +35,108 @@ RSpec.configure do |config|
36
35
  end
37
36
 
38
37
  provider_config = double(
39
- :host => 'testhost.com',
40
- :user => 'testuser',
41
- :password => 'testpassword',
42
- :data_center_name => nil,
43
- :compute_resource_name => 'testcomputeresource',
44
- :resource_pool_name => 'testresourcepool',
45
- :vm_base_path => nil,
46
- :template_name => TEMPLATE,
47
- :name => NAME,
48
- :insecure => true,
49
- :validate => [],
50
- :customization_spec_name => nil,
51
- :data_store_name => nil,
52
- :clone_from_vm => nil,
53
- :linked_clone => nil,
54
- :proxy_host => nil,
55
- :proxy_port => nil,
56
- :vlan => nil,
57
- :memory_mb => nil,
58
- :cpu_count => nil,
59
- :mac => nil)
38
+ host: 'testhost.com',
39
+ user: 'testuser',
40
+ password: 'testpassword',
41
+ data_center_name: nil,
42
+ compute_resource_name: 'testcomputeresource',
43
+ resource_pool_name: 'testresourcepool',
44
+ vm_base_path: nil,
45
+ template_name: TEMPLATE,
46
+ name: NAME,
47
+ insecure: true,
48
+ validate: [],
49
+ customization_spec_name: nil,
50
+ data_store_name: nil,
51
+ clone_from_vm: nil,
52
+ linked_clone: nil,
53
+ proxy_host: nil,
54
+ proxy_port: nil,
55
+ vlan: nil,
56
+ memory_mb: nil,
57
+ cpu_count: nil,
58
+ mac: nil)
60
59
  vm_config = double(
61
- :vm => double('config_vm',
62
- :box => nil,
63
- :synced_folders => [],
64
- :provisioners => [],
65
- :hostname => nil,
66
- :communicator => nil,
67
- :networks => [[:private_network, {:ip => '0.0.0.0'}]],
68
- :graceful_halt_timeout => 0.1),
69
- :validate => []
60
+ vm: double('config_vm',
61
+ box: nil,
62
+ synced_folders: [],
63
+ provisioners: [],
64
+ hostname: nil,
65
+ communicator: nil,
66
+ networks: [[:private_network, { ip: '0.0.0.0' }]],
67
+ graceful_halt_timeout: 0.1),
68
+ validate: []
70
69
  )
71
- @app = double 'app', :call => true
70
+ @app = double 'app', call: true
72
71
  @machine = double 'machine',
73
72
  :provider_config => provider_config,
74
73
  :config => vm_config,
75
- :state => double('state', :id => nil),
74
+ :state => double('state', id: nil),
76
75
  :communicate => double('communicator', :ready? => true),
77
76
  :ssh_info => {},
78
77
  :data_dir => Pathname.new(''),
79
78
  :id => nil,
80
79
  :id= => nil,
81
- :guest => double('guest', :capability => nil)
82
-
80
+ :guest => double('guest', capability: nil)
83
81
 
84
82
  @env = {
85
- :machine => @machine,
86
- :ui => double('ui', :info => nil, :output => nil)
83
+ machine: @machine,
84
+ ui: double('ui', info: nil, output: nil)
87
85
  }
88
86
 
89
87
  @vm = double('vm',
90
- :runtime => double('runtime', :powerState => nil),
91
- :guest => double('guest', :ipAddress => IP_ADDRESS),
92
- :Destroy_Task => double('result', :wait_for_completion => nil),
93
- :PowerOffVM_Task => double('result', :wait_for_completion => nil),
94
- :PowerOnVM_Task => double('result', :wait_for_completion => nil))
88
+ runtime: double('runtime', powerState: nil),
89
+ guest: double('guest', ipAddress: IP_ADDRESS),
90
+ Destroy_Task: double('result', wait_for_completion: nil),
91
+ PowerOffVM_Task: double('result', wait_for_completion: nil),
92
+ PowerOnVM_Task: double('result', wait_for_completion: nil))
95
93
 
96
94
  vm_folder = double('vm_folder')
97
95
  vm_folder.stub(:findByUuid).with(EXISTING_UUID).and_return(@vm)
98
96
  vm_folder.stub(:findByUuid).with(MISSING_UUID).and_return(nil)
99
97
  vm_folder.stub(:findByUuid).with(nil).and_return(nil)
100
98
 
101
-
102
99
  @child_resource_pool = double('testresourcepool')
103
- @root_resource_pool = double('pools', :find => @child_resource_pool)
100
+ @root_resource_pool = double('pools', find: @child_resource_pool)
104
101
 
105
102
  @compute_resource = RbVmomi::VIM::ComputeResource.new(nil, nil)
106
103
  @compute_resource.stub(:resourcePool).and_return(@root_resource_pool)
107
104
 
108
- @host_folder = double('hostFolder', :childEntity => double('childEntity', :find => @compute_resource))
105
+ @host_folder = double('hostFolder', childEntity: double('childEntity', find: @compute_resource))
109
106
 
110
107
  @data_center = double('data_center',
111
- :vmFolder => vm_folder,
112
- :pretty_path => "data_center/#{vm_folder}",
113
- :find_compute_resource => @compute_resource,
114
- :hostFolder => @host_folder)
108
+ vmFolder: vm_folder,
109
+ pretty_path: "data_center/#{vm_folder}",
110
+ find_compute_resource: @compute_resource,
111
+ hostFolder: @host_folder)
115
112
 
116
113
  @device = RbVmomi::VIM::VirtualEthernetCard.new
117
114
  @device.stub(:backing).and_return(RbVmomi::VIM::VirtualEthernetCardNetworkBackingInfo.new)
118
115
 
119
116
  @virtual_hardware = double('virtual_hardware',
120
- :device => [@device])
117
+ device: [@device])
121
118
  @template_config = double('template_config',
122
- :hardware => @virtual_hardware)
119
+ hardware: @virtual_hardware)
123
120
 
124
121
  @template = double('template_vm',
125
- :parent => @data_center,
126
- :pretty_path => "#{@data_center.pretty_path}/template_vm",
127
- :CloneVM_Task => double('result',
128
- :wait_for_completion => double('new_vm', :config => double('config', :uuid => NEW_UUID))),
129
- :config => @template_config)
122
+ parent: @data_center,
123
+ pretty_path: "#{@data_center.pretty_path}/template_vm",
124
+ CloneVM_Task: double('result',
125
+ wait_for_completion: double('new_vm', config: double('config', uuid: NEW_UUID))),
126
+ config: @template_config)
130
127
 
131
128
  @data_center.stub(:find_vm).with(TEMPLATE).and_return(@template)
132
129
 
133
- service_instance = double 'service_instance', :find_datacenter => @data_center
130
+ service_instance = double 'service_instance', find_datacenter: @data_center
134
131
  @ip = double 'ip', :ipAddress= => nil
135
- @customization_spec = double 'customization spec', :nicSettingMap => [double('nic setting', :adapter => double('adapter', :ip => @ip))]
132
+ @customization_spec = double 'customization spec', nicSettingMap: [double('nic setting', adapter: double('adapter', ip: @ip))]
136
133
  @customization_spec.stub(:clone).and_return(@customization_spec)
137
- customization_spec_manager = double 'customization spec manager', :GetCustomizationSpec => double('spec info', :spec => @customization_spec)
138
- service_content = double 'service content', :customizationSpecManager => customization_spec_manager
139
- @vim = double 'vim', :serviceInstance => service_instance, :close => true, :serviceContent => service_content
134
+ customization_spec_manager = double 'customization spec manager', GetCustomizationSpec: double('spec info', spec: @customization_spec)
135
+ service_content = double 'service content', customizationSpecManager: customization_spec_manager
136
+ @vim = double 'vim', serviceInstance: service_instance, close: true, serviceContent: service_content
140
137
 
141
138
  VIM.stub(:connect).and_return(@vim)
142
139
  VIM.stub(:VirtualMachineRelocateSpec).and_return({})
143
- VIM.stub(:VirtualMachineCloneSpec) do |location, powerOn, template| { :location => location[:location] } end
144
-
140
+ VIM.stub(:VirtualMachineCloneSpec) { |location, _powerOn, _template| { location: location[:location] } }
145
141
  end
146
142
  end
data/vSphere.gemspec CHANGED
@@ -1,4 +1,4 @@
1
- $:.unshift File.expand_path('../lib', __FILE__)
1
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
2
2
  require 'vSphere/version'
3
3
 
4
4
  Gem::Specification.new do |s|
@@ -21,9 +21,10 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'rspec-core'
22
22
  s.add_development_dependency 'rspec-expectations'
23
23
  s.add_development_dependency 'rspec-mocks'
24
+ s.add_development_dependency 'rubocop', '~> 0.28'
24
25
 
25
- s.files = `git ls-files`.split($/)
26
- s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
27
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
26
+ s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
27
+ s.executables = s.files.grep(/^bin\//) { |f| File.basename(f) }
28
+ s.test_files = s.files.grep(/^(test|spec|features)\//)
28
29
  s.require_path = 'lib'
29
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vsphere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Grauch
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '0.28'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: '0.28'
111
125
  description: Enables Vagrant to manage machines with VMWare vSphere.
112
126
  email:
113
127
  - andrew.grauch@nsidc.org
@@ -117,7 +131,11 @@ extra_rdoc_files: []
117
131
  files:
118
132
  - .bumpversion.cfg
119
133
  - .gitignore
134
+ - .rubocop.yml
135
+ - .rubocop_todo.yml
120
136
  - .travis.yml
137
+ - CHANGELOG.md
138
+ - DEVELOPMENT.md
121
139
  - Gemfile
122
140
  - LICENSE.txt
123
141
  - README.md