class ChefCLI::Policyfile::CookbookLoaderWithChefignore
def self.load(name, directory_path)
Chef::CookbookVersion object.
Convenience method to load a cookbook and return a
def self.load(name, directory_path) new(name, directory_path).cookbook_version end
def chefignore
def chefignore @chefignore ||= Chef::Cookbook::Chefignore.new(File.join(directory_path, "chefignore")) end
def cookbook_version
def cookbook_version @cookbook_version ||= loader.cookbook_version end
def initialize(cookbook_name, directory_path)
def initialize(cookbook_name, directory_path) @cookbook_name = cookbook_name @directory_path = directory_path @cookbook_version = nil @loader = nil end
def loader
def loader @loader ||= begin cbvl = Chef::Cookbook::CookbookVersionLoader.new(directory_path, chefignore) cbvl.load! cbvl end end