Skip to content

Commit 58fee01

Browse files
authored
Merge pull request #2569 from rspec/fix-sub-builds-2
Fix undefined Rails version for other repos sub-builds
2 parents 529f5dc + 383bd23 commit 58fee01

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Gemfile-rails-dependencies

+13-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
version_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+
314
case version = ENV['RAILS_VERSION'] || (File.exist?(version_file) && File.read(version_file).chomp) || ''
415
when /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
1728
when 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
2234
else
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
2841
end
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

Comments
 (0)