Skip to content

Commit

Permalink
Update dependencies to support ruby 3.2; drop 2.7 and rails 5.2 (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
codez authored Sep 5, 2023
1 parent b291baa commit 1b3b6b1
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 140 deletions.
12 changes: 1 addition & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,10 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ["2.7", "3.0", "3.1"]
ruby-version: ["3.0", "3.1", "3.2"]
gemfile:
- Gemfile
- test/ci/rails52.gemfile
- test/ci/rails60.gemfile
- test/ci/rails61.gemfile
exclude:
- ruby-version: "3.0"
gemfile: test/ci/rails52.gemfile
- ruby-version: "3.1"
gemfile: test/ci/rails52.gemfile
# YAML loading issue only fixed in 6.1
- ruby-version: "3.1"
gemfile: test/ci/rails60.gemfile
env:
ROOT_BUNDLE_PATH: ${{ github.workspace }}/vendor/bundle
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
Expand Down
156 changes: 82 additions & 74 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,162 +1,170 @@
PATH
remote: .
specs:
wagons (0.7.0)
wagons (0.8.0)
bundler (>= 1.1)
rails (>= 5.2)
seed-fu-ndo (>= 0.0.3)

GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.5.1)
actionpack (= 7.0.5.1)
activesupport (= 7.0.5.1)
actioncable (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.5.1)
actionpack (= 7.0.5.1)
activejob (= 7.0.5.1)
activerecord (= 7.0.5.1)
activestorage (= 7.0.5.1)
activesupport (= 7.0.5.1)
actionmailbox (7.0.7.2)
actionpack (= 7.0.7.2)
activejob (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.5.1)
actionpack (= 7.0.5.1)
actionview (= 7.0.5.1)
activejob (= 7.0.5.1)
activesupport (= 7.0.5.1)
actionmailer (7.0.7.2)
actionpack (= 7.0.7.2)
actionview (= 7.0.7.2)
activejob (= 7.0.7.2)
activesupport (= 7.0.7.2)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.5.1)
actionview (= 7.0.5.1)
activesupport (= 7.0.5.1)
actionpack (7.0.7.2)
actionview (= 7.0.7.2)
activesupport (= 7.0.7.2)
rack (~> 2.0, >= 2.2.4)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.5.1)
actionpack (= 7.0.5.1)
activerecord (= 7.0.5.1)
activestorage (= 7.0.5.1)
activesupport (= 7.0.5.1)
actiontext (7.0.7.2)
actionpack (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.5.1)
activesupport (= 7.0.5.1)
actionview (7.0.7.2)
activesupport (= 7.0.7.2)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.5.1)
activesupport (= 7.0.5.1)
activejob (7.0.7.2)
activesupport (= 7.0.7.2)
globalid (>= 0.3.6)
activemodel (7.0.5.1)
activesupport (= 7.0.5.1)
activerecord (7.0.5.1)
activemodel (= 7.0.5.1)
activesupport (= 7.0.5.1)
activestorage (7.0.5.1)
actionpack (= 7.0.5.1)
activejob (= 7.0.5.1)
activerecord (= 7.0.5.1)
activesupport (= 7.0.5.1)
activemodel (7.0.7.2)
activesupport (= 7.0.7.2)
activerecord (7.0.7.2)
activemodel (= 7.0.7.2)
activesupport (= 7.0.7.2)
activestorage (7.0.7.2)
actionpack (= 7.0.7.2)
activejob (= 7.0.7.2)
activerecord (= 7.0.7.2)
activesupport (= 7.0.7.2)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.5.1)
activesupport (7.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
builder (3.2.4)
concurrent-ruby (1.2.2)
crass (1.0.6)
date (3.3.3)
erubi (1.12.0)
globalid (1.1.0)
activesupport (>= 5.0)
globalid (1.2.0)
activesupport (>= 6.1)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
loofah (2.21.3)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.7.1)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.2)
method_source (1.0.0)
mini_mime (1.1.2)
mini_portile2 (2.8.2)
minitest (5.18.1)
mocha (1.15.0)
net-imap (0.3.1)
mini_mime (1.1.5)
mini_portile2 (2.8.4)
minitest (5.19.0)
mocha (2.1.0)
ruby2_keywords (>= 0.0.5)
net-imap (0.3.7)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.1.3)
net-protocol (0.2.1)
timeout
net-smtp (0.3.2)
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
nokogiri (1.15.2)
nio4r (2.5.9)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
open4 (1.3.4)
racc (1.7.1)
rack (2.2.7)
rack (2.2.8)
rack-test (2.1.0)
rack (>= 1.3)
rails (7.0.5.1)
actioncable (= 7.0.5.1)
actionmailbox (= 7.0.5.1)
actionmailer (= 7.0.5.1)
actionpack (= 7.0.5.1)
actiontext (= 7.0.5.1)
actionview (= 7.0.5.1)
activejob (= 7.0.5.1)
activemodel (= 7.0.5.1)
activerecord (= 7.0.5.1)
activestorage (= 7.0.5.1)
activesupport (= 7.0.5.1)
rails (7.0.7.2)
actioncable (= 7.0.7.2)
actionmailbox (= 7.0.7.2)
actionmailer (= 7.0.7.2)
actionpack (= 7.0.7.2)
actiontext (= 7.0.7.2)
actionview (= 7.0.7.2)
activejob (= 7.0.7.2)
activemodel (= 7.0.7.2)
activerecord (= 7.0.7.2)
activestorage (= 7.0.7.2)
activesupport (= 7.0.7.2)
bundler (>= 1.15.0)
railties (= 7.0.5.1)
railties (= 7.0.7.2)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
actionview (>= 5.0.1.rc1)
activesupport (>= 5.0.1.rc1)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (7.0.5.1)
actionpack (= 7.0.5.1)
activesupport (= 7.0.5.1)
railties (7.0.7.2)
actionpack (= 7.0.7.2)
activesupport (= 7.0.7.2)
method_source
rake (>= 12.2)
thor (~> 1.0)
zeitwerk (~> 2.5)
rake (13.0.6)
ruby2_keywords (0.0.5)
seed-fu (2.3.9)
activerecord (>= 3.1)
activesupport (>= 3.1)
seed-fu-ndo (0.0.3)
seed-fu (>= 2.2.0)
sqlite3 (1.5.3)
sqlite3 (1.6.4)
mini_portile2 (~> 2.8.0)
thor (1.2.1)
timeout (0.3.0)
thor (1.2.2)
timeout (0.4.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
websocket-driver (0.7.5)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.6.1)
zeitwerk (2.6.11)

PLATFORMS
ruby
Expand Down
21 changes: 7 additions & 14 deletions lib/tasks/wagons.rake
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,12 @@ eval(File.read(wagonfile)) if File.exist?(wagonfile)"
task :abort_if_pending_migrations => :environment do
paths = wagons.collect(&:migrations_paths).flatten

pending_migrations =
if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('6.0.0')
context = ActiveRecord::MigrationContext.new(paths)
ActiveRecord::Migrator.new(:up, context.migrations).pending_migrations
else
context = ActiveRecord::MigrationContext.new(paths, ActiveRecord::SchemaMigration)
ActiveRecord::Migrator.new(:up, context.migrations, ActiveRecord::SchemaMigration).pending_migrations
end
context = ActiveRecord::MigrationContext.new(paths, ActiveRecord::SchemaMigration)
pending_migrations = ActiveRecord::Migrator.new(
:up,
context.migrations,
ActiveRecord::SchemaMigration
).pending_migrations

if pending_migrations.any?
puts "You have #{pending_migrations.size} pending migrations:"
Expand Down Expand Up @@ -188,12 +186,7 @@ namespace :db do
Rake::Task[:'db:_dump'].clear_actions

task :_dump do
context =
if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('6.0.0')
ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths)
else
ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths, ActiveRecord::SchemaMigration)
end
context = ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths, ActiveRecord::SchemaMigration)
migrated = Set.new(context.get_all_versions)
if migrated.size > context.migrations.size
puts "The database schema will not be dumped when there are loaded wagon migrations."
Expand Down
13 changes: 2 additions & 11 deletions lib/wagons/extensions/migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@ def load_wagon_schema!

# Contrary to the original rails approach (#load_schema_if_pending!),
# purge the database first to get rid of all wagon tables.
config =
if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('6.1.0')
Base.configurations['test']
else
Base.configurations.configs_for(env_name: 'test').first
end
config = Base.configurations.configs_for(env_name: 'test').first
Tasks::DatabaseTasks.purge(config)

Base.establish_connection(config)
Expand Down Expand Up @@ -60,11 +55,7 @@ def migration_versions_in_db
end

def migration_context
if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('6.0.0')
MigrationContext.new(Migrator.migrations_paths)
else
MigrationContext.new(Migrator.migrations_paths, SchemaMigration)
end
MigrationContext.new(Migrator.migrations_paths, SchemaMigration)
end

def maintain_test_schema?
Expand Down
2 changes: 1 addition & 1 deletion lib/wagons/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Wagons
VERSION = '0.7.0'
VERSION = '0.8.0'
end
6 changes: 1 addition & 5 deletions lib/wagons/wagon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,7 @@ def migrate_to(version)
end

def migration_context
if Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new('6.0.0')
ActiveRecord::MigrationContext.new(migrations_paths)
else
ActiveRecord::MigrationContext.new(migrations_paths, ActiveRecord::SchemaMigration)
end
ActiveRecord::MigrationContext.new(migrations_paths, ActiveRecord::SchemaMigration)
end

module ClassMethods
Expand Down
10 changes: 0 additions & 10 deletions test/ci/rails52.gemfile

This file was deleted.

11 changes: 0 additions & 11 deletions test/ci/rails60.gemfile

This file was deleted.

3 changes: 0 additions & 3 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@

Rails.backtrace_cleaner.remove_silencers!

# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }

# Load fixtures from the engine
if ActiveSupport::TestCase.method_defined?(:fixture_path=)
ActiveSupport::TestCase.fixture_path = File.expand_path('../fixtures', __FILE__)
Expand Down

0 comments on commit 1b3b6b1

Please sign in to comment.