class Bundler::Definition

def materialize(dependencies)

def materialize(dependencies)
  specs = resolve.materialize(dependencies)
  missing_specs = specs.missing_specs
  if missing_specs.any?
    missing_specs.each do |s|
      locked_gem = @locked_specs[s.name].last
      next if locked_gem.nil? || locked_gem.version != s.version || sources.local_mode?
      raise GemNotFound, "Your bundle is locked to #{locked_gem} from #{locked_gem.source}, but that version can " \
                         "no longer be found in that source. That means the author of #{locked_gem} has removed it. " \
                         "You'll need to update your bundle to a version other than #{locked_gem} that hasn't been " \
                         "removed in order to install."
    end
    missing_specs_list = missing_specs.group_by(&:source).map do |source, missing_specs_for_source|
      "#{missing_specs_for_source.map(&:full_name).join(", ")} in #{source}"
    end
    raise GemNotFound, "Could not find #{missing_specs_list.join(" nor ")}"
  end
  incomplete_specs = specs.incomplete_specs
  loop do
    break if incomplete_specs.empty?
    Bundler.ui.debug("The lockfile does not have all gems needed for the current platform though, Bundler will still re-resolve dependencies")
    sources.remote!
    resolution_packages.delete(incomplete_specs)
    @resolve = start_resolution
    specs = resolve.materialize(dependencies)
    still_incomplete_specs = specs.incomplete_specs
    if still_incomplete_specs == incomplete_specs
      package = resolution_packages.get_package(incomplete_specs.first.name)
      resolver.raise_not_found! package
    end
    incomplete_specs = still_incomplete_specs
  end
  bundler = sources.metadata_source.specs.search(["bundler", Bundler.gem_version]).last
  specs["bundler"] = bundler
  specs
end