class ChefCLI::Policyfile::Reports::Upload

Attributes

reused_cbs[R]
ui[R]
uploaded_cbs[R]

Public Class Methods

new(reused_cbs: [], uploaded_cbs: [], ui: nil) click to toggle source
# File lib/chef-cli/policyfile/reports/upload.rb, line 29
def initialize(reused_cbs: [], uploaded_cbs: [], ui: nil)
  @reused_cbs = reused_cbs
  @uploaded_cbs = uploaded_cbs
  @ui = ui

  @justify_name_width = nil
  @justify_version_width = nil
end

Public Instance Methods

cookbook_names() click to toggle source
# File lib/chef-cli/policyfile/reports/upload.rb, line 59
def cookbook_names
  (reused_cbs + uploaded_cbs).map { |e| e.lock.name }
end
cookbook_version_numbers() click to toggle source
# File lib/chef-cli/policyfile/reports/upload.rb, line 63
def cookbook_version_numbers
  (reused_cbs + uploaded_cbs).map { |e| e.lock.version }
end
show() click to toggle source
# File lib/chef-cli/policyfile/reports/upload.rb, line 38
def show
  reused_cbs.each do |cb_with_lock|
    lock = cb_with_lock.lock
    table.print_row("Using", lock.name, lock.version, "(#{lock.identifier[0, 8]})")
  end

  uploaded_cbs.each do |cb_with_lock|
    lock = cb_with_lock.lock
    table.print_row("Uploaded", lock.name, lock.version, "(#{lock.identifier[0, 8]})")
  end
end
table() click to toggle source
# File lib/chef-cli/policyfile/reports/upload.rb, line 50
def table
  @table ||= TablePrinter.new(ui) do |t|
    t.column(%w{ Using Uploaded })
    t.column(cookbook_names)
    t.column(cookbook_version_numbers)
    t.column
  end
end