Skip to content

Commit

Permalink
Merge pull request departurerb#99 from departurerb/20240102-drop-rails-5
Browse files Browse the repository at this point in the history
Drop support for Rails 5 & Ruby < 2.7
  • Loading branch information
xjunior authored Jan 3, 2024
2 parents e101b5f + ad9c1c5 commit 4e27275
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 50 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,23 @@ jobs:
fail-fast: false
matrix:
ruby:
- 2.4
- 2.5
- 2.6
- 2.7
- 3.0
- 3.1
- 3.2
- 3.3
rails:
- 5.2.0
- 6.0.0
- 6.1.0
- 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: 5.2.0
- ruby: 3.0
rails: 6.0.0
- ruby: 3.1
rails: 5.2.0
- ruby: 3.1
rails: 6.0.0
- ruby: 3.2
rails: 5.2.0
- ruby: 3.2
rails: 6.0.0
- ruby: 3.3
rails: 5.2.0
- ruby: 3.3
rails: 6.0.0
env:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Please follow the format in [Keep a Changelog](http://keepachangelog.com/)

## [Unreleased]

- Drop support for older than the latest EOL Ruby (2.7) and Rails (6.0)

## [6.6.0] - 2024-01-02

- Fix support for Rails 6.0 and ForAlter `remove_index` .
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions departure.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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.7.0'

spec.add_runtime_dependency 'railties', *Array(RAILS_DEPENDENCY_VERSION)
spec.add_runtime_dependency 'activerecord', *Array(RAILS_DEPENDENCY_VERSION)
Expand Down
21 changes: 3 additions & 18 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,15 @@
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)
end
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

0 comments on commit 4e27275

Please sign in to comment.