[前][次][番号順一覧][スレッド一覧]

ruby-changes:37190

From: nobu <ko1@a...>
Date: Fri, 16 Jan 2015 13:53:05 +0900 (JST)
Subject: [ruby-changes:37190] nobu:r49271 (trunk): common.mk: extract-gems

nobu	2015-01-16 13:52:59 +0900 (Fri, 16 Jan 2015)

  New Revision: 49271

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49271

  Log:
    common.mk: extract-gems
    
    * common.mk (extract-gems): extract gem files to install them even
      if zlib is not available.

  Added files:
    trunk/tool/gem-unpack.rb
  Modified files:
    trunk/common.mk
Index: common.mk
===================================================================
--- common.mk	(revision 49270)
+++ common.mk	(revision 49271)
@@ -924,6 +924,14 @@ update-gems: PHONY https://github.com/ruby/ruby/blob/trunk/common.mk#L924
 	    -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: https://github.com/ruby/ruby/blob/trunk/common.mk#L981
 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
Index: tool/gem-unpack.rb
===================================================================
--- tool/gem-unpack.rb	(revision 0)
+++ tool/gem-unpack.rb	(revision 49271)
@@ -0,0 +1,16 @@ https://github.com/ruby/ruby/blob/trunk/tool/gem-unpack.rb#L1
+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

Property changes on: tool/gem-unpack.rb
___________________________________________________________________
Added: svn:eol-style
   + LF
Added: svn:executable
   + *


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]