mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Obey spec file locations to rubygems
This commit is contained in:
parent
d7afaf21f2
commit
bb0a22a8c0
Notes:
git
2022-04-07 09:47:31 +09:00
3 changed files with 6 additions and 4 deletions
|
@ -1360,10 +1360,11 @@ extract-gems$(gnumake:yes=-nongnumake): PHONY
|
|||
$(Q) $(RUNRUBY) -C "$(srcdir)" \
|
||||
-Itool -rfileutils -rgem-unpack -answ \
|
||||
-e 'BEGIN {FileUtils.mkdir_p(d = ".bundle/gems")}' \
|
||||
-e 'BEGIN {FileUtils.mkdir_p(s = ".bundle/specifications")}' \
|
||||
-e 'gem, ver = *$$F' \
|
||||
-e 'next if !ver or /^#/=~gem' \
|
||||
-e 'g = "#{gem}-#{ver}"' \
|
||||
-e 'File.directory?("#{d}/#{g}") or Gem.unpack("gems/#{g}.gem", d)' \
|
||||
-e 'File.directory?("#{d}/#{g}") or Gem.unpack("gems/#{g}.gem", d, s)' \
|
||||
-e 'FileUtils.rm_rf("#{d}/#{g}/.github")' \
|
||||
gems/bundled_gems
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ extract-gems: | $(patsubst %,.bundle/gems/%,$(bundled-gems))
|
|||
$(ECHO) Extracting bundle gem $*...
|
||||
$(Q) $(BASERUBY) -C "$(srcdir)" \
|
||||
-Itool -rgem-unpack \
|
||||
-e 'Gem.unpack("gems/$(@F).gem", ".bundle/gems")'
|
||||
-e 'Gem.unpack("gems/$(@F).gem", ".bundle/gems", ".bundle/specifications")'
|
||||
$(RMALL) "$(srcdir)/$(@:.gem=)/".git*
|
||||
|
||||
$(srcdir)/.bundle/gems:
|
||||
|
|
|
@ -5,13 +5,14 @@ require 'rubygems/package'
|
|||
# This library is used by "make extract-gems" to
|
||||
# unpack bundled gem files.
|
||||
|
||||
def Gem.unpack(file, dir = nil)
|
||||
def Gem.unpack(file, dir = nil, spec_dir = nil)
|
||||
pkg = Gem::Package.new(file)
|
||||
spec = pkg.spec
|
||||
target = spec.full_name
|
||||
target = File.join(dir, target) if dir
|
||||
pkg.extract_files target
|
||||
spec_file = File.join(target, "#{spec.name}-#{spec.version}.gemspec")
|
||||
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
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue