From d24dfe8f96c4151cbd6dbcc2313b42a0bf291c7d Mon Sep 17 00:00:00 2001 From: David Taylor Date: Wed, 28 Dec 2022 10:09:15 +0000 Subject: [PATCH] DEV: Update minimum and recommended ruby versions (#19615) Minimum: 2.7.0 Recommended: 3.1.3 --- .ruby-version.sample | 2 +- config/application.rb | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) 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'