1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Introduce default prerelease requirement

https://github.com/rubygems/rubygems/commit/506c5bce49
This commit is contained in:
David Rodríguez 2019-09-24 17:35:00 +02:00 committed by Hiroshi SHIBATA
parent 6134fd7a64
commit 4f87a1583d
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
3 changed files with 14 additions and 3 deletions

View file

@ -66,7 +66,7 @@ module Kernel
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

View file

@ -776,7 +776,7 @@ class Gem::Installer
require 'rubygems'
version = "#{Gem::Requirement.default}.a"
version = "#{Gem::Requirement.default_prerelease}"
str = ARGV.first
if str

View file

@ -32,10 +32,15 @@ class Gem::Requirement
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
@ -73,6 +78,10 @@ class Gem::Requirement
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
if $1 == ">=" && $2 == "0"
DefaultRequirement
elsif $1 == ">=" && $2 == "0.a"
DefaultPrereleaseRequirement
else
[$1 || "=", Gem::Version.new($2)]
end