Skip to content

Instantly share code, notes, and snippets.

@rafaelss
Created August 3, 2011 00:44
Show Gist options
  • Save rafaelss/1121637 to your computer and use it in GitHub Desktop.
Save rafaelss/1121637 to your computer and use it in GitHub Desktop.
function _bundle_exec() {
if [ -e Gemfile ]; then
grep -q "$1" "Gemfile.lock"
if [[ "$1" == "ruby" || $? -eq 0 ]]; then
echo "bundle exec $@"
bundle exec $@
return
fi
fi
$@
}
for cmd in ruby rails rake rspec
do
alias $cmd="_bundle_exec $cmd"
done
@ltartari
Copy link

ltartari commented Aug 3, 2011

!/bin/bash or zsh?

@rafaelss
Copy link
Author

rafaelss commented Aug 3, 2011

bash

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