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.
9 10 11 12 |
# File 'lib/tyrant_manager/runner.rb', line 9 def initialize( manager, opts = {} ) @manager = manager @options = opts end |
Instance Attribute Details
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
7 8 9 |
# File 'lib/tyrant_manager/runner.rb', line 7 def manager @manager end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/tyrant_manager/runner.rb', line 6 def @options end |
Instance Method Details
#logger ⇒ Object
14 15 16 |
# File 'lib/tyrant_manager/runner.rb', line 14 def logger ::Logging::Logger[self] end |
#run(command_name) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/tyrant_manager/runner.rb', line 18 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 |