Skip to content

Commit

Permalink
[rubygems/rubygems] When printing frozen errors, print only Gemfile i…
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez authored and hsbt committed Jul 4, 2023
1 parent 0fcb4c6 commit 0ae2709
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/bundler/definition.rb
Expand Up @@ -394,8 +394,8 @@ def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
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

Expand Down
15 changes: 14 additions & 1 deletion lib/bundler/source/git.rb
Expand Up @@ -46,6 +46,14 @@ def to_lock
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
Expand Down Expand Up @@ -80,7 +88,12 @@ def to_s
""
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(", ")})"
Expand Down
1 change: 1 addition & 0 deletions lib/bundler/source/rubygems.rb
Expand Up @@ -123,6 +123,7 @@ def identifier
end
end
alias_method :name, :identifier
alias_method :to_gemfile, :identifier

def specs
@specs ||= begin
Expand Down

0 comments on commit 0ae2709

Please sign in to comment.