From: Joel VanderWerf Date: 2010-04-20T08:55:38+09:00 Subject: Re: Documenting Rakefile using rdoc Here's another version: task "tasks" do Rake::Task.tasks.each do | tsk | next if tsk.name =~ /:/ or not tsk.full_comment printf "rake %-19s# %s\n", tsk.name, tsk.full_comment end end namespace "tasks" do rule /.*/ do |t| pats = t.name.split(":")[1..-1].map {|pat| Regexp.new("\\A#{pat}\\z")} Rake::Task.tasks.each do | tsk | next unless tsk.full_comment parts = tsk.name.split(":") next unless parts.size <= pats.size + 1 next unless pats.zip(parts).all? {|pat, part| pat === part} printf "rake %-19s# %s\n", tsk.name, tsk.full_comment end end end Use it like this: $ rake tasks # show all top level tasks $ rake tasks:internals # show all tasks in "internals" namespace $ rake tasks:internals:'build.*' # show all tasks in "internals" namespace whose name begins with build It probably still needs some tinkering...