vagrant-windows 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +6 -5
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +49 -3
- data/coverage/index.html +405 -129
- data/lib/vagrant-windows/monkey_patches/plugins/provisioners/shell/provisioner.rb +30 -16
- data/lib/vagrant-windows/version.rb +1 -1
- data/lib/vagrant-windows/windows_machine.rb +13 -2
- data/spec/vagrant-windows/windows_machine_spec.rb +22 -1
- data/test.ps1 +1 -0
- metadata +5 -4
@@ -22,7 +22,7 @@ module VagrantPlugins
|
|
22
22
|
windows_machine = VagrantWindows::WindowsMachine.new(@machine)
|
23
23
|
wait_if_rebooting(windows_machine)
|
24
24
|
|
25
|
-
|
25
|
+
with_windows_script_file do |path|
|
26
26
|
# Upload the script to the machine
|
27
27
|
@machine.communicate.tap do |comm|
|
28
28
|
# Ensure the uploaded script has a file extension, by default
|
@@ -63,24 +63,38 @@ module VagrantPlugins
|
|
63
63
|
# This method yields the path to a script to upload and execute
|
64
64
|
# on the remote server. This method will properly clean up the
|
65
65
|
# script file if needed.
|
66
|
-
def
|
67
|
-
|
66
|
+
def with_windows_script_file
|
67
|
+
script = nil
|
68
|
+
|
69
|
+
if config.remote?
|
70
|
+
download_path = @machine.env.tmp_path.join("#{@machine.id}-remote-script")
|
71
|
+
download_path.delete if download_path.file?
|
72
|
+
|
73
|
+
Vagrant::Util::Downloader.new(config.path, download_path).download!
|
74
|
+
script = download_path.read
|
75
|
+
|
76
|
+
download_path.delete
|
77
|
+
elsif config.path
|
68
78
|
# Just yield the path to that file...
|
69
|
-
|
79
|
+
root_path = @machine.env.root_path
|
80
|
+
script = Pathname.new(config.path).expand_path(root_path).read
|
70
81
|
else
|
71
|
-
#
|
72
|
-
|
73
|
-
|
82
|
+
# The script is just the inline code...
|
83
|
+
script = config.inline
|
84
|
+
end
|
74
85
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
86
|
+
# Otherwise we have an inline script, we need to Tempfile it,
|
87
|
+
# and handle it specially...
|
88
|
+
file = Tempfile.new(['vagrant-powershell', '.ps1'])
|
89
|
+
|
90
|
+
begin
|
91
|
+
file.write(script)
|
92
|
+
file.fsync
|
93
|
+
file.close
|
94
|
+
yield file.path
|
95
|
+
ensure
|
96
|
+
file.close
|
97
|
+
file.unlink
|
84
98
|
end
|
85
99
|
end
|
86
100
|
|
@@ -26,6 +26,13 @@ module VagrantWindows
|
|
26
26
|
@machine.provider_name.to_s().start_with?('vmware')
|
27
27
|
end
|
28
28
|
|
29
|
+
# Checks to see if the machine is using Oracle VirtualBox.
|
30
|
+
#
|
31
|
+
# @return [Boolean]
|
32
|
+
def is_virtualbox?()
|
33
|
+
@machine.provider_name.to_s().start_with?('virtualbox')
|
34
|
+
end
|
35
|
+
|
29
36
|
# Checks to see if the machine is rebooting or has a scheduled reboot.
|
30
37
|
#
|
31
38
|
# @return [Boolean] True if rebooting
|
@@ -50,11 +57,15 @@ module VagrantWindows
|
|
50
57
|
end
|
51
58
|
|
52
59
|
# Returns a list of forwarded ports for a VM.
|
53
|
-
# NOTE:
|
60
|
+
# NOTE: Only the VBox provider currently supports this method
|
54
61
|
#
|
55
62
|
# @return [Array<Array>]
|
56
63
|
def read_forwarded_ports()
|
57
|
-
|
64
|
+
if is_virtualbox?()
|
65
|
+
@machine.provider.driver.read_forwarded_ports
|
66
|
+
else
|
67
|
+
[]
|
68
|
+
end
|
58
69
|
end
|
59
70
|
|
60
71
|
# Returns the SSH config for this machine.
|
@@ -24,6 +24,20 @@ describe VagrantWindows::WindowsMachine , :unit => true do
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
describe "is_virtualbox?" do
|
28
|
+
it "should be true for virtualbox" do
|
29
|
+
machine = stub(:provider_name => :virtualbox)
|
30
|
+
windows_machine = VagrantWindows::WindowsMachine.new(machine)
|
31
|
+
expect(windows_machine.is_virtualbox?()).to be_true
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be false for vmware_workstation" do
|
35
|
+
machine = stub(:provider_name => :vmware_workstation)
|
36
|
+
windows_machine = VagrantWindows::WindowsMachine.new(machine)
|
37
|
+
expect(windows_machine.is_virtualbox?()).to be_false
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
27
41
|
describe "is_windows?" do
|
28
42
|
it "should return true when config vm guest is windows" do
|
29
43
|
vm = stub(:guest => :windows)
|
@@ -38,7 +52,14 @@ describe VagrantWindows::WindowsMachine , :unit => true do
|
|
38
52
|
machine = stub(:config => config)
|
39
53
|
expect(VagrantWindows::WindowsMachine.is_windows?(machine)).to be_false
|
40
54
|
end
|
41
|
-
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "read_forwarded_ports" do
|
58
|
+
it "should return empty array for vmware provider" do
|
59
|
+
machine = stub(:provider_name => :vmware_fusion)
|
60
|
+
windows_machine = VagrantWindows::WindowsMachine.new(machine)
|
61
|
+
expect(windows_machine.read_forwarded_ports()).to eq([])
|
62
|
+
end
|
42
63
|
end
|
43
64
|
|
44
65
|
end
|
data/test.ps1
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
echo 'hi'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-windows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-12-02 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: winrm
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- spec/vagrant-windows/winrmcommunicator_spec.rb
|
210
210
|
- spec/vagrant-windows/winrmfinder_spec.rb
|
211
211
|
- spec/vagrant-windows/winrmshell_spec.rb
|
212
|
+
- test.ps1
|
212
213
|
- vagrant-windows.gemspec
|
213
214
|
- .DS_Store
|
214
215
|
- .gitignore
|
@@ -230,7 +231,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
230
231
|
version: '0'
|
231
232
|
segments:
|
232
233
|
- 0
|
233
|
-
hash:
|
234
|
+
hash: -417370087256644247
|
234
235
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
235
236
|
none: false
|
236
237
|
requirements:
|
@@ -239,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
239
240
|
version: '0'
|
240
241
|
segments:
|
241
242
|
- 0
|
242
|
-
hash:
|
243
|
+
hash: -417370087256644247
|
243
244
|
requirements: []
|
244
245
|
rubyforge_project:
|
245
246
|
rubygems_version: 1.8.23
|