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

Minimum: 2.7.0
Recommended: 3.1.3
This commit is contained in:
David Taylor 2022-12-28 10:09:15 +00:00 committed by GitHub
parent d914ea8366
commit d24dfe8f96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 11 deletions

View File

@ -1 +1 @@
2.7.6 3.1.3

View File

@ -1,15 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
# note, we require 2.5.2 and up cause 2.5.1 had some mail bugs we no longer if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7.0")
# monkey patch, so this avoids people booting with this problem version STDERR.puts "Discourse requires Ruby 2.7 or above"
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"
exit 1 exit 1
end end
@ -20,6 +12,13 @@ require 'action_view/railtie'
require 'action_mailer/railtie' require 'action_mailer/railtie'
require 'sprockets/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 # Plugin related stuff
require_relative '../lib/plugin' require_relative '../lib/plugin'
require_relative '../lib/discourse_event' require_relative '../lib/discourse_event'