Created
October 12, 2011 15:49
-
-
Save chriseppstein/1281586 to your computer and use it in GitHub Desktop.
Execute the same command in each installed ruby via rbenv
This file contains hidden or 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
#!/bin/bash | |
verbose=0 | |
function usage() { | |
echo >&2 "Usage: rbenv each [-v] ..." | |
echo >&2 " -v Verbose mode. Prints a header for each ruby." | |
} | |
while getopts vh option | |
do case "$option" in | |
v) verbose=1;; | |
h) usage; exit 0;; | |
[?]) | |
usage; | |
exit 1;; | |
esac | |
done | |
shift $(($OPTIND-1)) | |
failed_rubies="" | |
for ruby in `rbenv versions --bare`; do | |
if [ $verbose = 1 ]; then | |
echo -e "\033[1;34m[$ruby]:\033[0m \033[1;32m$@\033[0m"; | |
echo -e "\033[1;34m******************************************************************\033[0m"; | |
fi | |
RBENV_VERSION=$ruby $@ | |
if [ $verbose = 1 ]; then | |
echo | |
fi | |
if [ $? != 0 ]; then | |
failed_rubies="$failed_rubies $ruby" | |
fi | |
done | |
if [ -n "$failed_rubies" ]; then | |
echo -e "\033[1;31mFAILED IN:$failed_rubies\033[0m" | |
fi |
This file contains hidden or 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
$ rbenv each bundle install | |
$ rbenv each -v rake test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See: https://github.com/chriseppstein/rbenv-each to install as a plugin.