require 'minimart/utils/http' module Minimart module Mirror # Source represents a single remote source to fetch cookbooks from. # Each source is specified in the inventory using the 'sources' key. class Source # @return [String] The URL for this source attr_accessor :base_url # @param [String] base_url The URL for this source def initialize(base_url) @base_url = base_url end # Search through the cookbooks available at this source, and return # the relevant version if it is available. # @return [Minimart::Mirror::SourceCookbook] def find_cookbook(cookbook_name, version) cookbooks.find do |cookbook| cookbook.name == cookbook_name && cookbook.version == version end end # Query this source for it's available cookbooks using the '/universe' endpoint. # @return [Array