Class: PackageCloud::CLI::Distro

Inherits:
Base
  • Object
show all
Defined in:
lib/package_cloud/cli/distro.rb

Instance Method Summary collapse

Instance Method Details

#list(package_type) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/package_cloud/cli/distro.rb', line 6

def list(package_type)
  distros = nil
  measurement = Benchmark.measure {
    distros = client.distributions[package_type]
  }
  $logger.debug("distro list request timing: #{measurement}")
  if distros
    puts "Listing distributions for #{package_type}:"
    distros.each do |distro|
      next if (distro["index_name"] == "any" || distro["index_name"] == "rpm_any")
      puts "\n    #{parse_display_name(distro["display_name"])} (#{distro["index_name"]}):\n\n"
      distro["versions"].each do |ver|
        puts "        #{parse_version_name(ver["display_name"])} (#{ver["index_name"]})"
      end
    end

    puts "\nIf you don't see your distribution or version here, email us at [email protected]."
  else
    puts "No distributions exist for #{package_type}.".color(:red)
    puts "That either means that we don't support #{package_type} or that it doesn't require a distribution/version."
    exit(1)
  end
end