Last active
December 25, 2015 05:18
-
-
Save jnweaver/6923116 to your computer and use it in GitHub Desktop.
BASH cap bundler environment handling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# special handling for cap | |
function run_bundler_cap_cmd () { | |
if [ -e ./Gemfile ]; then | |
echo "bundle exec $@" | |
bundle exec $@ | |
else | |
cmd=$@ | |
echo ${cmd/cap /cap _2.15.5_ } | |
${cmd/cap /cap _2.15.5_ } | |
fi | |
} | |
alias cap="run_bundler_cap_cmd cap" | |
#other commands | |
bundle_commands=( spec rspec cucumber jekyll watchr rails) | |
function run_bundler_cmd () { | |
if [ -e ./Gemfile ]; then | |
echo "bundle exec $@" | |
bundle exec $@ | |
else | |
echo "$@" | |
$@ | |
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