(think)

An online novel about the Source, the Force, the real life and everything in between...

Find Out Where a Rake Task Is Defined

Have you ever wondered where a particular rake task is defined? Enter rake -W (introduced in rake 0.9):

1
2
3
4
$ rake -W db:schema:load

rake db:schema:load                 /Users/bozhidar/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activerecord-4.1.1/lib/active_record/railties/databases.rake:236:in `block (2 levels) in <top (required)>'
rake db:schema:load_if_ruby         /Users/bozhidar/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activerecord-4.1.1/lib/active_record/railties/databases.rake:240:in `block (2 levels) in <top (required)>'

You can also invoke rake -W without an argument and you’ll get a listing of all available rake tasks and their source locations.

Pretty neat, right?

Comments