Created
February 18, 2011 20:02
-
-
Save judofyr/834302 to your computer and use it in GitHub Desktop.
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
gems = Hash.new(0) | |
gems_size = Hash.new(0) | |
total = 0 | |
`du -ks ~/.rvm/gems/*/gems/*`.each_line do |line| | |
size = line[/\d+/].to_i | |
name = line[/\/([^\/\n]+)$/, 1] | |
gems[name] += 1 | |
gems_size[name] = size | |
total += size | |
end | |
bloats = 0 | |
length = gems.keys.map { |a| a.length }.sort.last | |
gems.each do |name, num| | |
size = gems_size[name] | |
bloat = (num - 1) * size | |
bloats += bloat | |
puts "#{num} of #{name}".ljust(length + 5) + "Size: #{size}kB" | |
end | |
puts | |
puts " Total gems: #{total / 1024}MB" | |
puts " Total bloat: #{bloats / 1024}MB" | |
puts " #{100*bloats/total}% of your gems are duplicates." |
Well, it only checks if you have duplicate gems in your RVM installation, so if you don't use RVM it won't work.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
“No such file or directory” when I run this in OS X