Class: TyrantManager::Runner
- Inherits:
-
Object
- Object
- TyrantManager::Runner
- Defined in:
- lib/tyrant_manager/runner.rb
Instance Attribute Summary collapse
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(manager, opts = {}) ⇒ Runner
constructor
A new instance of Runner.
- #logger ⇒ Object
- #run(command_name) ⇒ Object
Constructor Details
#initialize(manager, opts = {}) ⇒ Runner
Returns a new instance of Runner.
14 15 16 17 |
# File 'lib/tyrant_manager/runner.rb', line 14 def initialize( manager, opts = {} ) @manager = manager @options = opts end |
Instance Attribute Details
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
12 13 14 |
# File 'lib/tyrant_manager/runner.rb', line 12 def manager @manager end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/tyrant_manager/runner.rb', line 11 def @options end |
Instance Method Details
#logger ⇒ Object
19 20 21 |
# File 'lib/tyrant_manager/runner.rb', line 19 def logger ::Logging::Logger[self] end |
#run(command_name) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/tyrant_manager/runner.rb', line 23 def run( command_name ) cmd = Command.find( command_name ).new( self.manager, self. ) begin cmd.before cmd.run rescue => e logger.error "while running #{command_name} : #{e.}" e.backtrace.each do |l| logger.warn l.strip end ensure cmd.after end end |