1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Extract gemspec to versioned file

Not to be overwritten by test-bundler-prepare.  gem files often
contain useless gemspec files which have not been processed.
This commit is contained in:
Nobuyoshi Nakada 2020-12-07 23:47:37 +09:00
parent e025113d71
commit 91f831ac17
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 9 additions and 4 deletions

View file

@ -10,7 +10,7 @@ def Gem.unpack(file, dir = nil)
target = spec.full_name
target = File.join(dir, target) if dir
pkg.extract_files target
spec_file = File.join(target, "#{spec.name}.gemspec")
spec_file = File.join(target, "#{spec.name}-#{spec.version}.gemspec")
open(spec_file, 'wb') do |f|
f.print spec.to_ruby
end

View file

@ -965,9 +965,14 @@ install?(:ext, :comm, :gem, :'bundled-gems') do
next if /^\s*(?:#|$)/ =~ name
next unless /^(\S+)\s+(\S+).*/ =~ name
gem_name = "#$1-#$2"
path = "#{srcdir}/.bundle/gems/#{gem_name}/#$1.gemspec"
next unless File.exist?(path)
spec = load_gemspec(path, true)
path = "#{srcdir}/.bundle/gems/#{gem_name}/#{gem_name}.gemspec"
if File.exist?(path)
spec = load_gemspec(path)
else
path = "#{srcdir}/.bundle/gems/#{gem_name}/#$1.gemspec"
next unless File.exist?(path)
spec = load_gemspec(path, true)
end
next unless spec.platform == Gem::Platform::RUBY
next unless spec.full_name == gem_name
spec.extension_dir = "#{extensions_dir}/#{spec.full_name}"