Drop Rubinius code

Rubinius has not been maintained since May 2020 and based on the
discussion at https://github.com/rails/rails/pull/44984 ,
I think we can remove Rubinius specific code from Rails.
This commit is contained in:
Yasuo Honda 2022-09-12 23:51:50 +09:00
parent fc71f585ba
commit 349a66ebed
18 changed files with 11 additions and 112 deletions

View File

@ -159,12 +159,6 @@ platforms :jruby do
end
end
platforms :rbx do
# The rubysl-yaml gem doesn't ship with Psych by default as it needs
# libyaml that isn't always available.
gem "psych", "~> 3.0"
end
# Gems that are necessary for Active Record tests with Oracle.
if ENV["ORACLE_ENHANCED"]
platforms :ruby do

View File

@ -371,7 +371,6 @@ GEM
activesupport (>= 7.0.0.alpha2)
rack
railties (>= 7.0.0.alpha2)
psych (3.3.2)
public_suffix (4.0.6)
puma (5.5.2)
nio4r (~> 2.0)
@ -588,7 +587,6 @@ DEPENDENCIES
nokogiri (>= 1.8.1, != 1.11.0)
pg (~> 1.3)
propshaft (>= 0.1.7)
psych (~> 3.0)
puma
queue_classic (>= 4.0.0)
racc (>= 1.4.6)

View File

@ -39,11 +39,6 @@ class ActiveSupport::TestCase
include ActiveSupport::Testing::MethodCallAssertions
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)

View File

@ -359,11 +359,6 @@ class ActiveSupport::TestCase
include ActiveSupport::Testing::MethodCallAssertions
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)

View File

@ -369,8 +369,6 @@ module ActionController
end
def test_async_stream
rubinius_skip "https://github.com/rubinius/rubinius/issues/2934"
@controller.latch = Concurrent::CountDownLatch.new
parts = ["hello", "world"]

View File

@ -186,11 +186,6 @@ class ActiveSupport::TestCase
include ActiveSupport::Testing::MethodCallAssertions
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)

View File

@ -144,7 +144,6 @@ class DateHelperTest < ActionView::TestCase
end
def test_distance_in_words_doesnt_use_the_quotient_operator
rubinius_skip "Date is written in Ruby and relies on Integer#/"
jruby_skip "Date is written in Ruby and relies on Integer#/"
# Make sure that we avoid Integer#/ (redefined by mathn)

View File

@ -16,11 +16,6 @@ class ActiveModel::TestCase < ActiveSupport::TestCase
include ActiveSupport::Testing::MethodCallAssertions
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)

View File

@ -22,43 +22,15 @@ module ActiveSupport
codepoints.pack("U*").unicode_normalize(:nfc).codepoints
end
# Rubinius' String#scrub, however, doesn't support ASCII-incompatible chars.
if !defined?(Rubinius)
# Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent
# resulting in a valid UTF-8 string.
#
# Passing +true+ will forcibly tidy all bytes, assuming that the string's
# encoding is entirely CP1252 or ISO-8859-1.
def tidy_bytes(string, force = false)
return string if string.empty? || string.ascii_only?
return recode_windows1252_chars(string) if force
string.scrub { |bad| recode_windows1252_chars(bad) }
end
else
def tidy_bytes(string, force = false)
return string if string.empty?
return recode_windows1252_chars(string) if force
# We can't transcode to the same format, so we choose a nearly-identical encoding.
# We're going to 'transcode' bytes from UTF-8 when possible, then fall back to
# CP1252 when we get errors. The final string will be 'converted' back to UTF-8
# before returning.
reader = Encoding::Converter.new(Encoding::UTF_8, Encoding::UTF_16LE)
source = string.dup
out = "".force_encoding(Encoding::UTF_16LE)
loop do
reader.primitive_convert(source, out)
_, _, _, error_bytes, _ = reader.primitive_errinfo
break if error_bytes.nil?
out << error_bytes.encode(Encoding::UTF_16LE, Encoding::Windows_1252, invalid: :replace, undef: :replace)
end
reader.finish
out.encode!(Encoding::UTF_8)
end
# Replaces all ISO-8859-1 or CP1252 characters by their UTF-8 equivalent
# resulting in a valid UTF-8 string.
#
# Passing +true+ will forcibly tidy all bytes, assuming that the string's
# encoding is entirely CP1252 or ISO-8859-1.
def tidy_bytes(string, force = false)
return string if string.empty? || string.ascii_only?
return recode_windows1252_chars(string) if force
string.scrub { |bad| recode_windows1252_chars(bad) }
end
private

View File

@ -39,11 +39,6 @@ class ActiveSupport::TestCase
include ActiveSupport::Testing::MethodCallAssertions
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)

View File

@ -82,9 +82,6 @@ class DurationTest < ActiveSupport::TestCase
end
def test_eql
rubinius_skip "Rubinius' #eql? definition relies on #instance_of? " \
"which behaves oddly for the sake of backward-compatibility."
assert 1.minute.eql?(1.minute)
assert 1.minute.eql?(60.seconds)
assert 2.days.eql?(48.hours)

View File

@ -10,9 +10,6 @@ class DuplicableTest < ActiveSupport::TestCase
ALLOW_DUP = ["1", "symbol_from_string".to_sym, Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal("4.56"), nil, false, true, 1, 2.3, Complex(1), Rational(1)]
def test_duplicable
rubinius_skip "* Method#dup is allowed at the moment on Rubinius\n" \
"* https://github.com/rubinius/rubinius/issues/3089"
RAISE_DUP.each do |v|
assert_not v.duplicable?, "#{ v.inspect } should not be duplicable"
assert_raises(TypeError, v.class.name) { v.dup }

View File

@ -1092,8 +1092,6 @@ class TimeWithZoneTest < ActiveSupport::TestCase
end
def test_no_method_error_has_proper_context
rubinius_skip "Error message inconsistency"
e = assert_raises(NoMethodError) {
@twz.this_method_does_not_exist
}

View File

@ -37,8 +37,6 @@ class TestJSONEncoding < ActiveSupport::TestCase
end
def test_process_status
rubinius_skip "https://github.com/rubinius/rubinius/issues/3334"
# There doesn't seem to be a good way to get a handle on a Process::Status object without actually
# creating a child process, hence this to populate $?
system("not_a_real_program_#{SecureRandom.hex}")

View File

@ -128,7 +128,6 @@ module Rails
hotwire_gemfile_entry,
css_gemfile_entry,
jbuilder_gemfile_entry,
psych_gemfile_entry,
cable_gemfile_entry,
].flatten.compact.select(&@gem_filter)
end
@ -434,14 +433,6 @@ module Rails
end
end
def psych_gemfile_entry
return unless defined?(Rubinius)
comment = "Use Psych as the YAML engine, instead of Syck, so serialized " \
"data can be read safely from different rubies"
GemfileEntry.new("psych", "~> 2.0", comment, platforms: :rbx)
end
def cable_gemfile_entry
return if options[:skip_action_cable]

View File

@ -22,11 +22,6 @@ class ActiveSupport::TestCase
include ActiveSupport::Testing::Stream
private
# Skips the current run on Rubinius using Minitest::Assertions#skip
def rubinius_skip(message = "")
skip message if RUBY_ENGINE == "rbx"
end
# Skips the current run on JRuby using Minitest::Assertions#skip
def jruby_skip(message = "")
skip message if defined?(JRUBY_VERSION)

View File

@ -647,7 +647,7 @@ class AppGeneratorTest < Rails::Generators::TestCase
def test_inclusion_of_a_debugger
run_generator
if defined?(JRUBY_VERSION) || RUBY_ENGINE == "rbx"
if defined?(JRUBY_VERSION)
assert_no_gem "debug"
else
assert_gem "debug"
@ -1033,19 +1033,6 @@ class AppGeneratorTest < Rails::Generators::TestCase
end
end
def test_psych_gem
run_generator
gem_regex = /gem 'psych',\s+'~> 2\.0',\s+platforms: :rbx/
assert_file "Gemfile" do |content|
if defined?(Rubinius)
assert_match(gem_regex, content)
else
assert_no_match(gem_regex, content)
end
end
end
def test_principle_tasks_go_before_finish_template
tasks = generator.class.tasks.keys

View File

@ -145,7 +145,7 @@ class PluginGeneratorTest < Rails::Generators::TestCase
def test_inclusion_of_a_debugger
run_generator [destination_root, "--full"]
if defined?(JRUBY_VERSION) || RUBY_ENGINE == "rbx"
if defined?(JRUBY_VERSION)
assert_file "Gemfile" do |content|
assert_no_match(/debug/, content)
end