Class: Chef::ChefFS::FileSystem::Repository::ChefRepositoryFileSystemVersionedCookbookDir

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

Instance Attribute Summary

Attributes inherited from ChefRepositoryFileSystemCookbookEntry

#recursive, #ruby_only

Attributes inherited from FileSystemEntry

#file_path

Attributes inherited from BaseFSObject

#name, #parent, #path

Instance Method Summary collapse

Methods inherited from ChefRepositoryFileSystemCookbookDir

#can_have_child?, #can_upload?, #canonical_cookbook_name, canonical_cookbook_name, #chef_object, #children, #uploaded_cookbook_version_path

Methods inherited from ChefRepositoryFileSystemCookbookEntry

#can_have_child?, #children, #initialize, #write_pretty_json

Methods inherited from ChefRepositoryFileSystemEntry

#can_have_child?, #chef_object, #data_handler, #initialize, #minimize, #write, #write_pretty_json, #write_pretty_json=

Methods inherited from FileSystemEntry

#children, #create_child, #delete, #dir?, #exists?, #initialize, #path_for_printing, #read, #write

Methods inherited from BaseFSDir

#can_have_child?, #dir?, #empty?, #initialize

Methods inherited from BaseFSObject

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

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
37
# File 'lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb', line 27

def cookbook_version
  loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, parent.chefignore)
  # We need the canonical cookbook name if we are using versioned cookbooks, but we don't
  # want to spend a lot of time adding code to the main Chef libraries
  canonical_name = canonical_cookbook_name(File.basename(file_path))
  raise "When versioned_cookbooks mode is on, cookbook #{file_path} must match format <cookbook_name>-x.y.z" unless canonical_name
  # KLUDGE: We shouldn't have to use instance_variable_set
  loader.instance_variable_set(:@cookbook_name, canonical_name)
  loader.load_cookbooks
  loader.cookbook_version
end