From 89c2f8530a18f401c01b76cc6ab495842609b26d Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Sat, 30 Dec 2023 19:46:43 +0100 Subject: [PATCH 1/2] Bump the required Ruby version to 3.1.0 Until now, Rails only droped compatibility with older rubies on new majors, but I propose to change this policy because it causes us to either keep compatibility with long EOLed rubies or to bump the Rails major more often, and to drop multiple Ruby versions at once when we bump the major. In my opinion it's a bad alignments of incentives. And we'd be much better to just drop support in new minors whenever they go EOL (so 3 years). Also Ruby being an upstream dependency, it's not even a semver violation AFAICT. Since Rails 7.2 isn't planned before a few months, we can already drop Ruby 3.0 as it will be EOL in March. --- actioncable/actioncable.gemspec | 2 +- actionmailbox/actionmailbox.gemspec | 2 +- actionmailer/actionmailer.gemspec | 2 +- actionpack/actionpack.gemspec | 2 +- actiontext/actiontext.gemspec | 2 +- actionview/actionview.gemspec | 2 +- activejob/activejob.gemspec | 2 +- activemodel/activemodel.gemspec | 2 +- activerecord/activerecord.gemspec | 2 +- activestorage/activestorage.gemspec | 2 +- activesupport/activesupport.gemspec | 2 +- railties/railties.gemspec | 2 +- tools/rail_inspector/rail_inspector.gemspec | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/actioncable/actioncable.gemspec b/actioncable/actioncable.gemspec index ca4a888c4d112..932f7ae808c54 100644 --- a/actioncable/actioncable.gemspec +++ b/actioncable/actioncable.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "WebSocket framework for Rails." s.description = "Structure many real-time application concerns into channels over a single WebSocket connection." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/actionmailbox/actionmailbox.gemspec b/actionmailbox/actionmailbox.gemspec index 6f07f54e47cc2..f6d09e79a8726 100644 --- a/actionmailbox/actionmailbox.gemspec +++ b/actionmailbox/actionmailbox.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "Inbound email handling framework." s.description = "Receive and process incoming emails in Rails applications." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/actionmailer/actionmailer.gemspec b/actionmailer/actionmailer.gemspec index 602bb15ca677c..6af02c1bbe686 100644 --- a/actionmailer/actionmailer.gemspec +++ b/actionmailer/actionmailer.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "Email composition and delivery framework (part of Rails)." s.description = "Email on Rails. Compose, deliver, and test emails using the familiar controller/view pattern. First-class support for multipart email and attachments." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/actionpack/actionpack.gemspec b/actionpack/actionpack.gemspec index c4a311dd2c1c7..d144f4d4b895d 100644 --- a/actionpack/actionpack.gemspec +++ b/actionpack/actionpack.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "Web-flow and rendering framework putting the VC in MVC (part of Rails)." s.description = "Web apps on Rails. Simple, battle-tested conventions for building and testing MVC web applications. Works with any Rack-compatible server." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/actiontext/actiontext.gemspec b/actiontext/actiontext.gemspec index 5fbf777b8016e..058bf24e783fe 100644 --- a/actiontext/actiontext.gemspec +++ b/actiontext/actiontext.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "Rich text framework." s.description = "Edit and display rich text in Rails applications." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/actionview/actionview.gemspec b/actionview/actionview.gemspec index 06d8e3ac5dfd1..e6ebb2c7dd4da 100644 --- a/actionview/actionview.gemspec +++ b/actionview/actionview.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "Rendering framework putting the V in MVC (part of Rails)." s.description = "Simple, battle-tested conventions and helpers for building web pages." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/activejob/activejob.gemspec b/activejob/activejob.gemspec index cf0be7e0ca7ae..4a739293d2430 100644 --- a/activejob/activejob.gemspec +++ b/activejob/activejob.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "Job framework with pluggable queues." s.description = "Declare job classes that can be run by a variety of queuing backends." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/activemodel/activemodel.gemspec b/activemodel/activemodel.gemspec index d300addabeb1a..4f0696814ad5c 100644 --- a/activemodel/activemodel.gemspec +++ b/activemodel/activemodel.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "A toolkit for building modeling frameworks (part of Rails)." s.description = "A toolkit for building modeling frameworks like Active Record. Rich support for attributes, callbacks, validations, serialization, internationalization, and testing." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/activerecord/activerecord.gemspec b/activerecord/activerecord.gemspec index 016528bfdc332..c235d33fdc06e 100644 --- a/activerecord/activerecord.gemspec +++ b/activerecord/activerecord.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "Object-relational mapper framework (part of Rails)." s.description = "Databases on Rails. Build a persistent domain model by mapping database tables to Ruby classes. Strong conventions for associations, validations, aggregations, migrations, and testing come baked-in." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/activestorage/activestorage.gemspec b/activestorage/activestorage.gemspec index 8adcc5a9314c4..863a275a547cc 100644 --- a/activestorage/activestorage.gemspec +++ b/activestorage/activestorage.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "Local and cloud file storage framework." s.description = "Attach cloud and local files in Rails applications." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/activesupport/activesupport.gemspec b/activesupport/activesupport.gemspec index ce8603293e704..17fb20f2a4c3d 100644 --- a/activesupport/activesupport.gemspec +++ b/activesupport/activesupport.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "A toolkit of support libraries and Ruby core extensions extracted from the Rails framework." s.description = "A toolkit of support libraries and Ruby core extensions extracted from the Rails framework. Rich support for multibyte strings, internationalization, time zones, and testing." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/railties/railties.gemspec b/railties/railties.gemspec index 1ad7f49062136..044a89de1c741 100644 --- a/railties/railties.gemspec +++ b/railties/railties.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.summary = "Tools for creating, working with, and running Rails applications." s.description = "Rails internals: application bootup, plugins, generators, and rake tasks." - s.required_ruby_version = ">= 2.7.0" + s.required_ruby_version = ">= 3.1.0" s.license = "MIT" diff --git a/tools/rail_inspector/rail_inspector.gemspec b/tools/rail_inspector/rail_inspector.gemspec index 1655e34810dcd..b23a6bfef903b 100644 --- a/tools/rail_inspector/rail_inspector.gemspec +++ b/tools/rail_inspector/rail_inspector.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |spec| spec.summary = "A collection of linters for rails/rails" spec.homepage = "https://github.com/skipkayhil/rail_inspector" spec.license = "MIT" - spec.required_ruby_version = ">= 2.7.0" + spec.required_ruby_version = ">= 3.1.0" spec.metadata["homepage_uri"] = spec.homepage spec.metadata["source_code_uri"] = spec.homepage From 110a4e6abc1708872b01ed556bcffe391581579c Mon Sep 17 00:00:00 2001 From: zzak Date: Sun, 31 Dec 2023 12:22:47 +0900 Subject: [PATCH 2/2] Remove Ruby version check Also includes relevant docs, inspired by 6487836af8 --- guides/source/active_record_postgresql.md | 4 ++-- guides/source/command_line.md | 4 ++-- guides/source/getting_started.md | 4 ++-- guides/source/upgrading_ruby_on_rails.md | 3 ++- railties/lib/rails.rb | 2 -- railties/lib/rails/cli.rb | 1 - railties/lib/rails/ruby_version_check.rb | 17 ----------------- 7 files changed, 8 insertions(+), 27 deletions(-) delete mode 100644 railties/lib/rails/ruby_version_check.rb diff --git a/guides/source/active_record_postgresql.md b/guides/source/active_record_postgresql.md index eb7088d79ee59..ea347f291b037 100644 --- a/guides/source/active_record_postgresql.md +++ b/guides/source/active_record_postgresql.md @@ -170,7 +170,7 @@ irb> Event.where("payload->>'kind' = ?", "user_renamed") * [type definition](https://www.postgresql.org/docs/current/static/rangetypes.html) * [functions and operators](https://www.postgresql.org/docs/current/static/functions-range.html) -This type is mapped to Ruby [`Range`](https://ruby-doc.org/core-2.7.0/Range.html) objects. +This type is mapped to Ruby [`Range`](https://ruby-doc.org/core-3.1.0/Range.html) objects. ```ruby # db/migrate/20130923065404_create_events.rb @@ -449,7 +449,7 @@ irb> user.save! * [type definition](https://www.postgresql.org/docs/current/static/datatype-net-types.html) The types `inet` and `cidr` are mapped to Ruby -[`IPAddr`](https://ruby-doc.org/stdlib-2.7.0/libdoc/ipaddr/rdoc/IPAddr.html) +[`IPAddr`](https://ruby-doc.org/stdlib-3.1.0/libdoc/ipaddr/rdoc/IPAddr.html) objects. The `macaddr` type is mapped to normal text. ```ruby diff --git a/guides/source/command_line.md b/guides/source/command_line.md index a48cc26477ba0..b79f0bd84c618 100644 --- a/guides/source/command_line.md +++ b/guides/source/command_line.md @@ -508,8 +508,8 @@ $ bin/rails destroy model Oops $ bin/rails about About your application's environment Rails version 7.2.0 -Ruby version 2.7.0 (x86_64-linux) -RubyGems version 2.7.3 +Ruby version 3.1.0 (x86_64-linux) +RubyGems version 3.3.7 Rack version 3.0.8 JavaScript Runtime Node.js (V8) Middleware: ActionDispatch::HostAuthorization, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActionDispatch::ServerTiming, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Sprockets::Rails::QuietAssets, Rails::Rack::Logger, ActionDispatch::ShowExceptions, WebConsole::Middleware, ActionDispatch::DebugExceptions, ActionDispatch::ActionableExceptions, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, ActionDispatch::PermissionsPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md index 9044e5d7c18d7..1b38d20632458 100644 --- a/guides/source/getting_started.md +++ b/guides/source/getting_started.md @@ -93,10 +93,10 @@ current version of Ruby installed: ```bash $ ruby --version -ruby 2.7.0 +ruby 3.1.0 ``` -Rails requires Ruby version 2.7.0 or later. It is preferred to use the latest Ruby version. +Rails requires Ruby version 3.1.0 or later. It is preferred to use the latest Ruby version. If the version number returned is less than that number (such as 2.3.7, or 1.8.7), you'll need to install a fresh copy of Ruby. diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md index 0fe8b1e2ab22c..7896a86d311de 100644 --- a/guides/source/upgrading_ruby_on_rails.md +++ b/guides/source/upgrading_ruby_on_rails.md @@ -20,7 +20,8 @@ The best way to be sure that your application still works after upgrading is to Rails generally stays close to the latest released Ruby version when it's released: -* Rails 7 requires Ruby 2.7.0 or newer. +* Rails 7.2 requires Ruby 3.1.0 or newer. +* Rails 7.0 and 7.1 requires Ruby 2.7.0 or newer. * Rails 6 requires Ruby 2.5.0 or newer. * Rails 5 requires Ruby 2.2.2 or newer. diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb index f4fa213bfece1..3d17f034895fb 100644 --- a/railties/lib/rails.rb +++ b/railties/lib/rails.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -require "rails/ruby_version_check" - require "pathname" require "active_support" diff --git a/railties/lib/rails/cli.rb b/railties/lib/rails/cli.rb index a56da65b0657d..7bbfcf748968a 100644 --- a/railties/lib/rails/cli.rb +++ b/railties/lib/rails/cli.rb @@ -6,7 +6,6 @@ # the rest of this script is not run. Rails::AppLoader.exec_app -require "rails/ruby_version_check" Signal.trap("INT") { puts; exit(1) } require "rails/command" diff --git a/railties/lib/rails/ruby_version_check.rb b/railties/lib/rails/ruby_version_check.rb deleted file mode 100644 index 0cf64d154126a..0000000000000 --- a/railties/lib/rails/ruby_version_check.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -# :stopdoc: - -if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7.0") && RUBY_ENGINE == "ruby" - desc = defined?(RUBY_DESCRIPTION) ? RUBY_DESCRIPTION : "ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE})" - abort <<-end_message - - Rails 7 requires Ruby 2.7.0 or newer. - - You're running - #{desc} - - Please upgrade to Ruby 2.7.0 or newer to continue. - - end_message -end