class Berkshelf::Resolver::Graph

def populate(sources)

Parameters:
  • sources (Array, Berkshelf::Source) --
def populate(sources)
  universe(sources).each do |cookbook|
    next if has_artifact?(cookbook.name, cookbook.version)
    artifact(cookbook.name, cookbook.version)
    cookbook.dependencies.each do |dependency, constraint|
      constraint = nil if constraint.empty?
      artifact(cookbook.name, cookbook.version).depends(dependency, constraint)
    end
  end
end

def populate_local(cookbook)

Returns:
  • (Hash) -

Parameters:
  • cookbook (Berkshelf::CachedCookbook) --
def populate_local(cookbook)
  name    = cookbook.cookbook_name
  version = cookbook.version
  artifact(name, version)
  cookbook.dependencies.each do |dependency, constraint|
    constraint = nil if constraint.empty?
    artifact(name, version).depends(dependency, constraint)
  end
end

def populate_store(store = nil)

Parameters:
  • store (Berkshelf::CookbookStore) --
def populate_store(store = nil)
  store ||= Berkshelf::CookbookStore.instance
  store.cookbooks.each do |cookbook|
    artifact(cookbook.cookbook_name, cookbook.version)
    cookbook.dependencies.each do |dependency, constraint|
      constraint = nil if constraint.empty?
      artifact(cookbook.cookbook_name, cookbook.version).depends(dependency, constraint)
    end
  end
end

def universe(sources)

Returns:
  • (Array) -

Parameters:
  • sources (Array, Berkshelf::Source) --
def universe(sources)
  cookbooks = []
  Array(sources).each { |source| cookbooks |= source.universe }
  cookbooks
end