Skip to content

Instantly share code, notes, and snippets.

@alhafoudh
Created September 6, 2022 14:01
Show Gist options
  • Save alhafoudh/6aad27c3118de9dbad5c309272bc0ee1 to your computer and use it in GitHub Desktop.
Save alhafoudh/6aad27c3118de9dbad5c309272bc0ee1 to your computer and use it in GitHub Desktop.
Project.all.map do |p|
[
p,
total_size = p.container_repositories.reduce(0) do | acc, cr |
acc + cr.tags.reduce(0) do |acc,t| acc + ((t.total_size || 0) / 1024.0 / 1024.0)
end
end
]
end.sort_by(&:last).reverse.map do |(p, total_size)|
printf "%10.2f %s\n", total_size, p.name
end;nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment