def error_message
errors.inject("") do |o, (conflict, (origin, requirement))|
if origin
o << %{Bundler could not find compatible versions for gem "#{origin.name}":\n}
o << " In Gemfile:\n"
o << gem_message(requirement)
if origin.name == "bundler"
o << " Current Bundler version:\n"
other_bundler_required = !requirement.requirement.satisfied_by?(origin.version)
elsif !origin.respond_to?(:required_by) || !(origin.required_by.first)
o << " In snapshot (Gemfile.lock):\n"
end
o << gem_message(origin)
if origin.name == "bundler" && other_bundler_required
o << "This Gemfile requires a different version of Bundler.\n"
o << "Perhaps you need to update Bundler by running `gem install bundler`?"
end
else
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"
else
if requirement.required_by.first
o << "Could not find gem '#{clean_req(requirement)}', which is required by "
o << "gem '#{clean_req(requirement.required_by.first)}', in any of the sources."
else
o << "Could not find gem '#{clean_req(requirement)} in any of the sources\n"
end
end
end
o
end
end