-
-
Save mpmuc84/a1b42aee7e20ed33982d68af17bf5093 to your computer and use it in GitHub Desktop.
Revisions
-
Nathan Lilienthal revised this gist
Feb 27, 2013 . 1 changed file with 3 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,14 @@ #!/usr/bin/env ruby # Remove all gems EXCEPT defaults :) `gem list -d`.split(/\n\n^(?=\w)/).each do |data| match = data.match(/(?<name>([^\s]+)) \((?<versions>.*)\)/) name = match[:name] versions = match[:versions].split(', ') if match = data.match(/^.*\(([\d\.]*),? ?default\): .*$/) next if match[1].empty? # it's the only version if this match is empty versions.delete(match[1] || versions[0]) end versions.each { |v| system "gem uninstall -Ix #{name} -v #{v}" } -
Nathan Lilienthal revised this gist
Feb 27, 2013 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,9 +9,9 @@ data.split(/\n\n^(?=\w)/).each do |data| name = match[:name] versions = match[:versions].split(', ') if match = data.match(/^.*\(([\d\.]*),? ?default\): .*$/) next if match[1].empty? default_version = match[1] || versions[0] versions.delete(default_version) end -
Nathan Lilienthal created this gist
Feb 26, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #!/usr/bin/env ruby # Remove all gems EXCEPT defaults :) data = `gem list -d` defaults = [] data.split(/\n\n^(?=\w)/).each do |data| match = data.match(/(?<name>([^\s]+)) \((?<versions>.*)\)/) name = match[:name] versions = match[:versions].split(', ') if match = data.match(/^.*\((.*)default\): .*$/) matched_version = match[1].gsub(', ', '') default_version = matched_version.empty? ? versions[0] : matched_version versions.delete(default_version) end versions.each { |v| system "gem uninstall -Ix #{name} -v #{v}" } end