From 1b469833e0dc0b8fab70db69198f3ff00e29e2f4 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Tue, 2 Jan 2024 15:56:19 -0300 Subject: [PATCH 1/2] Drop support for Rails 5 Eliminates a small amount of implementation complexity and future maintenance overhead. Rails 5 has been EOL since 2022-06-01. --- .github/workflows/test.yml | 3 --- CHANGELOG.md | 1 + README.md | 4 ++-- departure.gemspec | 4 ++-- spec/spec_helper.rb | 21 +++------------------ 5 files changed, 8 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ad8f36d1..318a4527 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,13 +12,10 @@ jobs: - 2.6 - 2.7 rails: - - 5.2.0 - 6.0.0 - 6.1.0 - 7.1.2 include: - - ruby: 2.4 - rails: 5.2.0 - ruby: 2.7 rails: 7.0.1 - ruby: 3.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 93894107..90766a90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Please follow the format in [Keep a Changelog](http://keepachangelog.com/) - Fix support for Rails 6.0 and ForAlter `remove_index` . - Support Rails 7.1.2 +- Remove support for Rails 5 ## [6.5.0] - 2023-01-24 diff --git a/README.md b/README.md index 5a35b946..fcf16656 100644 --- a/README.md +++ b/README.md @@ -153,7 +153,7 @@ Departure gem is enabled by default. In order to disable it on a particular migration the method `disable_departure!` should be used. ```ruby -class UseDepartureMigration < ActiveRecord::Migration[5.2] +class UseDepartureMigration < ActiveRecord::Migration[7.1] disable_departure! def up @@ -170,7 +170,7 @@ If you wish to only have Departure enabled per-migration, set `config.enabled_by Then, add a `uses_departure!` statement in migrations where Departure should be used: ```ruby -class UseDepartureMigration < ActiveRecord::Migration[5.2] +class UseDepartureMigration < ActiveRecord::Migration[7.1] uses_departure! def up diff --git a/departure.gemspec b/departure.gemspec index 3d2a4d8a..8baee856 100644 --- a/departure.gemspec +++ b/departure.gemspec @@ -7,7 +7,7 @@ require 'departure/version' # This environment variable is set on CI to facilitate testing with multiple # versions of Rails. -RAILS_DEPENDENCY_VERSION = ENV.fetch('RAILS_VERSION', ['>= 5.2.0', '!= 7.0.0', '< 7.2.0']) +RAILS_DEPENDENCY_VERSION = ENV.fetch('RAILS_VERSION', ['>= 6.0.0', '!= 7.0.0', '< 7.2.0']) Gem::Specification.new do |spec| spec.name = 'departure' @@ -23,7 +23,7 @@ Gem::Specification.new do |spec| spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 2.4.0' + spec.required_ruby_version = '>= 2.5.0' spec.add_runtime_dependency 'railties', *Array(RAILS_DEPENDENCY_VERSION) spec.add_runtime_dependency 'activerecord', *Array(RAILS_DEPENDENCY_VERSION) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ac4250e4..e23e6750 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -56,18 +56,8 @@ Kernel.srand config.seed end -# This shim is for Rails 5.2 compatibility in the test -module Rails5Compatibility - module Migrator - def initialize(direction, migrations, schema_migration_or_target_version = nil, target_version = nil) - if schema_migration_or_target_version == ActiveRecord::SchemaMigration - super(direction, migrations, target_version) - else - super(direction, migrations, schema_migration_or_target_version) - end - end - end - +# This shim is for Rails 7.1 compatibility in the test +module Rails7Compatibility module MigrationContext def initialize(migrations_paths, schema_migration = nil) super(migrations_paths) @@ -75,11 +65,6 @@ def initialize(migrations_paths, schema_migration = nil) end end -if ActiveRecord::VERSION::MAJOR < 6 - ActiveRecord::Migrator.send :prepend, Rails5Compatibility::Migrator - ActiveRecord::MigrationContext.send :prepend, Rails5Compatibility::MigrationContext -end - if ActiveRecord::VERSION::STRING >= '7.1' - ActiveRecord::MigrationContext.send :prepend, Rails5Compatibility::MigrationContext + ActiveRecord::MigrationContext.send :prepend, Rails7Compatibility::MigrationContext end From ad9c1c5376eb6a6b2e95bdb11d0ff7153d1c0480 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Tue, 2 Jan 2024 18:16:40 -0300 Subject: [PATCH 2/2] Drop support for all super-old Ruby/Rails --- .github/workflows/test.yml | 19 ------------------- CHANGELOG.md | 2 +- departure.gemspec | 2 +- 3 files changed, 2 insertions(+), 21 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d4104b89..b789b32f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,9 +8,6 @@ jobs: fail-fast: false matrix: ruby: - - 2.4 - - 2.5 - - 2.6 - 2.7 - 3.0 - 3.1 @@ -22,22 +19,6 @@ jobs: - 7.0.1 - 7.1.2 exclude: # These Rails versions are too new for the respective Ruby versions, or vice-versa - - ruby: 2.4 - rails: 6.0.0 - - ruby: 2.4 - rails: 6.1.0 - - ruby: 2.4 - rails: 7.0.1 - - ruby: 2.4 - rails: 7.1.2 - - ruby: 2.5 - rails: 7.0.1 - - ruby: 2.5 - rails: 7.1.2 - - ruby: 2.6 - rails: 7.0.1 - - ruby: 2.6 - rails: 7.1.2 - ruby: 3.0 rails: 6.0.0 - ruby: 3.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 93dcf54d..e4cd4706 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ Please follow the format in [Keep a Changelog](http://keepachangelog.com/) ## [Unreleased] -- Remove support for Rails 5 +- Drop support for older than the latest EOL Ruby (2.7) and Rails (6.0) ## [6.6.0] - 2024-01-02 diff --git a/departure.gemspec b/departure.gemspec index 8baee856..01bada75 100644 --- a/departure.gemspec +++ b/departure.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |spec| spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } spec.require_paths = ['lib'] - spec.required_ruby_version = '>= 2.5.0' + spec.required_ruby_version = '>= 2.7.0' spec.add_runtime_dependency 'railties', *Array(RAILS_DEPENDENCY_VERSION) spec.add_runtime_dependency 'activerecord', *Array(RAILS_DEPENDENCY_VERSION)