There are different ways to run rake:
bin/rake
to use them.Here is a solution that gives you a plain rake
command which uses a binstubbed bin/rake
if available and falls back to bundle exec rake
if necessary.
To see if it works for you, run the following in your bash terminal.
rake() { if [ -f bin/rake ]; then bin/rake "$@"; else bundle exec rake "$@"; fi }
Now, your rake
command in the terminal will point to that function:
$ type rake
rake is a function
rake ()
...
Next, try running rake routes
on a Rails 4.1+ project -- the 2nd time should be significantly faster. On older projects you should always get your bundled rake.
To always enable that short-hand function for terminal sessions, put it into your ~/.bashrc
file.
New terminals will know about your custom rake()
function.
In existing terminal sessions, reload your bash config:
source ~/.bashrc
Double-check with a type rake
just to be sure.
Yaaaay. No more clumsy rake calls!