10
11
12
13
14
15
16
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
|
# File 'lib/vagrant-gpii-ci/command/test.rb', line 10
def execute
param_options = {}
opts = OptionParser.new do |o|
o.banner = "Usage: vagrant ci test [options] [name|id]"
o.on("--stage STAGE", String, "Execute specific stage") do |s|
param_options[:stage] = s
end
end
argv = parse_options(opts)
return if !argv
@env.ui.info("Launching tests...")
ci_tests = @env.instance_variable_get(:@ci_tests)
with_target_vms(argv, single_target: true) do |machine|
if machine.config.vm.communicator == :winrm
cwd = "cd c:\\vagrant"
else
cwd = "cd /vagrant"
end
ci_tests["#{machine.config.vm.hostname}"].each do | provisioner, stages |
if provisioner.eql?("shell")
stages.each do |stagename, stagescripts|
next if (param_options.include?(:stage) and not stagename.eql?(param_options[:stage]))
stagescripts.each do | script |
options = {}
options[:color] = :blue
@env.ui.info("Running shell script:")
@env.ui.info("#{script}",options)
machine.communicate.execute("#{cwd}; #{script}") do |type, data|
handle_comm(type, data, machine)
end
end
end
end
end
end
end
|