#!/usr/bin/env bash | |
uninstall() { | |
list=`gem list --no-versions` | |
for gem in $list; do | |
gem uninstall $gem -aIx | |
done | |
gem list | |
gem install bundler | |
} | |
#rbenv versions --bare | |
RBENVPATH=`rbenv root` | |
echo $RBENVPATH | |
RUBIES=`ls $RBENVPATH/versions` | |
for ruby in $RUBIES; do | |
echo '---------------------------------------' | |
echo $ruby | |
rbenv local $ruby | |
uninstall | |
done |
You might want to add "are you sure you want to remove everything?"!
Muito bom!
This leaves .ruby-version
in the current folder when it's done?
works! thx
Perfect, thx!
I wrote an updated version that addresses the .ruby-version
issue and also allows you to specify a list of ruby versions whose gems should be installed as command line args:
The above link doesn't seem to work :(
Sorry about that, I had changed my GitHub username. It should be fixed now.
Works great for me. Thanks!!
Legal! Cool!
Amazing script. Thanks!
+99
Works great!! Thanks a lot!
This is a great script. However, there's a minor hiccup: I got
ERROR: While executing gem ... (Gem::InstallError)
gem "bigdecimal" cannot be uninstalled because it is a default gem
Is there a fork that addresses this?
Nice one! I just wanted to remove one gem prefix for all ruby versions and was easy with this.
Just modified
list=`gem list --no-versions`
to
list=`gem list my_stupid_gem_prefix --no-versions`
Works great, thanks!
this== greatness
Wow, thanks for this script!
I am new to Ubuntu and I want to know how do you run this script. Any suggestions?
Works Thanks! Nice Script!
cool 👍
You are a life-saver. Thank you.
:)
I am new to Ubuntu and I want to know how do you run this script. Any suggestions?
@konstantin0s
I am sure you may have found the solution by now but just in case, check this:
https://askubuntu.com/questions/38661/how-do-i-run-sh-files
Thank you!
Thanks. Saved us the trouble
Thanks!
I elaborated a version to cleanup only old versions of the gems:
#!/bin/sh
RBENVPATH=`rbenv root`
echo $RBENVPATH
RUBIES=`ls $RBENVPATH/versions`
for ruby in $RUBIES; do
echo '---------------------------------------'
echo $ruby
rbenv local $ruby
gem cleanup
done
I elaborated a version to cleanup only old versions of the gems:
#!/bin/sh RBENVPATH=`rbenv root` echo $RBENVPATH RUBIES=`ls $RBENVPATH/versions` for ruby in $RUBIES; do echo '---------------------------------------' echo $ruby rbenv local $ruby gem cleanup done
nice script, thank you
Nice script!
Was looking for something like this. Gave me a surprise when I saw who wrote it!
Just used it. Works great!