Skip to content

Instantly share code, notes, and snippets.

@matthewrudy
Created June 2, 2011 04:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewrudy/1003927 to your computer and use it in GitHub Desktop.
Save matthewrudy/1003927 to your computer and use it in GitHub Desktop.
Does running `bundle exec rake` make you angry. Control your `rage`!
#!/usr/bin/env bash
#
# Usage: rage db:migrate --trace
# should work transparently like rake
#
# if we're in a directory controlled by bundler
# we do bundle exec rake
if [ -f Gemfile ]; then
bundle exec rake $@
# otherwise we use the system / rvm rake
else
rake $@
fi
@rentalcustard
Copy link

Use gemsets or try bundle install --binstubs and put Rails.root/bin in your $PATH. :)

@matthewrudy
Copy link
Author

that's fine mortice.
But if I'm jumping between projects (some on rake 0.9.0, some on rake 0.8.7, some which don't care) then this suits me.

I imagine in a few weeks I'll upgrade everything to rake 0.9.0 anyway,
just need to do some testing on servers before I deploy.

@rentalcustard
Copy link

Have you tried putting a .rvmrc file in each project root specifying the gemsets to use in the mean time?

@matthewrudy
Copy link
Author

oh jeez.
that's clever.
I said to my colleague when I went to lunch "it'd be cool if you could do [what rvmrc's do]"

@lemsx1
Copy link

lemsx1 commented Oct 14, 2011

well, i always use bundle now so for me is simpler to just do: (add to your ~/.alias.setup or ~/.bashrc)

alias rake='bundle exec rake $@'

And just keep typing "rake" as I usually do... it works just fine. (bundle exec looks for "rake" in whatever bundle path and it can't see your alias, which is just for your interactive shell)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment