class Chef::Cookbook::FileVendor
Chef::Cookbook::FileVendor¶ ↑
This class handles fetching of cookbook files based on specificity.
Public Class Methods
create_from_manifest(manifest)
click to toggle source
Factory method that creates the appropriate kind of Cookbook::FileVendor to serve the contents of the manifest
# File lib/chef/cookbook/file_vendor.rb, line 54 def self.create_from_manifest(manifest) if @vendor_class.nil? raise "Must configure FileVendor to use a specific implementation before creating an instance" end @vendor_class.new(manifest, @initialization_options) end
fetch_from_disk(cookbook_paths)
click to toggle source
# File lib/chef/cookbook/file_vendor.rb, line 37 def self.fetch_from_disk(cookbook_paths) @vendor_class = FileSystemFileVendor @initialization_options = cookbook_paths end
fetch_from_remote(http_client)
click to toggle source
Configures FileVendor to use the RemoteFileVendor implementation. After calling this, subsequent calls to ::create_from_manifest will return a RemoteFileVendor object initialized with the given http_client
# File lib/chef/cookbook/file_vendor.rb, line 32 def self.fetch_from_remote(http_client) @vendor_class = RemoteFileVendor @initialization_options = http_client end
initialization_options()
click to toggle source
# File lib/chef/cookbook/file_vendor.rb, line 48 def self.initialization_options @initialization_options end
vendor_class()
click to toggle source
Returns the implementation class that is currently configured, or `nil` if one has not been configured yet.
# File lib/chef/cookbook/file_vendor.rb, line 44 def self.vendor_class @vendor_class end
Public Instance Methods
get_filename(filename)
click to toggle source
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.
# File lib/chef/cookbook/file_vendor.rb, line 65 def get_filename(filename) raise NotImplemented, "Subclasses must implement this method" end