Skip to content

Commit db695f4

Browse files
committed
Downgrade Rails on Ruby 2.2
1 parent dfed7ab commit db695f4

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

Gemfile-rails-dependencies

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ def add_net_gems_dependency
1111
end
1212
end
1313

14+
# This is only required for 5.2.x and 5-2-stable since some versions of
15+
# activesupport were released using unsupported operators for their
16+
# supported Ruby matrix, specifically the &. operator on Ruby 2.2
17+
def block_broken_activesupport
18+
return unless RUBY_VERSION < '2.3'
19+
20+
gem "activesupport", "~> 5.2", "!= 5.2.6.1", "!= 5.2.6.2"
21+
end
22+
1423
case version = ENV['RAILS_VERSION'] || (File.exist?(version_file) && File.read(version_file).chomp) || ''
1524
when /main/
1625
gem "rails", :git => "https://github.com/rails/rails.git"
@@ -23,17 +32,32 @@ when /stable$/
2332
gem 'activerecord-jdbcsqlite3-adapter', git: 'https://github.com/jruby/activerecord-jdbc-adapter', platforms: [:jruby]
2433

2534
gem_list.each do |rails_gem|
26-
gem rails_gem, :git => "https://github.com/rails/rails.git", :branch => version
35+
if version == '5-2-stable' && RUBY_VERSION < '2.3'
36+
# Until 5-2-stable is fixed on Ruby 2.2, pin to last working version
37+
gem rails_gem, :git => "https://github.com/rails/rails.git", :branch => "v5.2.0"
38+
else
39+
gem rails_gem, :git => "https://github.com/rails/rails.git", :branch => version
40+
end
2741
end
42+
43+
block_broken_activesupport if version == '5-2-stable'
2844
when nil, false, ""
2945
add_net_gems_dependency # TODO: remove when we use switch to "~> 7.0.0" that declares dependency on those gems on itself
3046
gem "rails", "~> 6.0.0"
3147
gem "puma"
3248
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]
3349
gem 'selenium-webdriver', require: false
3450
else
35-
add_net_gems_dependency if version.split(' ').last < '7.0'
51+
rails_version = version.split(' ').last
52+
53+
add_net_gems_dependency if rails_version < '7.0'
54+
3655
gem "rails", version
56+
57+
if rails_version < '6.0' && RUBY_VERSION < '2.3'
58+
gem "activesupport", "~> 5.2", "!= 5.2.6.1", "!= 5.2.6.2"
59+
end
60+
3761
gem "sprockets", '~> 3.0' if RUBY_VERSION < '2.5'
3862
gem "puma"
3963
gem 'activerecord-jdbcsqlite3-adapter', platforms: [:jruby]

0 commit comments

Comments
 (0)