Class: AdminModule::Runner
- Inherits:
-
Object
- Object
- AdminModule::Runner
- Defined in:
- lib/admin_module.rb
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(argv, client = AdminModule::Client.new, exit_code = true) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(argv, client = AdminModule::Client.new, exit_code = true) ⇒ Runner
Returns a new instance of Runner.
239 240 241 242 243 |
# File 'lib/admin_module.rb', line 239 def initialize(argv, client = AdminModule::Client.new, exit_code = true) @argv = argv AdminModule.client = client @exit_code = exit_code end |
Instance Method Details
#execute! ⇒ Object
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 |
# File 'lib/admin_module.rb', line 245 def execute! exit_code = begin # Run the Thor app AdminModule::CLI.start(@argv) # Thor::Base#start does not have a return value, # assume success if no exception is thrown. 0 rescue StandardError => e b = e.backtrace b.unshift("#{b.shift}: #{e.message} (#{e.class})") puts(b.map { |s| "\tfrom #{s}"}.join("\n")) 1 end # Return the exit code exit(exit_code) if @exit_code end |