From: Joel VanderWerf Date: 2010-04-20T08:17:35+09:00 Subject: Re: Documenting Rakefile using rdoc Robert Dober wrote: > On Mon, Apr 19, 2010 at 9:59 PM, Joel VanderWerf > wrote: > >> task "top-tasks" do >> `rake --tasks`.split("\n").each do |t| >> if t !~ /^rake \w+:/ and t =~ /^rake/ >> puts t >> end >> end >> end >> >> Maybe you can even use Rake's API to get the task list without shelling out. >> >> > task ":top-tasks" do > Rake::Task.tasks.each do | tsk | > next if tsk.name =~ /:/ # this could be more elaborate I guess > puts "#{tsk.name} #{tsk.full_comment}" > end > end > > use with > > rake :top-tasks ( just to distinguish from "normal" tasks ) I am too > lazy to tweak the rake script to allow > rake --top-tasks. Thanks, Robert! Actually, I like rake top-tasks better than rake --top-tasks anyway. It might be better to skip the tasks that have no desc: task "top-tasks" do Rake::Task.tasks.each do | tsk | next if tsk.name =~ /:/ or not tsk.full_comment puts "#{tsk.name} #{tsk.full_comment}" end end