summaryrefslogtreecommitdiff
path: root/lib/rubygems/platform.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/platform.rb')
-rw-r--r--lib/rubygems/platform.rb45
1 files changed, 19 insertions, 26 deletions
diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb
index f67e4022b6..7301153c4b 100644
--- a/lib/rubygems/platform.rb
+++ b/lib/rubygems/platform.rb
@@ -21,7 +21,8 @@ class Gem::Platform
def self.match(platform)
Gem.platforms.any? do |local_platform|
- platform.nil? or local_platform == platform or
+ platform.nil? or
+ local_platform == platform or
(local_platform != Gem::Platform::RUBY and local_platform =~ platform)
end
end
@@ -65,28 +66,28 @@ class Gem::Platform
@cpu, os = nil, cpu if os.nil? # legacy jruby
@os, @version = case os
- when /aix(\d+)/ then [ 'aix', $1 ]
- when /cygwin/ then [ 'cygwin', nil ]
- when /darwin(\d+)?/ then [ 'darwin', $1 ]
- when /^macruby$/ then [ 'macruby', nil ]
- when /freebsd(\d+)/ then [ 'freebsd', $1 ]
- when /hpux(\d+)/ then [ 'hpux', $1 ]
- when /^java$/, /^jruby$/ then [ 'java', nil ]
- when /^java([\d.]*)/ then [ 'java', $1 ]
- when /^dotnet$/ then [ 'dotnet', nil ]
- when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
- when /linux/ then [ 'linux', $1 ]
- when /mingw32/ then [ 'mingw32', nil ]
+ when /aix(\d+)?/ then [ 'aix', $1 ]
+ when /cygwin/ then [ 'cygwin', nil ]
+ when /darwin(\d+)?/ then [ 'darwin', $1 ]
+ when /^macruby$/ then [ 'macruby', nil ]
+ when /freebsd(\d+)?/ then [ 'freebsd', $1 ]
+ when /hpux(\d+)?/ then [ 'hpux', $1 ]
+ when /^java$/, /^jruby$/ then [ 'java', nil ]
+ when /^java([\d.]*)/ then [ 'java', $1 ]
+ when /^dotnet$/ then [ 'dotnet', nil ]
+ when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
+ when /linux/ then [ 'linux', $1 ]
+ when /mingw32/ then [ 'mingw32', nil ]
when /(mswin\d+)(\_(\d+))?/ then
os, version = $1, $3
@cpu = 'x86' if @cpu.nil? and os =~ /32$/
[os, version]
- when /(netbsd[a-z]*)(\d+)/ then [ $1, $2 ]
- when /openbsd(\d+\.\d+)/ then [ 'openbsd', $1 ]
- when /solaris(\d+\.\d+)/ then [ 'solaris', $1 ]
+ when /netbsdelf/ then [ 'netbsdelf', nil ]
+ when /openbsd(\d+\.\d+)?/ then [ 'openbsd', $1 ]
+ when /solaris(\d+\.\d+)?/ then [ 'solaris', $1 ]
# test
- when /^(\w+_platform)(\d+)/ then [ $1, $2 ]
- else [ 'unknown', nil ]
+ when /^(\w+_platform)(\d+)?/ then [ $1, $2 ]
+ else [ 'unknown', nil ]
end
when Gem::Platform then
@cpu = arch.cpu
@@ -109,10 +110,6 @@ class Gem::Platform
to_a.compact.join '-'
end
- def empty?
- to_s.empty?
- end
-
##
# Is +other+ equal to this platform? Two platforms are equal if they have
# the same CPU, OS and version.
@@ -186,9 +183,5 @@ class Gem::Platform
# This will be replaced with Gem::Platform::local.
CURRENT = 'current'
-
- extend Gem::Deprecate
-
- deprecate :empty?, :none, 2011, 11
end