From 6253f679dcc3772740f1caf15b2ae916909fe0b4 Mon Sep 17 00:00:00 2001 From: Wendy Chen Date: Tue, 29 Oct 2024 10:54:53 -0400 Subject: [PATCH] upgrade rails to 7.2.x version; clean up unsupported rails and ruby version --- .github/workflows/ci.yml | 13 +++---------- .github/workflows/gem-push.yml | 4 ++-- .gitignore | 3 +++ CHANGELOG.md | 13 +++++++++++-- gemfiles/Gemfile.rails-5.0-stable | 8 -------- gemfiles/Gemfile.rails-5.2-stable | 7 ------- gemfiles/Gemfile.rails-6.0-stable | 7 ------- gemfiles/Gemfile.rails-6.1-stable | 1 + gemfiles/Gemfile.rails-7.0-stable | 1 + ...e.rails-5.1-stable => Gemfile.rails-7.2-stable} | 2 +- lib/polymorphic_integer_type/version.rb | 2 +- polymorphic_integer_type.gemspec | 2 +- spec/polymorphic_integer_type_spec.rb | 2 +- spec/spec_helper.rb | 14 +++++--------- 14 files changed, 30 insertions(+), 49 deletions(-) delete mode 100644 gemfiles/Gemfile.rails-5.0-stable delete mode 100644 gemfiles/Gemfile.rails-5.2-stable delete mode 100644 gemfiles/Gemfile.rails-6.0-stable rename gemfiles/{Gemfile.rails-5.1-stable => Gemfile.rails-7.2-stable} (56%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index acbe4ef..4523ebb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,20 +14,13 @@ jobs: fail-fast: false matrix: gemfile: - - Gemfile.rails-5.2-stable - - Gemfile.rails-6.0-stable - Gemfile.rails-6.1-stable - Gemfile.rails-7.0-stable - ruby-version: ['3.1', '3.0', '2.7'] + - Gemfile.rails-7.2-stable + ruby-version: ['3.1', '3.0'] exclude: - - gemfile: Gemfile.rails-6.0-stable + - gemfile: Gemfile.rails-7.2-stable ruby-version: "3.0" - - gemfile: Gemfile.rails-6.0-stable - ruby-version: "3.1" - - gemfile: Gemfile.rails-5.2-stable - ruby-version: "3.0" - - gemfile: Gemfile.rails-5.2-stable - ruby-version: "3.1" env: BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }} steps: diff --git a/.github/workflows/gem-push.yml b/.github/workflows/gem-push.yml index db3aa27..5c8d227 100644 --- a/.github/workflows/gem-push.yml +++ b/.github/workflows/gem-push.yml @@ -13,10 +13,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up Ruby 3.0 + - name: Set up Ruby 3.1 uses: ruby/setup-ruby@v1 with: - ruby-version: 3.0 + ruby-version: 3.1 - name: Publish to RubyGems env: diff --git a/.gitignore b/.gitignore index 1abc64e..d0342bd 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ tmp polymorphic_integer_type_test gemfiles/*.lock .idea/ +.ruby-version +mysql +polymorphic_integer_type_test-* \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 24c5106..7e66bf5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -### Changed +# Changelog ## v3.2.1 (2023-12-14) @@ -16,4 +16,13 @@ - Fixed polymorphic_foreign_association_extension.rb to be compatible with other reflection than `has_many` and `has_one`. -### Changed \ No newline at end of file +## v3.3.0 (2024-10-29) + +### Changed + +- Upgrade rails support version to be compatible with 7.2 + +### Removed + +- Remove unsupported rails versions(5.0, 5.2, 6.0) and ruby version(2.7) + diff --git a/gemfiles/Gemfile.rails-5.0-stable b/gemfiles/Gemfile.rails-5.0-stable deleted file mode 100644 index 9d07146..0000000 --- a/gemfiles/Gemfile.rails-5.0-stable +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" - -gemspec path: ".." - -gem "activerecord", github: "rails/rails", branch: "5-0-stable" -gem "sqlite3", "~> 1.3.6" diff --git a/gemfiles/Gemfile.rails-5.2-stable b/gemfiles/Gemfile.rails-5.2-stable deleted file mode 100644 index 5882b02..0000000 --- a/gemfiles/Gemfile.rails-5.2-stable +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" - -gemspec path: ".." - -gem "activerecord", github: "rails/rails", branch: "5-2-stable" diff --git a/gemfiles/Gemfile.rails-6.0-stable b/gemfiles/Gemfile.rails-6.0-stable deleted file mode 100644 index 8b85563..0000000 --- a/gemfiles/Gemfile.rails-6.0-stable +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -source "https://rubygems.org" - -gemspec path: ".." - -gem "activerecord", github: "rails/rails", branch: "6-0-stable" diff --git a/gemfiles/Gemfile.rails-6.1-stable b/gemfiles/Gemfile.rails-6.1-stable index a50681f..5056859 100644 --- a/gemfiles/Gemfile.rails-6.1-stable +++ b/gemfiles/Gemfile.rails-6.1-stable @@ -5,3 +5,4 @@ source "https://rubygems.org" gemspec path: ".." gem "activerecord", github: "rails/rails", branch: "6-1-stable" +gem "sqlite3", "~> 1.4" diff --git a/gemfiles/Gemfile.rails-7.0-stable b/gemfiles/Gemfile.rails-7.0-stable index 8fb8ab2..83cc5c2 100644 --- a/gemfiles/Gemfile.rails-7.0-stable +++ b/gemfiles/Gemfile.rails-7.0-stable @@ -5,3 +5,4 @@ source "https://rubygems.org" gemspec path: ".." gem "activerecord", github: "rails/rails", branch: "7-0-stable" +gem "sqlite3", "~> 1.4" diff --git a/gemfiles/Gemfile.rails-5.1-stable b/gemfiles/Gemfile.rails-7.2-stable similarity index 56% rename from gemfiles/Gemfile.rails-5.1-stable rename to gemfiles/Gemfile.rails-7.2-stable index 7c93bab..84c3c79 100644 --- a/gemfiles/Gemfile.rails-5.1-stable +++ b/gemfiles/Gemfile.rails-7.2-stable @@ -4,4 +4,4 @@ source "https://rubygems.org" gemspec path: ".." -gem "activerecord", github: "rails/rails", branch: "5-1-stable" +gem "activerecord", github: "rails/rails", branch: "7-2-stable" diff --git a/lib/polymorphic_integer_type/version.rb b/lib/polymorphic_integer_type/version.rb index 1d194fe..febae78 100644 --- a/lib/polymorphic_integer_type/version.rb +++ b/lib/polymorphic_integer_type/version.rb @@ -1,3 +1,3 @@ module PolymorphicIntegerType - VERSION = "3.2.2" + VERSION = "3.3.0" end diff --git a/polymorphic_integer_type.gemspec b/polymorphic_integer_type.gemspec index a33401e..52bb61a 100644 --- a/polymorphic_integer_type.gemspec +++ b/polymorphic_integer_type.gemspec @@ -18,7 +18,7 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.add_dependency "activerecord", "< 7.1" + spec.add_dependency "activerecord", "< 8" spec.add_development_dependency "bundler" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" diff --git a/spec/polymorphic_integer_type_spec.rb b/spec/polymorphic_integer_type_spec.rb index 4af7d30..6e426cf 100644 --- a/spec/polymorphic_integer_type_spec.rb +++ b/spec/polymorphic_integer_type_spec.rb @@ -175,7 +175,7 @@ before { link } it "should have the proper source" do - expect(source.source_links[0].source).to eql source + expect(source.reload.source_links[0].source).to eql source end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index fb6e13d..fdcbd3d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -23,18 +23,14 @@ active_record_version = Gem::Version.new(ActiveRecord::VERSION::STRING) ActiveRecord::Base.establish_connection(database_config) - - if active_record_version < Gem::Version.new("5.2") - ActiveRecord::Migrator.migrate(migrations_path) - end - - if active_record_version >= Gem::Version.new("5.2") && active_record_version < Gem::Version.new("6.0") - ActiveRecord::MigrationContext.new(migrations_path).migrate - end - if active_record_version >= Gem::Version.new("6.0") + if active_record_version >= Gem::Version.new("6.1") && active_record_version < Gem::Version.new("7.0") ActiveRecord::MigrationContext.new(migrations_path, ActiveRecord::SchemaMigration).migrate end + + if active_record_version >= Gem::Version.new("7.0") + ActiveRecord::MigrationContext.new(migrations_path).migrate + end end config.around do |example|