Class: ChefDK::Policyfile::Reports::Upload
- Inherits:
-
Object
- Object
- ChefDK::Policyfile::Reports::Upload
- Defined in:
- lib/chef-dk/policyfile/reports/upload.rb
Instance Attribute Summary collapse
-
#reused_cbs ⇒ Object
readonly
Returns the value of attribute reused_cbs.
-
#ui ⇒ Object
readonly
Returns the value of attribute ui.
-
#uploaded_cbs ⇒ Object
readonly
Returns the value of attribute uploaded_cbs.
Instance Method Summary collapse
- #cookbook_names ⇒ Object
- #cookbook_version_numbers ⇒ Object
-
#initialize(reused_cbs: [], uploaded_cbs: [], ui: nil) ⇒ Upload
constructor
A new instance of Upload.
- #show ⇒ Object
- #table ⇒ Object
Constructor Details
#initialize(reused_cbs: [], uploaded_cbs: [], ui: nil) ⇒ Upload
Returns a new instance of Upload.
29 30 31 32 33 34 35 36 |
# File 'lib/chef-dk/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 |
Instance Attribute Details
#reused_cbs ⇒ Object (readonly)
Returns the value of attribute reused_cbs.
25 26 27 |
# File 'lib/chef-dk/policyfile/reports/upload.rb', line 25 def reused_cbs @reused_cbs end |
#ui ⇒ Object (readonly)
Returns the value of attribute ui.
27 28 29 |
# File 'lib/chef-dk/policyfile/reports/upload.rb', line 27 def ui @ui end |
#uploaded_cbs ⇒ Object (readonly)
Returns the value of attribute uploaded_cbs.
26 27 28 |
# File 'lib/chef-dk/policyfile/reports/upload.rb', line 26 def uploaded_cbs @uploaded_cbs end |
Instance Method Details
#cookbook_names ⇒ Object
59 60 61 |
# File 'lib/chef-dk/policyfile/reports/upload.rb', line 59 def cookbook_names (reused_cbs + uploaded_cbs).map { |e| e.lock.name } end |
#cookbook_version_numbers ⇒ Object
63 64 65 |
# File 'lib/chef-dk/policyfile/reports/upload.rb', line 63 def cookbook_version_numbers (reused_cbs + uploaded_cbs).map { |e| e.lock.version } end |
#show ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/chef-dk/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 ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/chef-dk/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 |