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

ruby-changes:57919

From: David <ko1@a...>
Date: Thu, 26 Sep 2019 18:27:54 +0900 (JST)
Subject: [ruby-changes:57919] 4f87a1583d (master): [rubygems/rubygems] Introduce default prerelease requirement

https://git.ruby-lang.org/ruby.git/commit/?id=4f87a1583d

From 4f87a1583dce25749c0492146ef78fcb0319ccd2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...>
Date: Tue, 24 Sep 2019 17:35:00 +0200
Subject: [rubygems/rubygems] Introduce default prerelease requirement

https://github.com/rubygems/rubygems/commit/506c5bce49

diff --git a/lib/rubygems/core_ext/kernel_require.rb b/lib/rubygems/core_ext/kernel_require.rb
index 5516933..858f099 100755
--- a/lib/rubygems/core_ext/kernel_require.rb
+++ b/lib/rubygems/core_ext/kernel_require.rb
@@ -66,7 +66,7 @@ module Kernel https://github.com/ruby/ruby/blob/trunk/lib/rubygems/core_ext/kernel_require.rb#L66
 
     if spec = Gem.find_unresolved_default_spec(path)
       begin
-        Kernel.send(:gem, spec.name, "#{Gem::Requirement.default}.a")
+        Kernel.send(:gem, spec.name, Gem::Requirement.default_prerelease)
       rescue Exception
         RUBYGEMS_ACTIVATION_MONITOR.exit
         raise
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index a40deef..898f6e4 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -776,7 +776,7 @@ class Gem::Installer https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L776
 
 require 'rubygems'
 
-version = "#{Gem::Requirement.default}.a"
+version = "#{Gem::Requirement.default_prerelease}"
 
 str = ARGV.first
 if str
diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb
index b72921e..1e17fc2 100644
--- a/lib/rubygems/requirement.rb
+++ b/lib/rubygems/requirement.rb
@@ -32,11 +32,16 @@ class Gem::Requirement https://github.com/ruby/ruby/blob/trunk/lib/rubygems/requirement.rb#L32
   PATTERN = /\A#{PATTERN_RAW}\z/.freeze
 
   ##
-  # The default requirement matches any version
+  # The default requirement matches any non-prerelease version
 
   DefaultRequirement = [">=", Gem::Version.new(0)].freeze
 
   ##
+  # The default requirement matches any version
+
+  DefaultPrereleaseRequirement = [">=", Gem::Version.new("0.a")].freeze
+
+  ##
   # Raised when a bad requirement is encountered
 
   class BadRequirementError < ArgumentError; end
@@ -73,6 +78,10 @@ class Gem::Requirement https://github.com/ruby/ruby/blob/trunk/lib/rubygems/requirement.rb#L78
     new '>= 0'
   end
 
+  def self.default_prerelease
+    new '>= 0.a'
+  end
+
   ###
   # A source set requirement, used for Gemfiles and lockfiles
 
@@ -101,6 +110,8 @@ class Gem::Requirement https://github.com/ruby/ruby/blob/trunk/lib/rubygems/requirement.rb#L110
 
     if $1 == ">=" && $2 == "0"
       DefaultRequirement
+    elsif $1 == ">=" && $2 == "0.a"
+      DefaultPrereleaseRequirement
     else
       [$1 || "=", Gem::Version.new($2)]
     end
-- 
cgit v0.10.2


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

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