class Minimart::InventoryRequirement::LocalPathRequirement
A requirement to a cookbook found in the local file system
Attributes
path[R]
@return [String] the path to the cookbook
Public Class Methods
new(name, opts)
click to toggle source
@param [String] name The name of the cookbook @param [Hash] opts @option opts [String] path The path to the cookbook
Calls superclass method
Minimart::InventoryRequirement::BaseRequirement::new
# File lib/minimart/inventory_requirement/local_path_requirement.rb, line 13 def initialize(name, opts) super @path = opts[:path] end
Public Instance Methods
explicit_location?()
click to toggle source
Local path requirements explicitly define their location, so this method will return true. @return [Boolean] TRUE
# File lib/minimart/inventory_requirement/local_path_requirement.rb, line 20 def explicit_location? true end
matching_source?(metadata)
click to toggle source
# File lib/minimart/inventory_requirement/local_path_requirement.rb, line 33 def matching_source?(metadata) if metadata.has_key?('metadata_version') && metadata['metadata_version'] == '2.0' metadata['source_type'] == 'local_path' && metadata['path'] == @path else metadata['source_type'] == 'local_path' end end
to_hash()
click to toggle source
Convert this requirement to a hash @return [Hash]
Calls superclass method
Minimart::InventoryRequirement::BaseRequirement#to_hash
# File lib/minimart/inventory_requirement/local_path_requirement.rb, line 26 def to_hash result = super result[:path] = @path result[:source_type] = :local_path result end
Private Instance Methods
download_cookbook(&block)
click to toggle source
# File lib/minimart/inventory_requirement/local_path_requirement.rb, line 44 def download_cookbook(&block) Configuration.output.puts "-- Fetching '#{name}' from path '#{path}'" block.call(Minimart::Cookbook.from_path(path)) end