Created
October 2, 2008 09:44
-
-
Save mudge/14328 to your computer and use it in GitHub Desktop.
Display orphan gems (those that are not depended upon).
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
#!/usr/bin/env ruby | |
gems = {} | |
`gem dependency -R`.split("\n\n").each do |gem| | |
unless gem["Used by"] | |
version = gem[/\d+\.\d+\.\d+$/] | |
name = gem[4..-1][/^.*(?=-\d\.)/] | |
(gems[name] ||= []) << version | |
end | |
end | |
gems.sort_by { |n,v| n.downcase }.each do |name, versions| | |
puts "#{name} (#{versions.join(", ")})\n" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment