Drop support for Rails 5.2 (reached EoL on 2022-06-01)

This commit is contained in:
Jared Beck 2022-10-16 00:54:14 -04:00
parent 6eb5c39e7e
commit 3f0e3aba2e
9 changed files with 21 additions and 66 deletions

View File

@ -48,29 +48,18 @@ Testing is a little awkward because the test suite:
1. Contains a "dummy" rails app with three databases (test, foo, and bar)
1. Supports three different RDBMS': sqlite, mysql, and postgres
### Test sqlite, AR 6
### Test
For most development, testing with sqlite only is easiest and sufficient. CI
will run the rest.
```
DB=sqlite bundle exec appraisal rails-6.0 rake
```
### Test sqlite, AR 5
```
DB=sqlite bundle exec appraisal rails-5.2 rake
```
### Test mysql, AR 5
```
DB=mysql bundle exec appraisal rails-5.2 rake
```
### Test postgres, AR 5
```
DB=sqlite bundle exec appraisal rails-6.1 rake
DB=sqlite bundle exec appraisal rails-7.0 rake
DB=mysql bundle exec appraisal rails-7.0 rake
createuser --superuser postgres
DB=postgres bundle exec appraisal rails-5.2 rake
DB=postgres bundle exec appraisal rails-7.0 rake
```
## The dummy_app
@ -80,7 +69,7 @@ In the rare event you need a `console` in the `dummy_app`:
```
cd spec/dummy_app
cp config/database.mysql.yml config/database.yml
BUNDLE_GEMFILE='../../gemfiles/rails_5.2.gemfile' bin/rails console -e test
BUNDLE_GEMFILE='../../gemfiles/rails_7.0.gemfile' bin/rails console -e test
```
## Adding new schema

View File

@ -59,7 +59,7 @@ jobs:
# have set this up with each database as a separate job, but then we'd be
# duplicating the matrix configuration three times.
matrix:
gemfile: [ 'rails_5.2', 'rails_6.0', 'rails_6.1', 'rails_7.0' ]
gemfile: [ 'rails_6.0', 'rails_6.1', 'rails_7.0' ]
# To keep matrix size down, only test highest and lowest rubies.
# Ruby 3.0 is an exception. For now, let's continue to test against 2.7
@ -69,12 +69,6 @@ jobs:
ruby: [ '2.6', '2.7', '3.0', '3.1' ]
exclude:
# rails 5.2 requires ruby < 3.0
# https://github.com/rails/rails/issues/40938
- ruby: '3.0'
gemfile: 'rails_5.2'
- ruby: '3.1'
gemfile: 'rails_5.2'
# rails 7 requires ruby > 2.7
- ruby: '2.6'
gemfile: 'rails_7.0'

View File

@ -8,12 +8,6 @@
# > appraisal. If something is specified in both the Gemfile and an appraisal,
# > the version from the appraisal takes precedence.
# > https://github.com/thoughtbot/appraisal
#
#
appraise "rails-5.2" do
gem "rails", "~> 5.2.4"
gem "rails-controller-testing", "~> 1.0.2"
end
appraise "rails-6.0" do
gem "rails", "~> 6.0.3"

View File

@ -7,7 +7,11 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).
### Breaking Changes
- None
- None, but see Dependencies below
### Dependencies
- Drop support for Rails 5.2, which reached EoL on 2022-06-01
### Added

View File

@ -90,7 +90,7 @@ Choose version:
| paper_trail | branch | ruby | activerecord |
|-------------|------------|----------|---------------|
| unreleased | master | >= 2.6.0 | >= 5.2, < 7.1 |
| unreleased | master | >= 2.6.0 | >= 6.0, < 7.1 |
| 13 | 13-stable | >= 2.6.0 | >= 5.2, < 7.1 |
| 12 | 12-stable | >= 2.6.0 | >= 5.2, < 7.1 |
| 11 | 11-stable | >= 2.4.0 | >= 5.2, < 6.1 |

View File

@ -1,8 +0,0 @@
# This file was generated by Appraisal
source "https://rubygems.org"
gem "rails", "~> 5.2.4"
gem "rails-controller-testing", "~> 1.0.2"
gemspec path: "../"

View File

@ -17,7 +17,7 @@ module PaperTrail
# newer rails versions. Most PT users should avoid incompatible rails
# versions.
module Compatibility
ACTIVERECORD_GTE = ">= 5.2" # enforced in gemspec
ACTIVERECORD_GTE = ">= 6.0" # enforced in gemspec
ACTIVERECORD_LT = "< 7.1" # not enforced in gemspec
E_INCOMPATIBLE_AR = <<-EOS

View File

@ -21,13 +21,6 @@ module Dummy
config.active_support.test_order = :sorted
config.secret_key_base = "A fox regularly kicked the screaming pile of biscuits."
# In rails >= 6.0, "`.represent_boolean_as_integer=` is now always true,
# so setting this is deprecated and will be removed in Rails 6.1."
if ::ENV["DB"] == "sqlite" &&
::Gem::Requirement.new("~> 5.2").satisfied_by?(::Rails.gem_version)
config.active_record.sqlite3.represent_boolean_as_integer = true
end
# `use_yaml_unsafe_load` was added in 7.0.3.1, will be removed in 7.1.0?
if ::ActiveRecord.respond_to?(:use_yaml_unsafe_load)
::ActiveRecord.use_yaml_unsafe_load = false

View File

@ -18,22 +18,11 @@ class PaperTrailSpecMigrator
@migrations_path = dummy_app_migrations_dir
end
# Looks like the API for programmatically running migrations will change
# in rails 5.2. This is an undocumented change, AFAICT. Then again,
# how many people use the programmatic interface? Most people probably
# just use rake. Maybe we're doing it wrong.
#
# See also discussion in https://github.com/rails/rails/pull/40806, when
# MigrationContext#migrate became public.
def migrate
if ::ActiveRecord.gem_version >= ::Gem::Version.new("6.0.0.rc2")
::ActiveRecord::MigrationContext.new(
@migrations_path,
::ActiveRecord::Base.connection.schema_migration
).migrate
else
::ActiveRecord::MigrationContext.new(@migrations_path).migrate
end
::ActiveRecord::MigrationContext.new(
@migrations_path,
::ActiveRecord::Base.connection.schema_migration
).migrate
end
# Generate a migration, run it, and delete it. We use this for testing the