Class: Psychic::Runner
- Inherits:
-
Object
- Object
- Psychic::Runner
- Includes:
- BaseRunner, SampleRunner
- Defined in:
- lib/psychic/runner.rb,
lib/psychic/runner/version.rb,
lib/psychic/runner/hot_runner.rb,
lib/psychic/runner/base_runner.rb,
lib/psychic/runner/sample_runner.rb,
lib/psychic/runner/cold_runner_registry.rb,
lib/psychic/runner/cold/shell_script_runner.rb
Defined Under Namespace
Modules: BaseRunner, Cold, SampleRunner Classes: ColdRunnerRegistry, HotRunner, TaskNotImplementedError
Constant Summary collapse
- VERSION =
'0.0.6'
Constants included from BaseRunner
BaseRunner::DEFAULT_PARAMS_FILE
Constants included from Shell
Instance Attribute Summary collapse
-
#cold_runners ⇒ Object
readonly
Returns the value of attribute cold_runners.
-
#hot_runner ⇒ Object
readonly
Returns the value of attribute hot_runner.
-
#runners ⇒ Object
readonly
Returns the value of attribute runners.
Attributes included from BaseRunner
#cwd, #env, #hints, #known_tasks
Instance Method Summary collapse
- #[](task_name) ⇒ Object
-
#initialize(opts = { cwd: Dir.pwd }) ⇒ Runner
constructor
A new instance of Runner.
Methods included from SampleRunner
#find_sample, #interactive?, #process_parameters, #run_sample, #run_sample_file, #templated?
Methods included from BaseRunner
#active?, #command_for_task, #dry_run?, #execute, #execute_task, included, #method_missing, #respond_to_missing?
Methods included from Logger
#log_level=, #logger, #new_logger
Methods included from Shell
Constructor Details
#initialize(opts = { cwd: Dir.pwd }) ⇒ Runner
Returns a new instance of Runner.
22 23 24 25 26 27 28 29 30 |
# File 'lib/psychic/runner.rb', line 22 def initialize(opts = { cwd: Dir.pwd }) fail 'cwd is required' unless opts[:cwd] opts[:cwd] = Pathname(opts[:cwd]).to_s # must be a string on windows... super @hot_runner = HotRunner.new(opts) @cold_runners = ColdRunnerRegistry.active_runners(opts) @runners = [@hot_runner, @cold_runners].flatten @known_tasks = @runners.map(&:known_tasks).uniq end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Psychic::Runner::BaseRunner
Instance Attribute Details
#cold_runners ⇒ Object (readonly)
Returns the value of attribute cold_runners.
20 21 22 |
# File 'lib/psychic/runner.rb', line 20 def cold_runners @cold_runners end |
#hot_runner ⇒ Object (readonly)
Returns the value of attribute hot_runner.
20 21 22 |
# File 'lib/psychic/runner.rb', line 20 def hot_runner @hot_runner end |
#runners ⇒ Object (readonly)
Returns the value of attribute runners.
20 21 22 |
# File 'lib/psychic/runner.rb', line 20 def runners @runners end |
Instance Method Details
#[](task_name) ⇒ Object
32 33 34 35 36 |
# File 'lib/psychic/runner.rb', line 32 def [](task_name) runner = runners.find { |r| r.command_for_task(task_name) } return nil unless runner runner[task_name] end |