summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2019-08-04 14:39:55 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-08-05 18:45:24 +0900
commit86ac51c301e62abb4eb0962e04e587ba8298bf80 (patch)
treeed6b883b4103e9fa965f322a2436f7413b5aa9a4 /lib
parent2ea2108a9fb1460342226f54cbf54ddd79ea1cc2 (diff)
[rubygems/rubygems] Use the standard RUBY_ENGINE_VERSION instead of JRUBY_VERSION
* RUBY_ENGINE and RUBY_ENGINE_VERSION are defined on every modern Ruby. * There is no such constant as TRUFFLERUBY_VERSION or RBX_VERSION. https://github.com/rubygems/rubygems/commit/431d0aefdd
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems.rb12
-rw-r--r--lib/rubygems/defaults.rb9
-rw-r--r--lib/rubygems/request.rb2
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb8
4 files changed, 10 insertions, 21 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 64c21e181c..84c1c741b4 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -1395,14 +1395,12 @@ begin
rescue LoadError
end
-if defined?(RUBY_ENGINE)
- begin
- ##
- # Defaults the Ruby implementation wants to provide for RubyGems
+begin
+ ##
+ # Defaults the Ruby implementation wants to provide for RubyGems
- require "rubygems/defaults/#{RUBY_ENGINE}"
- rescue LoadError
- end
+ require "rubygems/defaults/#{RUBY_ENGINE}"
+rescue LoadError
end
##
diff --git a/lib/rubygems/defaults.rb b/lib/rubygems/defaults.rb
index da304b213b..cdc5fb7acb 100644
--- a/lib/rubygems/defaults.rb
+++ b/lib/rubygems/defaults.rb
@@ -129,15 +129,8 @@ module Gem
end
end
- ##
- # A wrapper around RUBY_ENGINE const that may not be defined
-
def self.ruby_engine
- if defined? RUBY_ENGINE
- RUBY_ENGINE
- else
- 'ruby'
- end
+ RUBY_ENGINE
end
##
diff --git a/lib/rubygems/request.rb b/lib/rubygems/request.rb
index 1ed2b8ad50..435c7c53cb 100644
--- a/lib/rubygems/request.rb
+++ b/lib/rubygems/request.rb
@@ -285,7 +285,7 @@ class Gem::Request
end
ua << ")"
- ua << " #{RUBY_ENGINE}" if defined?(RUBY_ENGINE) and RUBY_ENGINE != 'ruby'
+ ua << " #{RUBY_ENGINE}" if RUBY_ENGINE != 'ruby'
ua
end
diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb
index a4d803f915..cb36a62e10 100644
--- a/lib/rubygems/request_set/gem_dependency_api.rb
+++ b/lib/rubygems/request_set/gem_dependency_api.rb
@@ -782,7 +782,7 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
# You may also provide +engine:+ and +engine_version:+ options to restrict
# this gem dependencies file to a particular ruby engine and its engine
# version. This matching is performed by using the RUBY_ENGINE and
- # engine_specific VERSION constants. (For JRuby, JRUBY_VERSION).
+ # RUBY_ENGINE_VERSION constants.
def ruby(version, options = {})
engine = options[:engine]
@@ -809,11 +809,9 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta
end
if engine_version
- my_engine_version = Object.const_get "#{Gem.ruby_engine.upcase}_VERSION"
-
- if engine_version != my_engine_version
+ if engine_version != RUBY_ENGINE_VERSION
message =
- "Your Ruby engine version is #{Gem.ruby_engine} #{my_engine_version}, " +
+ "Your Ruby engine version is #{Gem.ruby_engine} #{RUBY_ENGINE_VERSION}, " +
"but your #{gem_deps_file} requires #{engine} #{engine_version}"
raise Gem::RubyVersionMismatch, message