lib/berkshelf/resolver.rb in berkshelf-0.1.1 vs lib/berkshelf/resolver.rb in berkshelf-0.1.2

- old
+ new

@@ -77,23 +77,22 @@ # an array of CookbookSources that are currently added to this resolver def sources @sources.collect { |name, source| source } end - # @return [Hash] - # a hash containing package names - in this case Cookbook names - as keys and - # their locked version as values. + # Finds a solution for the currently added sources and their dependencies and + # returns an array of CachedCookbooks. # - # Example: - # { - # "nginx" => 0.101.0, - # "build-essential" => 1.0.2, - # "runit" => 0.15.0, - # "bluepill" => 1.0.4, - # "ohai" => 1.0.2 - # } + # @return [Array<Berkshelf::CachedCookbook>] def resolve - quietly { selector.find_solution(solution_constraints) } + solution = quietly { selector.find_solution(solution_constraints) } + + [].tap do |cached_cookbooks| + solution.each do |name, version| + source = get_source(name) + cached_cookbooks << CachedCookbook.new(source.name, source.local_path, source.metadata) + end + end end # @param [#to_s] source # name of the source to return #