summaryrefslogtreecommitdiff
path: root/tool/gem-unpack.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-07-13 18:58:32 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-07-14 09:00:13 +0900
commita2c66f52f402cb58372e271226f3341065561e53 (patch)
tree1163eaadd9bf06f52f4db4465b9b04b5a214f615 /tool/gem-unpack.rb
parente1a4e44f14482814a0540ae0a4b31d858ff56f53 (diff)
downloadruby-a2c66f52f402cb58372e271226f3341065561e53.tar.gz
Make dependency-free gemspec files
The default gems have not been installed yet in the build directory, bundled gems depending on them can not work. As those dependencies should be usable there even without rubygems, make temporary gemspec files without the dependencies, and use them in the build directory.
Diffstat (limited to 'tool/gem-unpack.rb')
-rw-r--r--tool/gem-unpack.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/tool/gem-unpack.rb b/tool/gem-unpack.rb
index 16ee89f62d..0ba23ef4d3 100644
--- a/tool/gem-unpack.rb
+++ b/tool/gem-unpack.rb
@@ -18,5 +18,9 @@ def Gem.unpack(file, dir = nil, spec_dir = nil)
end
FileUtils.mkdir_p(spec_dir)
File.binwrite(File.join(spec_dir, "#{spec.name}-#{spec.version}.gemspec"), spec.to_ruby)
+ unless spec.extensions.empty? or spec.dependencies.empty?
+ spec.dependencies.clear
+ end
+ File.binwrite(File.join(spec_dir, ".bundled.#{spec.name}-#{spec.version}.gemspec"), spec.to_ruby)
puts "Unpacked #{file}"
end