From 9a924aa894ad7aa5a018c05a9e2362aa0aaf35e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20P=C3=A9rez?= Date: Mon, 4 Oct 2021 02:48:38 +0200 Subject: [PATCH] Set 2.6 as minimum ruby version for Sinatra 3 (#1699) * Run tests for Ruby versions >= 2.6 * Remove not needed checks for methods defined * Set required_ruby_version to >= 2.6 * Update READMEs with new Ruby versions --- .github/workflows/test.yml | 2 +- README.de.md | 6 ++-- README.es.md | 6 ++-- README.md | 6 ++-- README.ru.md | 6 ++-- lib/sinatra/indifferent_hash.rb | 43 +++++++++---------------- sinatra-contrib/sinatra-contrib.gemspec | 2 +- sinatra.gemspec | 2 +- test/indifferent_hash_test.rb | 24 -------------- 9 files changed, 31 insertions(+), 66 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 60f29f57..dcde293b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: matrix: # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' # TODO: Add jruby if something like allow_failures will be implemented on Actions. - ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0'] + ruby: [2.6, 2.7, '3.0'] steps: - uses: actions/checkout@v2 - uses: ruby/setup-ruby@v1 diff --git a/README.de.md b/README.de.md index fa33f0d4..a64bb1c5 100644 --- a/README.de.md +++ b/README.de.md @@ -3082,9 +3082,9 @@ thin --threaded start Die folgenden Versionen werden offiziell unterstützt:
-
Ruby 2.3
+
Ruby 2.6
- 2.3 wird vollständig unterstützt. Es gibt derzeit keine Pläne die + 2.6 wird vollständig unterstützt. Es gibt derzeit keine Pläne die offizielle Unterstützung zu beenden
@@ -3103,7 +3103,7 @@ Die folgenden Versionen werden offiziell unterstützt:
-Versionen vor Ruby 2.2.2 werden ab Sinatra 2.0 nicht länger unterstützt. +Versionen vor Ruby 2.6 werden ab Sinatra 3.0 nicht länger unterstützt. Nachfolgende Ruby-Versionen werden regelmäßig auf Unterstützung geprüft. diff --git a/README.es.md b/README.es.md index d2dc246f..c770fae0 100644 --- a/README.es.md +++ b/README.es.md @@ -3075,9 +3075,9 @@ rainbows -c rainbows.conf Las siguientes versiones de Ruby son soportadas oficialmente:
-
Ruby 2.3
+
Ruby 2.6
- 2.3 Es totalmente compatible y recomendado. Actualmente no hay planes + 2.6 Es totalmente compatible y recomendado. Actualmente no hay planes soltar el apoyo oficial para ello.
@@ -3095,7 +3095,7 @@ Las siguientes versiones de Ruby son soportadas oficialmente:
-Las versiones de Ruby anteriores a 2.2.2 ya no son compatibles con Sinatra 2.0 . +Las versiones de Ruby anteriores a 2.6 ya no son compatibles con Sinatra 3.0 . Siempre le prestamos atención a las nuevas versiones de Ruby. diff --git a/README.md b/README.md index b47a7833..3a21d868 100644 --- a/README.md +++ b/README.md @@ -3047,9 +3047,9 @@ rainbows -c rainbows.conf The following Ruby versions are officially supported:
-
Ruby 2.3
+
Ruby 2.6
- 2.3 is fully supported and recommended. There are currently no plans to + 2.6 is fully supported and recommended. There are currently no plans to drop official support for it.
@@ -3067,7 +3067,7 @@ The following Ruby versions are officially supported:
-Versions of Ruby before 2.3 are no longer supported as of Sinatra 2.1.0. +Versions of Ruby before 2.6 are no longer supported as of Sinatra 3.0.0. We also keep an eye on upcoming Ruby versions. diff --git a/README.ru.md b/README.ru.md index 82f34cc8..760eff4a 100644 --- a/README.ru.md +++ b/README.ru.md @@ -3051,9 +3051,9 @@ thin --threaded start Следующие версии Ruby официально поддерживаются:
-
Ruby 2.3
+
Ruby 2.6
- Версия 2.3 полностью поддерживается и рекомендуется. В настоящее время нет + Версия 2.6 полностью поддерживается и рекомендуется. В настоящее время нет планов отказаться от официальной поддержки.
@@ -3071,7 +3071,7 @@ thin --threaded start
-Версии Ruby ниже 2.2.2 более не поддерживаются в Sinatra 2.0. +Версии Ruby ниже 2.6 более не поддерживаются в Sinatra 3.0. Мы также следим за предстоящими к выходу версиями Ruby. diff --git a/lib/sinatra/indifferent_hash.rb b/lib/sinatra/indifferent_hash.rb index 89b348fd..69515274 100644 --- a/lib/sinatra/indifferent_hash.rb +++ b/lib/sinatra/indifferent_hash.rb @@ -1,11 +1,4 @@ # frozen_string_literal: true -$stderr.puts < 1.0" diff --git a/sinatra.gemspec b/sinatra.gemspec index 46c23f77..af5ad16b 100644 --- a/sinatra.gemspec +++ b/sinatra.gemspec @@ -40,7 +40,7 @@ RubyGems 2.0 or newer is required to protect against public gem pushes. You can EOF end - s.required_ruby_version = '>= 2.3.0' + s.required_ruby_version = '>= 2.6.0' s.add_dependency 'rack', '~> 2.2' s.add_dependency 'tilt', '~> 2.0' diff --git a/test/indifferent_hash_test.rb b/test/indifferent_hash_test.rb index 8b720295..2bec6e76 100644 --- a/test/indifferent_hash_test.rb +++ b/test/indifferent_hash_test.rb @@ -4,10 +4,6 @@ # require 'minitest/autorun' unless defined?(Minitest) -# Suppress the ActiveSupport warning when this test is executed independently, -# outside of the full suite, on older Rubies. -ENV['SINATRA_ACTIVESUPPORT_WARNING'] = 'false' - require_relative '../lib/sinatra/indifferent_hash' class TestIndifferentHashBasics < Minitest::Test @@ -69,10 +65,6 @@ class TestIndifferentHashBasics < Minitest::Test end class TestIndifferentHash < Minitest::Test - def skip_if_lacking(meth) - skip "Hash##{meth} not supported on this Ruby" unless Hash.method_defined?(meth) - end - def setup @hash = Sinatra::IndifferentHash[:a=>:a, ?b=>:b, 3=>3, :simple_nested=>{ :a=>:a, ?b=>:b }, @@ -158,8 +150,6 @@ class TestIndifferentHash < Minitest::Test end def test_dig - skip_if_lacking :dig - assert_equal :a, @hash.dig(:a) assert_equal :b, @hash.dig(?b) assert_nil @hash.dig(:d) @@ -174,8 +164,6 @@ class TestIndifferentHash < Minitest::Test end def test_slice - skip_if_lacking :slice - assert_equal Sinatra::IndifferentHash[a: :a], @hash.slice(:a) assert_equal Sinatra::IndifferentHash[b: :b], @hash.slice(?b) assert_equal Sinatra::IndifferentHash[3 => 3], @hash.slice(3) @@ -186,8 +174,6 @@ class TestIndifferentHash < Minitest::Test end def test_fetch_values - skip_if_lacking :fetch_values - assert_raises(KeyError) { @hash.fetch_values(3, :d) } assert_equal [:a, :b, 3, ?D], @hash.fetch_values(:a, ?b, 3, :d) { |k| k.upcase } end @@ -225,16 +211,12 @@ class TestIndifferentHash < Minitest::Test end def test_transform_values! - skip_if_lacking :transform_values! - @hash.transform_values! { |v| v.is_a?(Hash) ? Hash[v.to_a] : v } assert_instance_of Sinatra::IndifferentHash, @hash[:simple_nested] end def test_transform_values - skip_if_lacking :transform_values - hash2 = @hash.transform_values { |v| v.respond_to?(:upcase) ? v.upcase : v } refute_equal @hash, hash2 @@ -243,8 +225,6 @@ class TestIndifferentHash < Minitest::Test end def test_transform_keys! - skip_if_lacking :transform_keys! - @hash.transform_keys! { |k| k.respond_to?(:to_sym) ? k.to_sym : k } assert_equal :a, @hash[:a] @@ -252,8 +232,6 @@ class TestIndifferentHash < Minitest::Test end def test_transform_keys - skip_if_lacking :transform_keys - hash2 = @hash.transform_keys { |k| k.respond_to?(:upcase) ? k.upcase : k } refute_equal @hash, hash2 @@ -300,8 +278,6 @@ class TestIndifferentHash < Minitest::Test end def test_compact - skip_if_lacking :compact - hash_with_nil_values = @hash.merge({?z => nil}) compacted_hash = hash_with_nil_values.compact assert_equal @hash, compacted_hash