[rubygems/rubygems] Unconditionally set installed_by_version

It has been supported since RubyGems 2.2.0 via https://github.com/rubygems/rubygems/commit/4525e45a4d45

Signed-off-by: Samuel Giddins <segiddins@segiddins.me>

https://github.com/rubygems/rubygems/commit/bf39c583e8
This commit is contained in:
Samuel Giddins 2024-09-19 15:10:40 -07:00 committed by git
parent 7836626f92
commit 43e3416b70
6 changed files with 5 additions and 10 deletions

View File

@ -131,7 +131,7 @@ module Bundler
Bundler::Index.build do |index| Bundler::Index.build do |index|
files.each do |file| files.each do |file|
next unless spec = Bundler.load_gemspec(file) next unless spec = Bundler.load_gemspec(file)
Bundler.rubygems.set_installed_by_version(spec) spec.installed_by_version = Gem::VERSION
spec.source = self spec.source = self
Bundler.rubygems.validate(spec) Bundler.rubygems.validate(spec)

View File

@ -61,11 +61,6 @@ module Bundler
nil nil
end end
def set_installed_by_version(spec, installed_by_version = Gem::VERSION)
return unless spec.respond_to?(:installed_by_version=)
spec.installed_by_version = Gem::Version.create(installed_by_version)
end
def spec_missing_extensions?(spec, default = true) def spec_missing_extensions?(spec, default = true)
return spec.missing_extensions? if spec.respond_to?(:missing_extensions?) return spec.missing_extensions? if spec.respond_to?(:missing_extensions?)

View File

@ -299,7 +299,7 @@ module Bundler
# The gemspecs we cache should already be evaluated. # The gemspecs we cache should already be evaluated.
spec = Bundler.load_gemspec(spec_path) spec = Bundler.load_gemspec(spec_path)
next unless spec next unless spec
Bundler.rubygems.set_installed_by_version(spec) spec.installed_by_version = Gem::VERSION
Bundler.rubygems.validate(spec) Bundler.rubygems.validate(spec)
File.open(spec_path, "wb") {|file| file.write(spec.to_ruby) } File.open(spec_path, "wb") {|file| file.write(spec.to_ruby) }
end end

View File

@ -148,7 +148,7 @@ module Bundler
def load_gemspec(file) def load_gemspec(file)
return unless spec = Bundler.load_gemspec(file) return unless spec = Bundler.load_gemspec(file)
Bundler.rubygems.set_installed_by_version(spec) spec.installed_by_version = Gem::VERSION
spec spec
end end

View File

@ -2472,7 +2472,7 @@ class Gem::Specification < Gem::BasicSpecification
if @installed_by_version if @installed_by_version
result << nil result << nil
result << " s.installed_by_version = #{ruby_code Gem::VERSION} if s.respond_to? :installed_by_version" result << " s.installed_by_version = #{ruby_code Gem::VERSION}"
end end
unless dependencies.empty? unless dependencies.empty?

View File

@ -2368,7 +2368,7 @@ Gem::Specification.new do |s|
s.rubygems_version = "#{Gem::VERSION}".freeze s.rubygems_version = "#{Gem::VERSION}".freeze
s.summary = "this is a summary".freeze s.summary = "this is a summary".freeze
s.installed_by_version = "#{Gem::VERSION}".freeze if s.respond_to? :installed_by_version s.installed_by_version = "#{Gem::VERSION}".freeze
s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION} s.specification_version = #{Gem::Specification::CURRENT_SPECIFICATION_VERSION}