Class: ChefCLI::IdDumper
- Inherits:
-
Object
- Object
- ChefCLI::IdDumper
- Defined in:
- lib/chef-cli/command/describe_cookbook.rb
Instance Attribute Summary collapse
-
#cb_path ⇒ Object
readonly
Returns the value of attribute cb_path.
-
#ui ⇒ Object
readonly
Returns the value of attribute ui.
Instance Method Summary collapse
- #chefignore ⇒ Object
- #cookbook_loader ⇒ Object
- #cookbook_path ⇒ Object
- #cookbook_version ⇒ Object
-
#initialize(ui, cb_relpath) ⇒ IdDumper
constructor
A new instance of IdDumper.
- #run ⇒ Object
Constructor Details
#initialize(ui, cb_relpath) ⇒ IdDumper
Returns a new instance of IdDumper.
29 30 31 32 |
# File 'lib/chef-cli/command/describe_cookbook.rb', line 29 def initialize(ui, cb_relpath) @ui = ui @cb_path = cb_relpath end |
Instance Attribute Details
#cb_path ⇒ Object (readonly)
Returns the value of attribute cb_path.
26 27 28 |
# File 'lib/chef-cli/command/describe_cookbook.rb', line 26 def cb_path @cb_path end |
#ui ⇒ Object (readonly)
Returns the value of attribute ui.
27 28 29 |
# File 'lib/chef-cli/command/describe_cookbook.rb', line 27 def ui @ui end |
Instance Method Details
#chefignore ⇒ Object
60 61 62 |
# File 'lib/chef-cli/command/describe_cookbook.rb', line 60 def chefignore @chefignore ||= Chef::Cookbook::Chefignore.new(File.join(cookbook_path, "chefignore")) end |
#cookbook_loader ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/chef-cli/command/describe_cookbook.rb', line 51 def cookbook_loader @cookbook_loader ||= begin loader = Chef::Cookbook::CookbookVersionLoader.new(cookbook_path, chefignore) loader.load! loader end end |
#cookbook_path ⇒ Object
47 48 49 |
# File 'lib/chef-cli/command/describe_cookbook.rb', line 47 def cookbook_path File.(cb_path) end |
#cookbook_version ⇒ Object
43 44 45 |
# File 'lib/chef-cli/command/describe_cookbook.rb', line 43 def cookbook_version @cookbook_version ||= cookbook_loader.cookbook_version end |
#run ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/chef-cli/command/describe_cookbook.rb', line 34 def run id = ChefCLI::CookbookProfiler::Identifiers.new(cookbook_version) ui.msg "Path: #{cookbook_path}" ui.msg "SemVer version: #{id.semver_version}" ui.msg "Identifier: #{id.content_identifier}" ui.msg "File fingerprints:" ui.msg id.fingerprint_text end |