Class: Coals::RakeRunner
- Inherits:
-
Object
- Object
- Coals::RakeRunner
- Defined in:
- lib/coals/runner.rb
Instance Method Summary collapse
-
#initialize ⇒ RakeRunner
constructor
A new instance of RakeRunner.
-
#run ⇒ Object
TODO: Some cascading condition set such that user can back up or go forward by 1 step.
Methods included from TaskTree
#build_tasks, #load_rakefile, #task_tree
Methods included from Prompt
Constructor Details
#initialize ⇒ RakeRunner
Returns a new instance of RakeRunner.
6 7 8 9 10 11 12 13 |
# File 'lib/coals/runner.rb', line 6 def initialize @tasks = task_tree @full_command = nil @task = nil @task_arguments = {} @group_key = nil @confirmed = false end |
Instance Method Details
#run ⇒ Object
TODO: Some cascading condition set such that user can back up or go forward by 1 step
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/coals/runner.rb', line 16 def run until @confirmed @namespace = capture_selection( title: 'Avalable Task Groups:', options: ) @task = capture_selection( title: "Available '#{@namespace}' commands:", options: ) unless @task.arg_names.empty? @task_arguments = @task.arg_names.each_with_object({}) { |arg, obj| obj[arg] = nil } capture_task_arguments while @task_arguments.values.any?(&:nil?) end @confirmed = capture_confirmation end # Invoke ensures that prerequirement tasks like rails :environment are run first. @task.invoke(*@task_arguments.values) end |