Created
February 10, 2011 00:24
-
-
Save tommeier/819664 to your computer and use it in GitHub Desktop.
Remove all the old crufty system gems
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
#Uninstall crappy old system gems | |
function remove_system_gems { | |
echo "Uninstalling all system gems... This could take a while..." | |
for x in `gem list --no-versions`; do gem uninstall $x --all --quiet --ignore-dependencies --user-install --executables; done | |
#TODO : Add check for trailing slash and remove | |
system_location=$@ | |
if [ "$system_location" == "" ]; then | |
system_location='/Library/Ruby/Gems/1.8' | |
fi | |
folder_names=( 'specifications' 'gems' 'cache' 'doc' 'bundler/gems' ) | |
for folder_name in ${folder_names[@]}; do | |
echo "Deleting from $system_location : $folder_name" | |
`sudo rm -rf $system_location/$folder_name` | |
done | |
result=`gem list` | |
echo '=================================================' | |
if [ "$result" == "" ]; then | |
echo ' Uninstall of existing system gems successful' | |
else | |
echo ' Error - There appears to still be gems in "gem list" please check the system location and try again' | |
fi | |
echo '=================================================' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment