17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
# File 'lib/vagrant-windows/monkey_patches/provisioner.rb', line 17
def provision_on_windows
args = ""
args = " #{config.args}" if config.args
with_script_file do |path|
@machine.communicate.tap do |comm|
fixed_upload_path = if File.extname(config.upload_path) == ""
"#{config.upload_path}#{File.extname(path.to_s)}"
else
config.upload_path
end
comm.upload(path.to_s, fixed_upload_path)
command = <<-EOH
$old = Get-ExecutionPolicy;
Set-ExecutionPolicy Unrestricted -force;
#{win_friendly_path(fixed_upload_path)}#{args};
Set-ExecutionPolicy $old -force
EOH
comm.sudo(command) do |type, data|
if [:stderr, :stdout].include?(type)
color = type == :stdout ? :green : :red
@machine.env.ui.info(data.chomp, :color => color, :prefix => false)
end
end
end
end
end
|