Last active
January 2, 2016 05:29
-
-
Save newmen/8257737 to your computer and use it in GitHub Desktop.
This little code is more useful if you doesn't want keep old versions of installed gems
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
`gem list`.split("\n").each do |line| | |
next if line == '' | |
name = line.scan(/^\S+/).first | |
versions = line.scan(/\(([^\)]+)\)/).first.first.split(', ') | |
versions.shift | |
unless versions.empty? | |
versions.each do |version| | |
`gem uninstall #{name} -v #{version} --force` | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment