Class: ChefCLI::Policyfile::CookbookLoaderWithChefignore
- Inherits:
-
Object
- Object
- ChefCLI::Policyfile::CookbookLoaderWithChefignore
- Defined in:
- lib/chef-cli/policyfile/read_cookbook_for_compat_mode_upload.rb
Instance Attribute Summary collapse
-
#cookbook_name ⇒ Object
readonly
Returns the value of attribute cookbook_name.
-
#directory_path ⇒ Object
readonly
Returns the value of attribute directory_path.
Class Method Summary collapse
-
.load(name, directory_path) ⇒ Object
Convenience method to load a cookbook and return a Chef::CookbookVersion object.
Instance Method Summary collapse
- #chefignore ⇒ Object
- #cookbook_version ⇒ Object
-
#initialize(cookbook_name, directory_path) ⇒ CookbookLoaderWithChefignore
constructor
A new instance of CookbookLoaderWithChefignore.
- #loader ⇒ Object
Constructor Details
#initialize(cookbook_name, directory_path) ⇒ CookbookLoaderWithChefignore
Returns a new instance of CookbookLoaderWithChefignore.
38 39 40 41 42 43 44 |
# File 'lib/chef-cli/policyfile/read_cookbook_for_compat_mode_upload.rb', line 38 def initialize(cookbook_name, directory_path) @cookbook_name = cookbook_name @directory_path = directory_path @cookbook_version = nil @loader = nil end |
Instance Attribute Details
#cookbook_name ⇒ Object (readonly)
Returns the value of attribute cookbook_name.
35 36 37 |
# File 'lib/chef-cli/policyfile/read_cookbook_for_compat_mode_upload.rb', line 35 def cookbook_name @cookbook_name end |
#directory_path ⇒ Object (readonly)
Returns the value of attribute directory_path.
36 37 38 |
# File 'lib/chef-cli/policyfile/read_cookbook_for_compat_mode_upload.rb', line 36 def directory_path @directory_path end |
Class Method Details
.load(name, directory_path) ⇒ Object
Convenience method to load a cookbook and return a Chef::CookbookVersion object.
31 32 33 |
# File 'lib/chef-cli/policyfile/read_cookbook_for_compat_mode_upload.rb', line 31 def self.load(name, directory_path) new(name, directory_path).cookbook_version end |
Instance Method Details
#chefignore ⇒ Object
59 60 61 |
# File 'lib/chef-cli/policyfile/read_cookbook_for_compat_mode_upload.rb', line 59 def chefignore @chefignore ||= Chef::Cookbook::Chefignore.new(File.join(directory_path, "chefignore")) end |
#cookbook_version ⇒ Object
46 47 48 |
# File 'lib/chef-cli/policyfile/read_cookbook_for_compat_mode_upload.rb', line 46 def cookbook_version @cookbook_version ||= loader.cookbook_version end |
#loader ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/chef-cli/policyfile/read_cookbook_for_compat_mode_upload.rb', line 50 def loader @loader ||= begin cbvl = Chef::Cookbook::CookbookVersionLoader.new(directory_path, chefignore) cbvl.load! cbvl end end |