class Berkshelf::Installer
def install_from_universe
-
(Array
-Array >)
def install_from_universe Berkshelf.log.info "Installing from universe" dependencies = lockfile.graph.locks.values + berksfile.dependencies dependencies = dependencies.inject({}) do |hash, dependency| # Fancy way of ensuring no duplicate dependencies are used... hash[dependency.name] ||= dependency hash end.values download_locations(dependencies) Berkshelf.log.debug " Creating a resolver" resolver = Resolver.new(berksfile, dependencies) # Unlike when installing from the lockfile, we _always_ need to build # the universe when installing from the universe... duh build_universe # Add any explicit dependencies for already-downloaded cookbooks (like # path locations) dependencies.each do |dependency| if dependency.location cookbook = dependency.cached_cookbook Berkshelf.log.debug " Adding explicit dependency on #{cookbook}" resolver.add_explicit_dependencies(cookbook) end end Berkshelf.log.debug " Starting resolution..." futures = resolver.resolve.sort.map { |dependency| Concurrent::Future.execute(executor: pool) { worker.install(dependency) } } cookbooks = futures.map(&:value) rejects = futures.select(&:rejected?) raise rejects.first.reason unless rejects.empty? [dependencies, cookbooks] end