Skip to content

Instantly share code, notes, and snippets.

@allspiritseve
Last active December 14, 2015 12:18
Show Gist options
  • Save allspiritseve/5084963 to your computer and use it in GitHub Desktop.
Save allspiritseve/5084963 to your computer and use it in GitHub Desktop.
Alias to bundle exec for common rails commands
# Source : http://marc-bowes.com/2011/09/21/dry-your-bundle-exec-tears.html
#
# Add to ~/.bash_profile or ~/.bashrc
bundle_commands="rake rails unicorn"
function run_bundler_cmd () {
if [ -r ./Gemfile ]; then
bundle exec $@
else
$@
fi
}
for cmd in $bundle_commands
do
alias $cmd="run_bundler_cmd $cmd"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment