Created
October 14, 2015 22:48
-
-
Save michaelxor/97a57c3e1956ebf40b89 to your computer and use it in GitHub Desktop.
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 | |
GEMSETS=$(find ~/.rvm/gems -maxdepth 1) | |
VERSION_TO_REMOVE="1.10.6" | |
for i in ${GEMSETS[@]} | |
do | |
GEMSET=${i##*/} | |
if [[ $GEMSET == "gems" || $GEMSET == "cache" ]]; then | |
continue | |
fi | |
echo $GEMSET | |
matches=$(bash -lc "rvm use $GEMSET &> /dev/null; gem list | grep '^bundler ($VERSION_TO_REMOVE)$'") | |
if [[ $? != 0 ]]; then | |
matches=$(bash -lc "rvm use $GEMSET &> /dev/null; gem list | grep '^bundler.*$VERSION_TO_REMOVE'") | |
if [[ $? != 0 ]]; then | |
echo "$GEMSET does not have $VERSION_TO_REMOVE at all" | |
else | |
echo $matches | |
echo "$GEMSET has $VERSION_TO_REMOVE and other versions" | |
bash -lc "rvm use $GEMSET &> /dev/null; yes | gem uninstall bundler -v $VERSION_TO_REMOVE" | |
fi | |
else | |
echo $matches | |
echo "$GEMSET has only $VERSION_TO_REMOVE" | |
fi | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment