10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/ci_scripts.rb', line 10
def self.run_script(script_name)
script_name = script_name.strip
full_path = File.join(File.dirname(__FILE__), "scripts", script_name)
unless File.exist?("#{full_path}.rb")
log_error "#{script_name} does not exists"
return false
end
require full_path
script_parts = script_name.split("/")
function_name = script_parts.pop
module_name = ""
script_parts.each do |part|
module_name += "::" unless module_name.empty?
module_name += classify(part)
end
result = Object.const_get(module_name).send(function_name)
return true if result.nil?
result
end
|