class Bundler::Resolver
def error_message
def error_message output = errors.inject("") do |o, (conflict, (origin, requirement))| # origin is the SpecSet of specs from the Gemfile that is conflicted with if origin o << %{Bundler could not find compatible versions for gem "#{origin.name}":\n} o << " In Gemfile:\n" o << gem_message(requirement) # If the origin is a LockfileParser, it does not respond_to :required_by unless origin.respond_to?(:required_by) && required_by = origin.required_by.first o << " In snapshot (Gemfile.lock):\n" end o << gem_message(origin) # origin is nil if the required gem and version cannot be found in any of # the specified sources else # if the gem cannot be found because of a version conflict between lockfile and gemfile, # print a useful error that suggests running `bundle update`, which may fix things # # @base is a SpecSet of the gems in the lockfile # conflict is the name of the gem that could not be found if locked = @base[conflict].first o << "Bundler could not find compatible versions for gem #{conflict.inspect}:\n" o << " In snapshot (Gemfile.lock):\n" o << " #{clean_req(locked)}\n\n" o << " In Gemfile:\n" o << gem_message(requirement) o << "Running `bundle update` will rebuild your snapshot from scratch, using only\n" o << "the gems in your Gemfile, which may resolve the conflict.\n" # the rest of the time, the gem cannot be found because it does not exist in the known sources else if requirement.required_by.first o << "Could not find gem '#{clean_req(requirement)}', required by '#{clean_req(requirement.required_by.first)}', in any of the sources\n" else o << "Could not find gem '#{clean_req(requirement)} in any of the sources\n" end end end end end