Class: CIScripts::Script
- Inherits:
-
Object
- Object
- CIScripts::Script
- Defined in:
- lib/ci_scripts.rb
Instance Method Summary collapse
-
#initialize(script_name) ⇒ Script
constructor
A new instance of Script.
- #run ⇒ Object
Constructor Details
#initialize(script_name) ⇒ Script
Returns a new instance of Script.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ci_scripts.rb', line 11 def initialize(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 end require full_path @class_name = parse_script_name(script_name) end |
Instance Method Details
#run ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/ci_scripts.rb', line 25 def run return false unless @class_name result = Object.const_get(@class_name).new.send("run") return true if result.nil? result end |