Skip to content

Instantly share code, notes, and snippets.

@chrishunt
Created July 9, 2013 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrishunt/5960315 to your computer and use it in GitHub Desktop.
Save chrishunt/5960315 to your computer and use it in GitHub Desktop.
Get location of rake task definition
def locations_for(task)
Rake::TaskManager.record_task_metadata=true
Rake.application.load 'Rakefile'
Rake.application.tasks.each.find { |t| t.name == task }.locations
end
locations_for('test')
# ["../vendor/gems/ruby/1.9.1/gems/railties-4.0.0/lib/rails/test_unit/testing.rake:50:in `<top (required)>'"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment