ChefRepositoryFileSystemEntry works just like FileSystemEntry, except it pretends files in /cookbooks/chefignore don't exist and it can inflate Chef objects
# File lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb, line 35 def initialize(name, parent, file_path = nil) super(name, parent, file_path) # Load /cookbooks/chefignore if name == "cookbooks" && path == "/cookbooks" # We check name first because it's a faster fail than path @chefignore = Chef::Cookbook::Chefignore.new(self.file_path) # If we are a cookbook or a cookbook subdirectory, empty directories # underneath us are ignored (since they cannot be uploaded) elsif parent && parent.name === "cookbooks" && parent.path == "/cookbooks" @ignore_empty_directories = true elsif parent && parent.ignore_empty_directories? @ignore_empty_directories = true end end
# File lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb, line 55 def chef_object begin if parent.path == "/cookbooks" loader = Chef::Cookbook::CookbookVersionLoader.new(file_path, parent.chefignore) loader.load_cookbooks return loader.cookbook_version end # Otherwise the information to inflate the object, is in the file (json_class). return Chef::JSONCompat.from_json(read) rescue Chef::Log.error("Could not read #{path_for_printing} into a Chef object: #{$!}") end nil end
# File lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb, line 71 def children @children ||= Dir.entries(file_path).select { |entry| entry != '.' && entry != '..' && !ignored?(entry) }. map { |entry| ChefRepositoryFileSystemEntry.new(entry, self) } end
Generated with the Darkfish Rdoc Generator 2.