11version_file = File.expand_path("../.rails-version", __FILE__)
22
3+ # This is required for Ruby 3.1, because in Ruby 3.1 these gems were moved to
4+ # bundled gems from default gems. This issue was fixed in Rails Rails 7.0.1.
5+ # Discussion can be found here - https://github.com/mikel/mail/pull/1439
6+ def add_net_gems_dependency
7+ if RUBY_VERSION >= '3.1'
8+ gem 'net-smtp', require: false
9+ gem 'net-imap', require: false
10+ gem 'net-pop', require: false
11+ end
12+ end
13+
314case version = ENV['RAILS_VERSION'] || (File.exist?(version_file) && File.read(version_file).chomp) || ''
415when /main/
516 gem "rails", :git => "https://github.com/rails/rails.git"
@@ -15,25 +26,16 @@ when /stable$/
1526 gem rails_gem, :git => "https://github.com/rails/rails.git", :branch => version
1627 end
1728when nil, false, ""
29+ add_net_gems_dependency # TODO: remove when we use switch to "~> 7.0.0" that declares dependency on those gems on itself
1830 gem "rails", "~> 6.0.0"
1931 gem "puma"
2032 gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
2133 gem 'selenium-webdriver', require: false
2234else
35+ add_net_gems_dependency if version.split(' ').last < '7.0'
2336 gem "rails", version
2437 gem "sprockets", '~> 3.0' if RUBY_VERSION < '2.5'
2538 gem "puma"
2639 gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
2740 gem 'selenium-webdriver', require: false
2841end
29-
30- # This is required for Ruby 3.1 and Rails 6.1.x as of time
31- # of writing, because in Ruby 3.1 these gems are no longer
32- # automatically included. This issue was fixed on the Rails
33- # side in Rails 7.0.1, but is not yet fixed in the Rails 6.1.x
34- # branch. Discussion can be found here - https://github.com/mikel/mail/pull/1439
35- if RUBY_VERSION >= '3.1' && version.split(' ').last < '7.0'
36- gem 'net-smtp', require: false
37- gem 'net-imap', require: false
38- gem 'net-pop', require: false
39- end
0 commit comments