diff options
-rw-r--r-- | common.mk | 11 | ||||
-rwxr-xr-x | tool/gem-unpack.rb | 16 |
2 files changed, 27 insertions, 0 deletions
@@ -924,6 +924,14 @@ update-gems: PHONY -e 'File.unlink(*(old-[gem]))' \ bundled_gems +extract-gems: PHONY + $(ECHO) Extracting bundled gem files... + $(Q) $(RUNRUBY) -C "$(srcdir)/gems" \ + -I../tool -rgem-unpack -answ \ + -e 'gem, ver = *$$F' \ + -e 'Gem.unpack("#{gem}-#{ver}.gem")' \ + bundled_gems + UPDATE_LIBRARIES = no ### set the following environment variable or uncomment the line if @@ -973,6 +981,9 @@ extract-extlibs: clean-extlibs: $(Q) $(RMALL) $(srcdir)/.downloaded-cache +clean-gems: + $(Q) $(RM) gems/*.gem + CLEAN_CACHE = clean-extlibs info: info-program info-libruby_a info-libruby_so info-arch diff --git a/tool/gem-unpack.rb b/tool/gem-unpack.rb new file mode 100755 index 0000000000..5f15751d9c --- /dev/null +++ b/tool/gem-unpack.rb @@ -0,0 +1,16 @@ +require 'rubygems' +require 'rubygems/package' + +def Gem.unpack(file, dir = nil) + pkg = Gem::Package.new(file) + pkg.security_policy = Gem::Security::LowSecurity + 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}.gemspec") + open(spec_file, 'wb') do |f| + f.print spec.to_ruby + end + puts "Unpacked #{file}" +end |