class Minimart::Mirror::Sources

A collection of Minimart::Mirror::Source

Public Class Methods

new(source_urls = []) click to toggle source

@param [Array<String>] source_urls An array of source URL's specified in the inventory

# File lib/minimart/mirror/sources.rb, line 7
def initialize(source_urls = [])
  source_urls.each { |source_url| add_source(source_url) }
end

Public Instance Methods

each_cookbook(&block) click to toggle source

Iterate over each cookbook defined in each source @yield [Minimart::Mirror::SourceCookbook]

# File lib/minimart/mirror/sources.rb, line 13
def each_cookbook(&block)
  each { |source| source.cookbooks.each(&block) }
end
find_cookbook(name, version) click to toggle source

Find the first cookbook from the avaiable sources with a matching name, and version @param [String] name The name of the cookbook to search for @param [String] version The version of the cookbook to search for

# File lib/minimart/mirror/sources.rb, line 21
def find_cookbook(name, version)
  each do |source|
    cookbook = source.find_cookbook(name, version)
    return cookbook if cookbook
  end

  raise Error::CookbookNotFound, "The cookbook #{name} with the version #{version} could not be found"
end

Private Instance Methods

add_source(source_url) click to toggle source
# File lib/minimart/mirror/sources.rb, line 32
def add_source(source_url)
  self << Source.new(source_url)
end