diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5431978..bce421c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 }} diff --git a/Gemfile.lock b/Gemfile.lock index 08a39ea..9051174 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - wagons (0.7.0) + wagons (0.8.0) bundler (>= 1.1) rails (>= 5.2) seed-fu-ndo (>= 0.0.3) @@ -9,67 +9,67 @@ PATH 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) @@ -77,86 +77,94 @@ GEM 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 diff --git a/lib/tasks/wagons.rake b/lib/tasks/wagons.rake index eabb3c2..e66c3d2 100644 --- a/lib/tasks/wagons.rake +++ b/lib/tasks/wagons.rake @@ -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:" @@ -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." diff --git a/lib/wagons/extensions/migration.rb b/lib/wagons/extensions/migration.rb index 228bc8b..d676d9a 100644 --- a/lib/wagons/extensions/migration.rb +++ b/lib/wagons/extensions/migration.rb @@ -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) @@ -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? diff --git a/lib/wagons/version.rb b/lib/wagons/version.rb index 0a5cca6..bf9004f 100644 --- a/lib/wagons/version.rb +++ b/lib/wagons/version.rb @@ -1,3 +1,3 @@ module Wagons - VERSION = '0.7.0' + VERSION = '0.8.0' end diff --git a/lib/wagons/wagon.rb b/lib/wagons/wagon.rb index f93829b..5257dc7 100644 --- a/lib/wagons/wagon.rb +++ b/lib/wagons/wagon.rb @@ -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 diff --git a/test/ci/rails52.gemfile b/test/ci/rails52.gemfile deleted file mode 100644 index b991472..0000000 --- a/test/ci/rails52.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -source 'https://rubygems.org' - -gemspec :path => '../..' - -gem 'rails', '~> 5.2.0' - -group :test do - gem 'mocha', :require => false - gem 'rails-controller-testing' -end diff --git a/test/ci/rails60.gemfile b/test/ci/rails60.gemfile deleted file mode 100644 index d236475..0000000 --- a/test/ci/rails60.gemfile +++ /dev/null @@ -1,11 +0,0 @@ -source 'https://rubygems.org' - -gemspec :path => '../..' - -gem 'rails', '~> 6.0.0' - -group :test do - gem 'mocha', :require => false - gem 'net-smtp' - gem 'rails-controller-testing' -end diff --git a/test/test_helper.rb b/test/test_helper.rb index e6f29ac..eb59895 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -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__)