Class: ChefDK::IdDumper
- Inherits:
-
Object
- Object
- ChefDK::IdDumper
- Defined in:
- lib/chef-dk/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.
12 13 14 15 |
# File 'lib/chef-dk/command/describe_cookbook.rb', line 12 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.
9 10 11 |
# File 'lib/chef-dk/command/describe_cookbook.rb', line 9 def cb_path @cb_path end |
#ui ⇒ Object (readonly)
Returns the value of attribute ui.
10 11 12 |
# File 'lib/chef-dk/command/describe_cookbook.rb', line 10 def ui @ui end |
Instance Method Details
#chefignore ⇒ Object
43 44 45 |
# File 'lib/chef-dk/command/describe_cookbook.rb', line 43 def chefignore @chefignore ||= Chef::Cookbook::Chefignore.new(File.join(cookbook_path, "chefignore")) end |
#cookbook_loader ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/chef-dk/command/describe_cookbook.rb', line 34 def cookbook_loader @cookbook_loader ||= begin loader = Chef::Cookbook::CookbookVersionLoader.new(cookbook_path, chefignore) loader.load! loader end end |
#cookbook_path ⇒ Object
30 31 32 |
# File 'lib/chef-dk/command/describe_cookbook.rb', line 30 def cookbook_path File.(cb_path) end |
#cookbook_version ⇒ Object
26 27 28 |
# File 'lib/chef-dk/command/describe_cookbook.rb', line 26 def cookbook_version @cookbook_version ||= cookbook_loader.cookbook_version end |
#run ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/chef-dk/command/describe_cookbook.rb', line 17 def run id = ChefDK::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 |