Method: BinScript.run_script
- Defined in:
- lib/bin_script/bin_script.rb
.run_script(filename = $0) ⇒ Object
Run script detected by the filename of source script file
137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/bin_script/bin_script.rb', line 137 def run_script(filename = $0) cfg = parse_script_file_name(Pathname.new(filename).realpath.to_s) cfg[:files].each { |f| require f } # Create instance and call run! for script class klass = cfg[:class].constantize script = klass.new script.run! # Exit with specified exit status exit script.exit_status || 0 end |