Skip to content

A platform for community discussion. Free, open, simple.

DEV: Update minimum and recommended ruby versions (#19615)

David Taylord24dfe8f96c4
diff --git a/.ruby-version.sample b/.ruby-version.sample
index 49cdd668e1c..ff365e06b95 100644
--- a/.ruby-version.sample
+++ b/.ruby-version.sample
@@ -1 +1 @@
-2.7.6
+3.1.3
diff --git a/config/application.rb b/config/application.rb
index 019aec63dc4..1c69f3d99ca 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -1,15 +1,7 @@
# frozen_string_literal: true
-# note, we require 2.5.2 and up cause 2.5.1 had some mail bugs we no longer
-# monkey patch, so this avoids people booting with this problem version
-begin
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.5.2")
- STDERR.puts "Discourse requires Ruby 2.5.2 or up"
- exit 1
- end
-rescue
- # no String#match?
- STDERR.puts "Discourse requires Ruby 2.5.2 or up"
+if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7.0")
+ STDERR.puts "Discourse requires Ruby 2.7 or above"
exit 1
end
@@ -20,6 +12,13 @@ require 'action_view/railtie'
require 'action_mailer/railtie'
require 'sprockets/railtie'
+if !Rails.env.production?
+ recommended = File.read(".ruby-version.sample").strip
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new(recommended)
+ STDERR.puts "[Warning] Discourse recommends developing using Ruby v#{recommended} or above. You are using v#{RUBY_VERSION}."
+ end
+end
+
# Plugin related stuff
require_relative '../lib/plugin'
require_relative '../lib/discourse_event'