Class: Rigger::TaskExecutionService
- Inherits:
-
Object
- Object
- Rigger::TaskExecutionService
- Defined in:
- lib/rigger/task_execution_service.rb
Instance Method Summary collapse
- #call(task_name) ⇒ Object
-
#initialize(config, server_resolver = ServerResolver.new(config), execution_strategy_selector = ExecutionStrategy::Selector.new) ⇒ TaskExecutionService
constructor
A new instance of TaskExecutionService.
Constructor Details
#initialize(config, server_resolver = ServerResolver.new(config), execution_strategy_selector = ExecutionStrategy::Selector.new) ⇒ TaskExecutionService
Returns a new instance of TaskExecutionService.
8 9 10 11 12 13 14 |
# File 'lib/rigger/task_execution_service.rb', line 8 def initialize(config, server_resolver = ServerResolver.new(config), execution_strategy_selector = ExecutionStrategy::Selector.new) @config = config @server_resolver = server_resolver @execution_strategy_selector = execution_strategy_selector end |
Instance Method Details
#call(task_name) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/rigger/task_execution_service.rb', line 16 def call(task_name) task = @config.locate_task(task_name) servers = @server_resolver.call(task) puts " * executing '#{task_name}'" strategy = @execution_strategy_selector.call(task) strategy.call(task, servers, @config, self) end |