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

ruby-changes:32174

From: drbrain <ko1@a...>
Date: Tue, 17 Dec 2013 05:18:35 +0900 (JST)
Subject: [ruby-changes:32174] drbrain:r44253 (trunk): * lib/rubygems: Update to RubyGems master 1c5f4b3. Allows rubygems

drbrain	2013-12-17 05:18:29 +0900 (Tue, 17 Dec 2013)

  New Revision: 44253

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

  Log:
    * lib/rubygems:  Update to RubyGems master 1c5f4b3.  Allows rubygems
      repackagers to disable backward-compatible shared gem directory
      behavior.
    * test/rubygems:  ditto.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/defaults.rb
    trunk/lib/rubygems/ext/ext_conf_builder.rb
    trunk/test/rubygems/test_gem_ext_builder.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44252)
+++ ChangeLog	(revision 44253)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Dec 17 05:18:17 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/rubygems:  Update to RubyGems master 1c5f4b3.  Allows rubygems
+	  repackagers to disable backward-compatible shared gem directory
+	  behavior.
+	* test/rubygems:  ditto.
+
 Tue Dec 17 05:14:35 2013  Eric Hodel  <drbrain@s...>
 
 	* NEWS (RDoc):  Update version number so I don't have to change it
Index: lib/rubygems/ext/ext_conf_builder.rb
===================================================================
--- lib/rubygems/ext/ext_conf_builder.rb	(revision 44252)
+++ lib/rubygems/ext/ext_conf_builder.rb	(revision 44253)
@@ -44,7 +44,7 @@ class Gem::Ext::ExtConfBuilder < Gem::Ex https://github.com/ruby/ruby/blob/trunk/lib/rubygems/ext/ext_conf_builder.rb#L44
 
         if tmp_dest
           # TODO remove in RubyGems 3
-          if lib_dir then
+          if Gem.install_extension_in_lib and lib_dir then
             FileUtils.mkdir_p lib_dir
             entries = Dir.entries(tmp_dest) - %w[. ..]
             entries = entries.map { |entry| File.join tmp_dest, entry }
Index: lib/rubygems/defaults.rb
===================================================================
--- lib/rubygems/defaults.rb	(revision 44252)
+++ lib/rubygems/defaults.rb	(revision 44253)
@@ -152,4 +152,12 @@ module Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/defaults.rb#L152
   def self.default_gems_use_full_paths?
     ruby_engine != 'ruby'
   end
+
+  ##
+  # Install extensions into lib as well as into the extension directory.
+
+  def self.install_extension_in_lib # :nodoc:
+    true
+  end
+
 end
Index: test/rubygems/test_gem_ext_builder.rb
===================================================================
--- test/rubygems/test_gem_ext_builder.rb	(revision 44252)
+++ test/rubygems/test_gem_ext_builder.rb	(revision 44253)
@@ -132,6 +132,55 @@ install: https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_ext_builder.rb#L132
     assert_path_exists File.join @spec.gem_dir, 'lib', 'a', 'b.rb'
   end
 
+  def test_build_extensions_install_ext_only
+    class << Gem
+      alias orig_install_extension_in_lib install_extension_in_lib
+
+      def Gem.install_extension_in_lib
+        false
+      end
+    end
+
+    @spec.extensions << 'ext/extconf.rb'
+
+    ext_dir = File.join @spec.gem_dir, 'ext'
+
+    FileUtils.mkdir_p ext_dir
+
+    extconf_rb = File.join ext_dir, 'extconf.rb'
+
+    open extconf_rb, 'w' do |f|
+      f.write <<-'RUBY'
+        require 'mkmf'
+
+        create_makefile 'a'
+      RUBY
+    end
+
+    ext_lib_dir = File.join ext_dir, 'lib'
+    FileUtils.mkdir ext_lib_dir
+    FileUtils.touch File.join ext_lib_dir, 'a.rb'
+    FileUtils.mkdir File.join ext_lib_dir, 'a'
+    FileUtils.touch File.join ext_lib_dir, 'a', 'b.rb'
+
+    use_ui @ui do
+      @builder.build_extensions
+    end
+
+    assert_path_exists @spec.extension_dir
+    assert_path_exists @spec.gem_build_complete_path
+    assert_path_exists File.join @spec.extension_dir, 'gem_make.out'
+    assert_path_exists File.join @spec.extension_dir, 'a.rb'
+    refute_path_exists File.join @spec.gem_dir, 'lib', 'a.rb'
+    refute_path_exists File.join @spec.gem_dir, 'lib', 'a', 'b.rb'
+  ensure
+    class << Gem
+      remove_method :install_extension_in_lib
+
+      alias install_extension_in_lib orig_install_extension_in_lib
+    end
+  end
+
   def test_build_extensions_none
     use_ui @ui do
       @builder.build_extensions

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

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