Created
August 1, 2016 20:01
-
-
Save lukebakken/075e97519cfb3c04650a4191844592f4 to your computer and use it in GitHub Desktop.
Remove all gems in your rbenv environment
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
#!/usr/bin/env bash | |
RBENV_ROOT="$HOME/.rbenv" | |
if [[ -d "$RBENV_ROOT/bin" ]] | |
then | |
export RBENV_ROOT | |
export PATH="$HOME/.rbenv/bin:$PATH" | |
eval "$(rbenv init -)" | |
else | |
echo "Expected to find rbenv in $RBENV_ROOT!" 2>&1 | |
exit 1 | |
fi | |
function uninstall | |
{ | |
for gem in $(gem list --no-versions) | |
do | |
gem uninstall "$gem" -aIx | |
done | |
gem list | |
gem install bundler | |
} | |
if [[ $@ ]] | |
then | |
RUBIES="$@" | |
else | |
RUBIES="$(rbenv versions --bare)" | |
fi | |
for ruby in $RUBIES; do | |
echo '---------------------------------------' | |
echo $ruby | |
(rbenv shell $ruby && uninstall) & | |
done | |
echo -n 'Waiting...' | |
wait | |
echo 'DONE!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment