Class: EcoRake::Lib::Task::RunnerLaunch
- Defined in:
- lib/eco-rake/lib/task/runner_launch.rb
Constant Summary collapse
- FORWARD_RULES =
{ enviro: ->(enviro) { "-#{enviro}" }, space: ->(space) { "-space #{space}" }, simulate: '-simulate' }.freeze
Constants inherited from EcoRake
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.subtask(name, desc = nil, **kargs, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/eco-rake/lib/task/runner_launch.rb', line 23 def subtask(name, desc = nil, **kargs, &block) unless task_option&.enum? option_reopen( :task, type: [], desc: 'Target task to run', required: true ) end EcoRake::Subtask.new(name, desc, **kargs, &block).tap do |subtask| raise "Task '#{name}' is already defined" if subtasks.key?(subtask.name) option_get(:task).tap do |option| option..push(subtask.name) subtasks[subtask.name] = subtask end end end |
.subtasks ⇒ Object
43 44 45 |
# File 'lib/eco-rake/lib/task/runner_launch.rb', line 43 def subtasks @subtasks ||= {} end |
.task_option ⇒ Object
19 20 21 |
# File 'lib/eco-rake/lib/task/runner_launch.rb', line 19 def task_option option_get(:task) end |
Instance Method Details
#task(*args) ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/eco-rake/lib/task/runner_launch.rb', line 50 def task(*args) if (callback = target_subtask.callback) instance_exec(*args, &callback) elsif respond_to?(target_subtask.command_name, true) send(target_subtask.command_name) else msg = "Undefined method to perform '#{target_subtask.command_name}'" raise msg end end |