If you have rake tasks that don't rely on rails, it's really annoying that rails has to load before the tasks runs.
Instead this rakefile only loads rails if a rake task which depends on :environment
is called.
One caveat is that rake -T won't list rails/gem tasks, hence the added warning. To show all tasks use rake -T LOAD_RAILS=1
With thanks to @xshay http://rhnh.net/2010/09/07/speeding-up-rails-rake
Any thoughts?
There appears to be a problem with this. If a task throws an error,
rake
seems to mark it as failed and won't run it again, so theinvoke_..
in therescue
doesn't actually invoke the task. Still working on a solution, probably something involvingreenable
.