Class: Chef::Cookbook::FileVendor

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/cookbook/file_vendor.rb

Overview

Chef::Cookbook::FileVendor

This class handles fetching of cookbook files based on specificity.

Direct Known Subclasses

FileSystemFileVendor, RemoteFileVendor

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_from_manifest(manifest) ⇒ Object

Factory method that creates the appropriate kind of Cookbook::FileVendor to serve the contents of the manifest



33
34
35
36
# File 'lib/chef/cookbook/file_vendor.rb', line 33

def self.create_from_manifest(manifest)
  raise "Must call Chef::Cookbook::FileVendor.on_create before calling create_from_manifest factory" unless defined?(@instance_creator)
  @instance_creator.call(manifest)
end

.on_create(&block) ⇒ Object



27
28
29
# File 'lib/chef/cookbook/file_vendor.rb', line 27

def self.on_create(&block)
  @instance_creator = block
end

Instance Method Details

#get_filename(filename) ⇒ Object

Gets the on-disk location for the given cookbook file.

Subclasses are responsible for determining exactly how the files are obtained and where they are stored.

Raises:

  • (NotImplemented)


42
43
44
# File 'lib/chef/cookbook/file_vendor.rb', line 42

def get_filename(filename)
  raise NotImplemented, "Subclasses must implement this method"
end