Class: TheRunner
- Inherits:
-
Object
- Object
- TheRunner
- Defined in:
- lib/the_runner.rb,
lib/the_runner/server.rb,
lib/the_runner/command.rb,
lib/the_runner/context.rb,
lib/the_runner/runner/ssh.rb,
lib/the_runner/runner/base.rb,
lib/the_runner/server/config.rb,
lib/the_runner/context/config.rb,
lib/the_runner/therunnerfile/handler.rb
Defined Under Namespace
Classes: Command, Context, Runner, Server, Therunnerfile
Class Method Summary collapse
Instance Method Summary collapse
-
#[]=(key, context) ⇒ Object
TODO we don’t always need the key, mostly when we want to run a single context.
-
#initialize ⇒ TheRunner
constructor
A new instance of TheRunner.
-
#run(key = 'default') ⇒ Object
TODO make constant for ‘default’, it’s used in multiple places.
Constructor Details
#initialize ⇒ TheRunner
Returns a new instance of TheRunner.
10 11 12 |
# File 'lib/the_runner.rb', line 10 def initialize @contexts = {} end |
Class Method Details
.context(key = 'default') {|context| ... } ⇒ Object
2 3 4 5 6 |
# File 'lib/the_runner/therunnerfile/handler.rb', line 2 def self.context(key = 'default') context = TheRunner::Context.new yield context TheRunner::Therunnerfile::Handler.add_context(key, context) end |
Instance Method Details
#[]=(key, context) ⇒ Object
TODO we don’t always need the key, mostly when we want to run a single context
15 16 17 |
# File 'lib/the_runner.rb', line 15 def []=(key, context) @contexts[key] = context end |
#run(key = 'default') ⇒ Object
TODO make constant for ‘default’, it’s used in multiple places
20 21 22 23 24 25 26 27 |
# File 'lib/the_runner.rb', line 20 def run(key = 'default') if @contexts.count == 1 run_context(@contexts.first[1]) else # TODO check if the key exists run_context(@contexts[key]) end end |