Class: Chef::ChefFS::FileSystem::Repository::ChefRepositoryFileSystemCookbookArtifactDir

Inherits:
ChefRepositoryFileSystemCookbookDir show all
Defined in:
lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb

Instance Attribute Summary

Attributes inherited from ChefRepositoryFileSystemCookbookEntry

#file_path, #name, #parent, #path, #recursive, #ruby_only

Instance Method Summary collapse

Methods inherited from ChefRepositoryFileSystemCookbookDir

#can_have_child?, #can_upload?, #canonical_cookbook_name, canonical_cookbook_name, #chef_object, #children, #create, #dir?, #fs_entry_valid?, #name_valid?, #uploaded_cookbook_version_path, #write

Methods inherited from ChefRepositoryFileSystemCookbookEntry

#can_have_child?, #child, #children, #compare_to, #create_child, #delete, #dir?, #exists?, #initialize, #path_for_printing, #read, #root, #write, #write_pretty_json

Constructor Details

This class inherits a constructor from Chef::ChefFS::FileSystem::Repository::ChefRepositoryFileSystemCookbookEntry

Instance Method Details

#cookbook_versionObject

Override from parent


27
28
29
30
31
32
33
34
35
36
# File 'lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb', line 27

def cookbook_version
  loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, parent.chefignore)
  cookbook_name, _dash, identifier = name.rpartition("-")
  # KLUDGE: We shouldn't have to use instance_variable_set
  loader.instance_variable_set(:@cookbook_name, cookbook_name)
  loader.load_cookbooks
  cookbook_version = loader.cookbook_version
  cookbook_version.identifier = identifier
  cookbook_version
end