5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/audit/lib/linear_script_generator.rb', line 5
def self.generate(benchmark)
retval = ""
resolved_dependencies = benchmark.execution_order
= benchmark.element("script_header.template")
= benchmark.element("header.template")
= benchmark.element("footer.template")
raise ItemNotFoundException.new("header.template"), "header template missing in benchmark" if .nil?
raise ItemNotFoundException.new("footer.template"), "footer template missing in benchmark" if .nil?
raise ItemNotFoundException.new("script_header.template"), "script header template missing in benchmark" if .nil?
retval = if
resolved_dependencies.flatten.each do|x|
depends_condition = ""
x.dependencies.each do|y|
depends_condition = depends_condition + "-a ${" + y.id + "_EXITCODE} -eq 0 "
end
retval = retval + "\n" + .gsub(/%%SCRIPT_ID%%/, x.id).gsub(/%%DEPENDS_CONDITION%%/, depends_condition) + "\n"
retval = retval + (x.script)
retval = retval + "\n" + .gsub(/%%SCRIPT_ID%%/, x.id)
end
return retval
end
|