Class: Gl::Registry
- Inherits:
-
Thor
- Object
- Thor
- Gl::Registry
- Defined in:
- lib/gl/cli/registry.rb
Instance Method Summary collapse
Instance Method Details
#list ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/gl/cli/registry.rb', line 29 def list project = Gl.current_project table = TTY::Table.new(header: %w[Registry Tag Image_ID Created_at Size]) do |table| registries.each do |registry| = Gitlab.(project, registry.id).auto_paginate = .map { |tag| Gitlab.registry_repository_tag(project, registry.id, tag.name) } .sort_by { |tag| -DateTime.parse(tag.created_at).to_time.to_i }.each do |tag| table << [registry.path, tag.name, tag.short_revision, tag.created_at, "#{(tag.total_size / 1024.0 / 1024.0).round(2)} MB"] rescue Gitlab::Error::NotFound next end end end puts table.render(:ascii, alignments: %i[left right], padding: [0, 1]) end |
#status ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/gl/cli/registry.rb', line 6 def status project = Gl.current_project table = TTY::Table.new(header: %w[Registry Tags Size]) do |table| registries.each do |registry| = Gitlab.(project, registry.id).auto_paginate next if .empty? = .map do |tag| Gitlab.registry_repository_tag(project, registry.id, tag.name) rescue Gitlab::Error::NotFound next end = .flatten.compact.map(&:total_size).inject(0) { |sum, x| sum + x } table << [registry.path, .count, "#{( / 1024.0 / 1024.0).round(2)} MB"] end end puts table.render(:ascii, alignments: %i[left right], padding: [0, 1]) end |