Module: Coals::TaskTree

Included in:
RakeRunner
Defined in:
lib/coals/task_tree.rb

Instance Method Summary collapse

Instance Method Details

#build_tasksObject

Coals assumes that any task lacking a description is not meant to be called directly, i.e. a ‘subtask’ This is in line with the list rendered by ‘rake -T`



23
24
25
26
# File 'lib/coals/task_tree.rb', line 23

def build_tasks
  load_rakefile
  Rake.application.tasks.reject { |t| t.comment.nil? }
end

#load_rakefileObject



28
29
30
31
# File 'lib/coals/task_tree.rb', line 28

def load_rakefile
  Rake::TaskManager. = true
  load 'Rakefile'
end

#task_treeObject



14
15
16
17
18
# File 'lib/coals/task_tree.rb', line 14

def task_tree
  @_task_tree ||= build_tasks.each_with_object(Hash.new { |h, k| h[k] = [] }) do |task, tree|
    tree[task.namespace] << task
  end
end