diff options
author | nagachika <nagachika@ruby-lang.org> | 2022-10-15 16:25:52 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2022-10-15 16:25:52 +0900 |
commit | 4a986a11e2b2d7037f1e95b0317aa012dc0ee5fb (patch) | |
tree | df92f10e1e9d95fed64dd7c82694af0abf73cfc8 /tool | |
parent | f2c28e90698d6d9e8321237d3510d1737fc166ca (diff) |
merge revision(s) e1a4e44f14482814a0540ae0a4b31d858ff56f53:
Extract gemspec files to each gem directories
Since extension libraries can not be built in the source directory,
rubygems warns gems have extension libraries as the extensions are not
built. To order to suppress this warnings, extract such gemspec files
under each gem directories instead of the common `specifications`
directory.
---
tool/gem-unpack.rb | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Diffstat (limited to 'tool')
-rw-r--r-- | tool/gem-unpack.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tool/gem-unpack.rb b/tool/gem-unpack.rb index fe10b0e420..16ee89f62d 100644 --- a/tool/gem-unpack.rb +++ b/tool/gem-unpack.rb @@ -11,10 +11,12 @@ def Gem.unpack(file, dir = nil, spec_dir = nil) target = spec.full_name target = File.join(dir, target) if dir pkg.extract_files target - FileUtils.mkdir_p(spec_dir ||= target) - spec_file = File.join(spec_dir, "#{spec.name}-#{spec.version}.gemspec") - open(spec_file, 'wb') do |f| - f.print spec.to_ruby + if spec.extensions.empty? + spec_dir ||= target + else + spec_dir = target end + FileUtils.mkdir_p(spec_dir) + File.binwrite(File.join(spec_dir, "#{spec.name}-#{spec.version}.gemspec"), spec.to_ruby) puts "Unpacked #{file}" end |