class ChefDK::Policyfile::CookbookLoaderWithChefignore

Attributes

cookbook_name[R]
directory_path[R]

Public Class Methods

load(name, directory_path) click to toggle source

Convenience method to load a cookbook and return a Chef::CookbookVersion object.

# File lib/chef-dk/policyfile/read_cookbook_for_compat_mode_upload.rb, line 31
def self.load(name, directory_path)
  new(name, directory_path).cookbook_version
end
new(cookbook_name, directory_path) click to toggle source
# File lib/chef-dk/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

Public Instance Methods

chefignore() click to toggle source
# File lib/chef-dk/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() click to toggle source
# File lib/chef-dk/policyfile/read_cookbook_for_compat_mode_upload.rb, line 46
def cookbook_version
  @cookbook_version ||= loader.cookbook_version
end
loader() click to toggle source
# File lib/chef-dk/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