Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for Rails 5 & Ruby < 2.7 #99

Merged
merged 4 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

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.5.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 @@ -56,30 +56,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