mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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.
This commit is contained in:
parent
8c74eaa08d
commit
e1a4e44f14
Notes:
git
2022-07-14 09:00:40 +09:00
1 changed files with 6 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue