summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-07 23:47:37 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-07 23:47:37 +0900
commit91f831ac17c8ff58d536ce1fa320294bb477d2ae (patch)
treee8ce810068739d08716ee5f3fe33cf469a7875ae
parente025113d71ca208255203f78cc85e9efa25bb23f (diff)
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.
-rw-r--r--tool/gem-unpack.rb2
-rwxr-xr-xtool/rbinstall.rb11
2 files changed, 9 insertions, 4 deletions
diff --git a/tool/gem-unpack.rb b/tool/gem-unpack.rb
index 0ddcea0704..6fb80d3bbe 100644
--- a/tool/gem-unpack.rb
+++ b/tool/gem-unpack.rb
@@ -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
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index b1f657a69b..ed883f6085 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -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}"