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

ruby-changes:40801

From: hsbt <ko1@a...>
Date: Fri, 4 Dec 2015 15:22:07 +0900 (JST)
Subject: [ruby-changes:40801] hsbt:r52880 (trunk): * lib/rubygems: Update to RubyGems 2.5.0+ HEAD(fdab4c4).

hsbt	2015-12-04 15:21:53 +0900 (Fri, 04 Dec 2015)

  New Revision: 52880

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

  Log:
    * lib/rubygems: Update to RubyGems 2.5.0+ HEAD(fdab4c4).
      this version includes #1396, #1397, #1398, #1399
    * test/rubygems: ditto.

  Added files:
    trunk/test/rubygems/specifications/foo-0.0.1-x86-mswin32.gemspec
  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/basic_specification.rb
    trunk/lib/rubygems/core_ext/kernel_require.rb
    trunk/lib/rubygems/requirement.rb
    trunk/lib/rubygems/specification.rb
    trunk/lib/rubygems/stub_specification.rb
    trunk/test/rubygems/test_gem_resolver.rb
    trunk/test/rubygems/test_gem_specification.rb
    trunk/test/rubygems/test_gem_stub_specification.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 52879)
+++ ChangeLog	(revision 52880)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Dec  4 15:21:45 2015  SHIBATA Hiroshi  <hsbt@r...>
+
+	* lib/rubygems: Update to RubyGems 2.5.0+ HEAD(fdab4c4).
+	  this version includes #1396, #1397, #1398, #1399
+	* test/rubygems: ditto.
+
 Fri Dec  4 11:22:40 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* thread.c (rb_thread_setname): name must be ascii-compatible, as
Index: lib/rubygems/basic_specification.rb
===================================================================
--- lib/rubygems/basic_specification.rb	(revision 52879)
+++ lib/rubygems/basic_specification.rb	(revision 52880)
@@ -65,22 +65,17 @@ class Gem::BasicSpecification https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L65
   # Return true if this spec can require +file+.
 
   def contains_requirable_file? file
-    @contains_requirable_file ||= {}
-    @contains_requirable_file[file] ||=
-    begin
-      if @ignored then
-        return false
-      elsif missing_extensions? then
-        @ignored = true
+    if @ignored then
+      return false
+    elsif missing_extensions? then
+      @ignored = true
 
-        warn "Ignoring #{full_name} because its extensions are not built.  " +
-             "Try: gem pristine #{name} --version #{version}"
-        return false
-      end
+      warn "Ignoring #{full_name} because its extensions are not built.  " +
+        "Try: gem pristine #{name} --version #{version}"
+      return false
+    end
 
-      have_file? file, Gem.suffixes
-    end ? :yes : :no
-    @contains_requirable_file[file] == :yes
+    have_file? file, Gem.suffixes
   end
 
   def default_gem?
Index: lib/rubygems/specification.rb
===================================================================
--- lib/rubygems/specification.rb	(revision 52879)
+++ lib/rubygems/specification.rb	(revision 52880)
@@ -175,6 +175,11 @@ class Gem::Specification < Gem::BasicSpe https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L175
 
   @@stubs_by_name = {}
 
+  # Sentinel object to represent "not found" stubs
+  NOT_FOUND = Struct.new(:to_spec, :this).new # :nodoc:
+  @@spec_with_requirable_file          = {}
+  @@active_stub_with_requirable_file   = {}
+
   ######################################################################
   # :section: Required gemspec attributes
 
@@ -1027,10 +1032,10 @@ class Gem::Specification < Gem::BasicSpe https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1032
 
   def self.find_by_path path
     path = path.dup.freeze
-    stub = stubs.find { |spec|
-      spec.contains_requirable_file? path
-    }
-    stub && stub.to_spec
+    spec = @@spec_with_requirable_file[path] ||= (stubs.find { |s|
+      s.contains_requirable_file? path
+    } || NOT_FOUND)
+    spec.to_spec
   end
 
   ##
@@ -1044,6 +1049,13 @@ class Gem::Specification < Gem::BasicSpe https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1049
     stub && stub.to_spec
   end
 
+  def self.find_active_stub_by_path path
+    stub = @@active_stub_with_requirable_file[path] ||= (stubs.find { |s|
+      s.activated? and s.contains_requirable_file? path
+    } || NOT_FOUND)
+    stub.this
+  end
+
   ##
   # Return currently unresolved specs that contain the file matching +path+.
 
@@ -1261,6 +1273,8 @@ class Gem::Specification < Gem::BasicSpe https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L1273
     @@all = nil
     @@stubs = nil
     @@stubs_by_name = {}
+    @@spec_with_requirable_file          = {}
+    @@active_stub_with_requirable_file   = {}
     _clear_load_cache
     unresolved = unresolved_deps
     unless unresolved.empty? then
@@ -2847,7 +2861,7 @@ duplicate dependency on #{dep}, (#{prev. https://github.com/ruby/ruby/blob/trunk/lib/rubygems/specification.rb#L2861
       end
 
       warning_messages << "prerelease dependency on #{dep} is not recommended" if
-        prerelease_dep
+        prerelease_dep && !version.prerelease?
 
       overly_strict = dep.requirement.requirements.length == 1 &&
         dep.requirement.requirements.any? do |op, version|
Index: lib/rubygems/requirement.rb
===================================================================
--- lib/rubygems/requirement.rb	(revision 52879)
+++ lib/rubygems/requirement.rb	(revision 52880)
@@ -89,9 +89,9 @@ class Gem::Requirement https://github.com/ruby/ruby/blob/trunk/lib/rubygems/requirement.rb#L89
   # specification, like <tt>">= 1.2"</tt>, or a simple version number,
   # like <tt>"1.2"</tt>.
   #
-  #     parse("> 1.0")                 # => [">", "1.0"]
-  #     parse("1.0")                   # => ["=", "1.0"]
-  #     parse(Gem::Version.new("1.0")) # => ["=,  "1.0"]
+  #     parse("> 1.0")                 # => [">", Gem::Version.new("1.0")]
+  #     parse("1.0")                   # => ["=", Gem::Version.new("1.0")]
+  #     parse(Gem::Version.new("1.0")) # => ["=,  Gem::Version.new("1.0")]
 
   def self.parse obj
     return ["=", obj] if Gem::Version === obj
Index: lib/rubygems/stub_specification.rb
===================================================================
--- lib/rubygems/stub_specification.rb	(revision 52879)
+++ lib/rubygems/stub_specification.rb	(revision 52880)
@@ -88,6 +88,8 @@ class Gem::StubSpecification < Gem::Basi https://github.com/ruby/ruby/blob/trunk/lib/rubygems/stub_specification.rb#L88
     end
   end
 
+  def this; self; end
+
   def default_gem?
     @default_gem
   end
Index: lib/rubygems/core_ext/kernel_require.rb
===================================================================
--- lib/rubygems/core_ext/kernel_require.rb	(revision 52879)
+++ lib/rubygems/core_ext/kernel_require.rb	(revision 52880)
@@ -60,9 +60,7 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_require.rb#L60
     #--
     # TODO request access to the C implementation of this to speed up RubyGems
 
-    spec = Gem::Specification.stubs.find { |s|
-      s.activated? and s.contains_requirable_file? path
-    }
+    spec = Gem::Specification.find_active_stub_by_path path
 
     begin
       RUBYGEMS_ACTIVATION_MONITOR.exit
Index: test/rubygems/specifications/foo-0.0.1-x86-mswin32.gemspec
===================================================================
Binary files test/rubygems/specifications/foo-0.0.1-x86-mswin32.gemspec	(revision 0) and test/rubygems/specifications/foo-0.0.1-x86-mswin32.gemspec	(revision 52880) differ

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

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