Skip to content

Commit

Permalink
Deprecate Rails 5.2
Browse files Browse the repository at this point in the history
Rails 5.2 reached EOL on June 1st, 2022 [1]. We're going to deprecate it
on Solidus v3.2, and remove support on the next major.

- We warn when we detect that version is used.
- We remove the Rails 5.2 job in the CI.
- We remove branching on Rails 5.2 in the specs.

We've taken solidusio#3333 for inspiration.

- [1] - https://guides.rubyonrails.org/maintenance_policy.html
  • Loading branch information
waiting-for-dev committed Jun 23, 2022
1 parent 5c0c355 commit 2ac7055
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
11 changes: 0 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,6 @@ jobs:
- setup
- test

postgres_rails52:
executor: postgres
parallelism: *parallelism
environment:
RAILS_VERSION: '~> 5.2.0'
DISABLE_ACTIVE_STORAGE: true
steps:
- setup
- test

workflows:
build:
jobs:
Expand All @@ -171,5 +161,4 @@ workflows:
- mysql
- postgres_rails61
- postgres_rails60
- postgres_rails52
- legacy_events
9 changes: 9 additions & 0 deletions core/lib/spree/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ class GatewayError < RuntimeError; end
end
end

if Gem::Version.new(Rails.version) < Gem::Version.new('5.2')
Spree::Deprecation.warn <<~HEREDOC
Rails 5.2 (EOL) is deprecated and will not be supported anymore from the next Solidus version.
Please, upgrade to a more recent Rails version.
Read more on upgrading from Rails 5.2 to Rails 6.0 here:
https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-5-2-to-rails-6-0
HEREDOC
end

require 'spree/core/version'

require 'spree/core/active_merchant_dependencies'
Expand Down
21 changes: 6 additions & 15 deletions core/spec/lib/spree/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,17 @@
before do
# ActiveSupport::Notifications does not provide an interface to clean all
# subscribers at once, so some low level brittle code is required
if Rails.gem_version >= Gem::Version.new('6.0.0')
@old_string_subscribers = notifier.instance_variable_get('@string_subscribers').dup
@old_other_subscribers = notifier.instance_variable_get('@other_subscribers').dup
notifier.instance_variable_get('@string_subscribers').clear
notifier.instance_variable_get('@other_subscribers').clear
else
@old_subscribers = notifier.instance_variable_get('@subscribers').dup
notifier.instance_variable_get('@subscribers').clear
end
@old_string_subscribers = notifier.instance_variable_get('@string_subscribers').dup
@old_other_subscribers = notifier.instance_variable_get('@other_subscribers').dup
notifier.instance_variable_get('@string_subscribers').clear
notifier.instance_variable_get('@other_subscribers').clear
@old_listeners = notifier.instance_variable_get('@listeners_for').dup
notifier.instance_variable_get('@listeners_for').clear
end

after do
if Rails.gem_version >= Gem::Version.new('6.0.0')
notifier.instance_variable_set '@string_subscribers', @old_string_subscribers
notifier.instance_variable_set '@other_subscribers', @old_other_subscribers
else
notifier.instance_variable_set '@subscribers', @old_subscribers
end
notifier.instance_variable_set '@string_subscribers', @old_string_subscribers
notifier.instance_variable_set '@other_subscribers', @old_other_subscribers
notifier.instance_variable_set '@listeners_for', @old_listeners
end

Expand Down

0 comments on commit 2ac7055

Please sign in to comment.