From 0ae2709dd71eaefe4a316bdbc9e97eaef3c7ae69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Fri, 30 Jun 2023 16:57:39 +0200 Subject: [rubygems/rubygems] When printing frozen errors, print only Gemfile information https://github.com/rubygems/rubygems/commit/93f74abc5f --- lib/bundler/definition.rb | 4 ++-- lib/bundler/source/git.rb | 15 ++++++++++++++- lib/bundler/source/rubygems.rb | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index d7246dadf0..1970782d55 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -394,8 +394,8 @@ module Bundler lock_source = lock_dep.source || sources.default_source next if lock_source.include?(gemfile_source) - gemfile_source_name = dep.source ? gemfile_source.identifier : "no specified source" - lockfile_source_name = lock_dep.source ? lock_source.identifier : "no specified source" + gemfile_source_name = dep.source ? gemfile_source.to_gemfile : "no specified source" + lockfile_source_name = lock_dep.source ? lock_source.to_gemfile : "no specified source" changed << "* #{name} from `#{lockfile_source_name}` to `#{gemfile_source_name}`" end diff --git a/lib/bundler/source/git.rb b/lib/bundler/source/git.rb index 42897813b4..f7ad6057b4 100644 --- a/lib/bundler/source/git.rb +++ b/lib/bundler/source/git.rb @@ -46,6 +46,14 @@ module Bundler out << " specs:\n" end + def to_gemfile + specifiers = %w[ref branch tag submodules glob].map do |opt| + "#{opt}: #{options[opt]}" if options[opt] + end + + uri_with_specifiers(specifiers) + end + def hash [self.class, uri, ref, branch, name, version, glob, submodules].hash end @@ -80,7 +88,12 @@ module Bundler "" end - specifiers = [rev, glob_for_display].compact + uri_with_specifiers([rev, glob_for_display]) + end + + def uri_with_specifiers(specifiers) + specifiers.compact! + suffix = if specifiers.any? " (#{specifiers.join(", ")})" diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index af55ba0f2c..af57acbbc2 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -123,6 +123,7 @@ module Bundler end end alias_method :name, :identifier + alias_method :to_gemfile, :identifier def specs @specs ||= begin -- cgit v1.2.3