From 0fd000c3569a8876ba1edbd5e0ffc29b0aa2606c Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 17:49:55 +0100 Subject: [PATCH 01/14] Add GitHub Actions CI workflow and update dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add GitHub Actions workflow for continuous integration * Tests with Ruby 3.2 and PostgreSQL 15 * Runs RSpec test suite with coverage reporting * Includes RuboCop linting job * Uploads coverage artifacts - Update development dependencies to latest versions * pg: 0.18 → 1.5 (Ruby 3.2 compatibility) * rspec: 3.4 → 3.12 * rubocop: ≤0.81 → 1.60 * with_model: 1.2 → 2.2 - Update Ruby version to 3.2.2 All tests passing: 25 examples, 0 failures, 98.63% coverage 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/ci-simple.yml | 82 +++++++++++++++++++++++++++++++++ .ruby-version | 2 +- sql_query.gemspec | 8 ++-- 3 files changed, 87 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci-simple.yml diff --git a/.github/workflows/ci-simple.yml b/.github/workflows/ci-simple.yml new file mode 100644 index 0000000..74730b6 --- /dev/null +++ b/.github/workflows/ci-simple.yml @@ -0,0 +1,82 @@ +name: CI + +on: + push: + branches: [ master, main ] + pull_request: + branches: [ master, main ] + +jobs: + test: + name: Test Suite + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:15 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: travis_ci_test + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + env: + BUILDER: travis + PGHOST: localhost + PGUSER: postgres + PGPASSWORD: postgres + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Ruby 3.2 + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: Setup database + run: psql -h localhost -U postgres -c 'CREATE DATABASE travis_ci_test;' + + - name: Run tests + run: bundle exec rspec + + - name: Check coverage + run: | + echo "Coverage report generated at coverage/index.html" + if [ -f coverage/.last_run.json ]; then + echo "Coverage summary:" + cat coverage/.last_run.json + fi + + - name: Upload coverage report + uses: actions/upload-artifact@v4 + if: always() + with: + name: coverage-report + path: coverage/ + retention-days: 7 + + lint: + name: RuboCop + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Ruby 3.2 + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: Run RuboCop + run: bundle exec rubocop --format progress diff --git a/.ruby-version b/.ruby-version index 0bee604..be94e6f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.3.3 +3.2.2 diff --git a/sql_query.gemspec b/sql_query.gemspec index 80db516..9bd5afb 100644 --- a/sql_query.gemspec +++ b/sql_query.gemspec @@ -26,10 +26,10 @@ Gem::Specification.new do |spec| spec.add_dependency 'activerecord', '>= 3.2' spec.add_development_dependency 'appraisal' spec.add_development_dependency 'bundler' - spec.add_development_dependency 'pg', '~> 0.18' + spec.add_development_dependency 'pg', '~> 1.5' spec.add_development_dependency 'rake', '~> 13.0' - spec.add_development_dependency 'rspec', '~> 3.4' - spec.add_development_dependency 'rubocop', '<= 0.81' + spec.add_development_dependency 'rspec', '~> 3.12' + spec.add_development_dependency 'rubocop', '~> 1.60' spec.add_development_dependency 'simplecov' - spec.add_development_dependency 'with_model', '~> 1.2' + spec.add_development_dependency 'with_model', '~> 2.2' end From 841aaeb2d8277f18079dc9b86e06446521da3625 Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 18:18:31 +0100 Subject: [PATCH 02/14] Fix GitHub Actions workflow and resolve RuboCop issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GitHub Actions Improvements: - Change test database from travis_ci_test to sqlquery_test - Replace BUILDER=travis with standard CI environment variable - Fix database creation to avoid "already exists" error - Add password to CI database connection string - Prepare for Travis CI removal RuboCop Fixes: - Add .rubocop.yml configuration for gem project - Fix memoized variable naming (@sql_for_logs → @prepared_for_logs) - Add empty line after attr_writer for better readability - Fix comment spacing in spec_helper.rb - Remove deprecated test_files assignment from gemspec - Configure sensible defaults for gem development All RuboCop offenses resolved: 8 files inspected, no offenses detected --- .github/workflows/ci-simple.yml | 6 +++--- .rubocop.yml | 33 +++++++++++++++++++++++++++++++++ lib/sql_query.rb | 3 ++- spec/spec_helper.rb | 6 +++--- sql_query.gemspec | 1 - 5 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 .rubocop.yml diff --git a/.github/workflows/ci-simple.yml b/.github/workflows/ci-simple.yml index 74730b6..05bd47e 100644 --- a/.github/workflows/ci-simple.yml +++ b/.github/workflows/ci-simple.yml @@ -17,7 +17,7 @@ jobs: env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres - POSTGRES_DB: travis_ci_test + POSTGRES_DB: sqlquery_test ports: - 5432:5432 options: >- @@ -27,7 +27,7 @@ jobs: --health-retries 5 env: - BUILDER: travis + CI: true PGHOST: localhost PGUSER: postgres PGPASSWORD: postgres @@ -43,7 +43,7 @@ jobs: bundler-cache: true - name: Setup database - run: psql -h localhost -U postgres -c 'CREATE DATABASE travis_ci_test;' + run: psql -h localhost -U postgres -c 'CREATE DATABASE sqlquery_test;' - name: Run tests run: bundle exec rspec diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..35bc9d4 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,33 @@ +AllCops: + NewCops: enable + TargetRubyVersion: 3.2 + Exclude: + - 'vendor/**/*' + - 'gemfiles/**/*' + +# Style - Documentation not required for small gems +Style/Documentation: + Enabled: false + +# Style - Optional boolean parameters are acceptable in this API +Style/OptionalBooleanParameter: + Enabled: false + +# Metrics - Allow longer blocks in specs +Metrics/BlockLength: + Exclude: + - 'spec/**/*_spec.rb' + - '**/*.gemspec' + +# Lint - Allow constant definition in RSpec blocks +Lint/ConstantDefinitionInBlock: + Exclude: + - 'spec/**/*_spec.rb' + +# Gemspec - Ruby version is intentionally broad for compatibility +Gemspec/RequiredRubyVersion: + Enabled: false + +# Gemspec - Development dependencies in gemspec is acceptable for gems +Gemspec/DevelopmentDependencies: + Enabled: false diff --git a/lib/sql_query.rb b/lib/sql_query.rb index 09c7627..23b7b04 100644 --- a/lib/sql_query.rb +++ b/lib/sql_query.rb @@ -46,7 +46,7 @@ def quote(value) end def prepared_for_logs - @sql_for_logs ||= prepare_query(true) + @prepared_for_logs ||= prepare_query(true) end def partial(partial_name, partial_options = {}) @@ -56,6 +56,7 @@ def partial(partial_name, partial_options = {}) end attr_writer :config + def self.config @config ||= Config.new end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8c7137b..4cba666 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -7,7 +7,7 @@ require 'active_record' require 'sql_query' -#require 'pry' +# require 'pry' SqlQuery.configure do |config| config.path = '/spec/sql_queries' @@ -22,8 +22,8 @@ mocks.verify_partial_doubles = true end - connection = if ENV['BUILDER'] == 'travis' - 'postgres://postgres@localhost/travis_ci_test' + connection = if ENV['CI'] + 'postgres://postgres:postgres@localhost/sqlquery_test' else 'postgres://sqlquery:sqlquery@localhost/sqlquery' end diff --git a/sql_query.gemspec b/sql_query.gemspec index 9bd5afb..1375bcf 100644 --- a/sql_query.gemspec +++ b/sql_query.gemspec @@ -18,7 +18,6 @@ Gem::Specification.new do |spec| spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ['lib'] spec.required_ruby_version = '>= 1.9.3' From ff4c300aa6422feb5982a96bf419fc2de48c3f55 Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 18:26:53 +0100 Subject: [PATCH 03/14] Fix duplicate database creation in GitHub Actions workflow - Remove manual 'Setup database' step that tried to CREATE DATABASE - PostgreSQL service already creates the database via POSTGRES_DB env var - This fixes the 'database already exists' error in CI - Add MFA requirement metadata to gemspec --- .github/workflows/ci-simple.yml | 3 --- sql_query.gemspec | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-simple.yml b/.github/workflows/ci-simple.yml index 05bd47e..63a59e9 100644 --- a/.github/workflows/ci-simple.yml +++ b/.github/workflows/ci-simple.yml @@ -42,9 +42,6 @@ jobs: ruby-version: '3.2' bundler-cache: true - - name: Setup database - run: psql -h localhost -U postgres -c 'CREATE DATABASE sqlquery_test;' - - name: Run tests run: bundle exec rspec diff --git a/sql_query.gemspec b/sql_query.gemspec index 1375bcf..80e36de 100644 --- a/sql_query.gemspec +++ b/sql_query.gemspec @@ -31,4 +31,6 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rubocop', '~> 1.60' spec.add_development_dependency 'simplecov' spec.add_development_dependency 'with_model', '~> 2.2' + + spec.metadata['rubygems_mfa_required'] = 'true' end From eea8772b823af14ea91bdc061de46b2570c1bff0 Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 19:00:41 +0100 Subject: [PATCH 04/14] Remove Travis CI and add comprehensive matrix testing workflow - Remove .travis.yml configuration - Add GitHub Actions matrix testing workflow for Ruby 2.7-3.3 against Rails 4.2-8.0 - Update Appraisals to test against Rails 5.2, 6.0, 6.1, 7.0, 7.1, 8.0 - Remove old gemfiles for Rails 3.2, 4.0, 4.1, 5.0 - Generate new gemfiles for all supported Rails versions - Configure proper Ruby/Rails compatibility exclusions in matrix --- .github/workflows/test-matrix.yml | 135 ++++++++++++++++++++++++++++++ .travis.yml | 28 ------- Appraisals | 28 ++++--- gemfiles/3.2.gemfile | 9 -- gemfiles/4.0.gemfile | 9 -- gemfiles/4.1.gemfile | 9 -- gemfiles/4.2.gemfile | 8 +- gemfiles/5.0.gemfile | 9 -- gemfiles/5.2.gemfile | 7 ++ gemfiles/6.0.gemfile | 7 ++ gemfiles/6.1.gemfile | 7 ++ gemfiles/7.0.gemfile | 7 ++ gemfiles/7.1.gemfile | 7 ++ gemfiles/8.0.gemfile | 7 ++ 14 files changed, 198 insertions(+), 79 deletions(-) create mode 100644 .github/workflows/test-matrix.yml delete mode 100644 .travis.yml delete mode 100644 gemfiles/3.2.gemfile delete mode 100644 gemfiles/4.0.gemfile delete mode 100644 gemfiles/4.1.gemfile delete mode 100644 gemfiles/5.0.gemfile create mode 100644 gemfiles/5.2.gemfile create mode 100644 gemfiles/6.0.gemfile create mode 100644 gemfiles/6.1.gemfile create mode 100644 gemfiles/7.0.gemfile create mode 100644 gemfiles/7.1.gemfile create mode 100644 gemfiles/8.0.gemfile diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml new file mode 100644 index 0000000..fbc7dc7 --- /dev/null +++ b/.github/workflows/test-matrix.yml @@ -0,0 +1,135 @@ +name: Test Matrix + +on: + push: + branches: [ master, main ] + pull_request: + branches: [ master, main ] + +jobs: + test: + name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }} + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] + rails: ['4.2', '5.2', '6.0', '6.1', '7.0', '7.1', '8.0'] + exclude: + # Ruby 2.7 is not compatible with Rails 7+ + - ruby: '2.7' + rails: '7.0' + - ruby: '2.7' + rails: '7.1' + - ruby: '2.7' + rails: '8.0' + # Ruby 3.0+ doesn't work well with Rails 4.2 + - ruby: '3.0' + rails: '4.2' + - ruby: '3.1' + rails: '4.2' + - ruby: '3.2' + rails: '4.2' + - ruby: '3.3' + rails: '4.2' + # Ruby 3.3 requires Rails 7.1+ + - ruby: '3.3' + rails: '5.2' + - ruby: '3.3' + rails: '6.0' + - ruby: '3.3' + rails: '6.1' + - ruby: '3.3' + rails: '7.0' + + services: + postgres: + image: postgres:15 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: sqlquery_test + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + env: + CI: true + PGHOST: localhost + PGUSER: postgres + PGPASSWORD: postgres + RAILS_VERSION: ${{ matrix.rails }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: false + + - name: Install dependencies with specific Rails version + run: | + gem install bundler + bundle config set --local path vendor/bundle + if [ "${{ matrix.rails }}" = "4.2" ]; then + bundle install --gemfile=gemfiles/4.2.gemfile + elif [ "${{ matrix.rails }}" = "5.2" ]; then + bundle install --gemfile=gemfiles/5.2.gemfile + elif [ "${{ matrix.rails }}" = "6.0" ]; then + bundle install --gemfile=gemfiles/6.0.gemfile + elif [ "${{ matrix.rails }}" = "6.1" ]; then + bundle install --gemfile=gemfiles/6.1.gemfile + elif [ "${{ matrix.rails }}" = "7.0" ]; then + bundle install --gemfile=gemfiles/7.0.gemfile + elif [ "${{ matrix.rails }}" = "7.1" ]; then + bundle install --gemfile=gemfiles/7.1.gemfile + elif [ "${{ matrix.rails }}" = "8.0" ]; then + bundle install --gemfile=gemfiles/8.0.gemfile + else + bundle install + fi + + - name: Run tests + run: | + if [ "${{ matrix.rails }}" = "4.2" ]; then + bundle exec --gemfile=gemfiles/4.2.gemfile rspec + elif [ "${{ matrix.rails }}" = "5.2" ]; then + bundle exec --gemfile=gemfiles/5.2.gemfile rspec + elif [ "${{ matrix.rails }}" = "6.0" ]; then + bundle exec --gemfile=gemfiles/6.0.gemfile rspec + elif [ "${{ matrix.rails }}" = "6.1" ]; then + bundle exec --gemfile=gemfiles/6.1.gemfile rspec + elif [ "${{ matrix.rails }}" = "7.0" ]; then + bundle exec --gemfile=gemfiles/7.0.gemfile rspec + elif [ "${{ matrix.rails }}" = "7.1" ]; then + bundle exec --gemfile=gemfiles/7.1.gemfile rspec + elif [ "${{ matrix.rails }}" = "8.0" ]; then + bundle exec --gemfile=gemfiles/8.0.gemfile rspec + else + bundle exec rspec + fi + + lint: + name: RuboCop + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2' + bundler-cache: true + + - name: Run RuboCop + run: bundle exec rubocop --format progress diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 5ec63b9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,28 +0,0 @@ -language: ruby -cache: bundler -before_install: - - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true - - gem install bundler -v '< 2' - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - -gemfile: - - gemfiles/3.2.gemfile - - gemfiles/4.0.gemfile - - gemfiles/4.1.gemfile - - gemfiles/4.2.gemfile - - gemfiles/5.0.gemfile - -rvm: - - '2.6.0' - -addons: - postgresql: '9.4' - -env: - - BUILDER=travis -before_script: - - psql -c 'create database travis_ci_test;' -U postgres - - ./cc-test-reporter before-build -after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT -r 743bf63d7a422064551b35931628682c6cad81a30743edee7ff9ea8af061397d diff --git a/Appraisals b/Appraisals index b0f396e..83c4be8 100644 --- a/Appraisals +++ b/Appraisals @@ -1,21 +1,29 @@ # frozen_string_literal: true -appraise '3.2' do - gem 'activerecord', '~> 3.2.21' +appraise '4.2' do + gem 'activerecord', '~> 4.2.0' end -appraise '4.0' do - gem 'activerecord', '~> 4.0.0' +appraise '5.2' do + gem 'activerecord', '~> 5.2.0' end -appraise '4.1' do - gem 'activerecord', '~> 4.1.0' +appraise '6.0' do + gem 'activerecord', '~> 6.0.0' end -appraise '4.2' do - gem 'activerecord', '~> 4.2.0' +appraise '6.1' do + gem 'activerecord', '~> 6.1.0' +end + +appraise '7.0' do + gem 'activerecord', '~> 7.0.0' +end + +appraise '7.1' do + gem 'activerecord', '~> 7.1.0' end -appraise '5.0' do - gem 'activerecord', '~> 5.0.0' +appraise '8.0' do + gem 'activerecord', '~> 8.0.0' end diff --git a/gemfiles/3.2.gemfile b/gemfiles/3.2.gemfile deleted file mode 100644 index b497013..0000000 --- a/gemfiles/3.2.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file was generated by Appraisal - -source 'https://rubygems.org' - -gem 'activerecord', '~> 3.2.21' - -gemspec path: '../' diff --git a/gemfiles/4.0.gemfile b/gemfiles/4.0.gemfile deleted file mode 100644 index 50d72ed..0000000 --- a/gemfiles/4.0.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file was generated by Appraisal - -source 'https://rubygems.org' - -gem 'activerecord', '~> 4.0.0' - -gemspec path: '../' diff --git a/gemfiles/4.1.gemfile b/gemfiles/4.1.gemfile deleted file mode 100644 index 6fbbfc6..0000000 --- a/gemfiles/4.1.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file was generated by Appraisal - -source 'https://rubygems.org' - -gem 'activerecord', '~> 4.1.0' - -gemspec path: '../' diff --git a/gemfiles/4.2.gemfile b/gemfiles/4.2.gemfile index 9c45f5b..9be8642 100644 --- a/gemfiles/4.2.gemfile +++ b/gemfiles/4.2.gemfile @@ -1,9 +1,7 @@ -# frozen_string_literal: true - # This file was generated by Appraisal -source 'https://rubygems.org' +source "https://rubygems.org" -gem 'activerecord', '~> 4.2.0' +gem "activerecord", "~> 4.2.0" -gemspec path: '../' +gemspec path: "../" diff --git a/gemfiles/5.0.gemfile b/gemfiles/5.0.gemfile deleted file mode 100644 index 53a444a..0000000 --- a/gemfiles/5.0.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -# This file was generated by Appraisal - -source 'https://rubygems.org' - -gem 'activerecord', '~> 5.0.0' - -gemspec path: '../' diff --git a/gemfiles/5.2.gemfile b/gemfiles/5.2.gemfile new file mode 100644 index 0000000..027888d --- /dev/null +++ b/gemfiles/5.2.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activerecord", "~> 5.2.0" + +gemspec path: "../" diff --git a/gemfiles/6.0.gemfile b/gemfiles/6.0.gemfile new file mode 100644 index 0000000..b07bd13 --- /dev/null +++ b/gemfiles/6.0.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activerecord", "~> 6.0.0" + +gemspec path: "../" diff --git a/gemfiles/6.1.gemfile b/gemfiles/6.1.gemfile new file mode 100644 index 0000000..07548db --- /dev/null +++ b/gemfiles/6.1.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activerecord", "~> 6.1.0" + +gemspec path: "../" diff --git a/gemfiles/7.0.gemfile b/gemfiles/7.0.gemfile new file mode 100644 index 0000000..bc1dfc9 --- /dev/null +++ b/gemfiles/7.0.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activerecord", "~> 7.0.0" + +gemspec path: "../" diff --git a/gemfiles/7.1.gemfile b/gemfiles/7.1.gemfile new file mode 100644 index 0000000..69bc38a --- /dev/null +++ b/gemfiles/7.1.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activerecord", "~> 7.1.0" + +gemspec path: "../" diff --git a/gemfiles/8.0.gemfile b/gemfiles/8.0.gemfile new file mode 100644 index 0000000..c606dc0 --- /dev/null +++ b/gemfiles/8.0.gemfile @@ -0,0 +1,7 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activerecord", "~> 8.0.0" + +gemspec path: "../" From fae8d1fbab3b36c8d16634d91fa8bf6bf3c3e3f0 Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 19:05:03 +0100 Subject: [PATCH 05/14] Simplify matrix testing to only Ruby 2.7 and 3.2 - Reduce Ruby versions from 5 to 2 (2.7 and 3.2) - Ruby 2.7 tests Rails 4.2, 5.2, 6.0, 6.1 - Ruby 3.2 tests Rails 5.2, 6.0, 6.1, 7.0, 7.1, 8.0 - Total of 10 test combinations instead of 18 --- .github/workflows/test-matrix.yml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index fbc7dc7..78cc710 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['2.7', '3.0', '3.1', '3.2', '3.3'] + ruby: ['2.7', '3.2'] rails: ['4.2', '5.2', '6.0', '6.1', '7.0', '7.1', '8.0'] exclude: # Ruby 2.7 is not compatible with Rails 7+ @@ -24,24 +24,9 @@ jobs: rails: '7.1' - ruby: '2.7' rails: '8.0' - # Ruby 3.0+ doesn't work well with Rails 4.2 - - ruby: '3.0' - rails: '4.2' - - ruby: '3.1' - rails: '4.2' + # Ruby 3.2 doesn't work well with Rails 4.2 - ruby: '3.2' rails: '4.2' - - ruby: '3.3' - rails: '4.2' - # Ruby 3.3 requires Rails 7.1+ - - ruby: '3.3' - rails: '5.2' - - ruby: '3.3' - rails: '6.0' - - ruby: '3.3' - rails: '6.1' - - ruby: '3.3' - rails: '7.0' services: postgres: From bef2eaca07fb51645ec864f452cd923ad8d48a8f Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 19:32:51 +0100 Subject: [PATCH 06/14] Fix dependency cross-references for Rails version compatibility - Remove fixed with_model version from gemspec - Add version-specific with_model constraints in Appraisals: - Rails 4.2: with_model ~> 2.0.0 (requires activerecord >= 4.2) - Rails 5.2-6.1: with_model ~> 2.1.6 (requires activerecord >= 5.2) - Rails 7.0-8.0: with_model ~> 2.2.0 (requires activerecord >= 7.0) - Regenerate all gemfiles with correct dependencies --- Appraisals | 7 +++++++ gemfiles/4.2.gemfile | 1 + gemfiles/5.2.gemfile | 1 + gemfiles/6.0.gemfile | 1 + gemfiles/6.1.gemfile | 1 + gemfiles/7.0.gemfile | 1 + gemfiles/7.1.gemfile | 1 + gemfiles/8.0.gemfile | 1 + sql_query.gemspec | 8 +++++--- 9 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Appraisals b/Appraisals index 83c4be8..6b97a54 100644 --- a/Appraisals +++ b/Appraisals @@ -2,28 +2,35 @@ appraise '4.2' do gem 'activerecord', '~> 4.2.0' + gem 'with_model', '~> 2.0.0' end appraise '5.2' do gem 'activerecord', '~> 5.2.0' + gem 'with_model', '~> 2.1.6' end appraise '6.0' do gem 'activerecord', '~> 6.0.0' + gem 'with_model', '~> 2.1.6' end appraise '6.1' do gem 'activerecord', '~> 6.1.0' + gem 'with_model', '~> 2.1.6' end appraise '7.0' do gem 'activerecord', '~> 7.0.0' + gem 'with_model', '~> 2.2.0' end appraise '7.1' do gem 'activerecord', '~> 7.1.0' + gem 'with_model', '~> 2.2.0' end appraise '8.0' do gem 'activerecord', '~> 8.0.0' + gem 'with_model', '~> 2.2.0' end diff --git a/gemfiles/4.2.gemfile b/gemfiles/4.2.gemfile index 9be8642..d4229db 100644 --- a/gemfiles/4.2.gemfile +++ b/gemfiles/4.2.gemfile @@ -3,5 +3,6 @@ source "https://rubygems.org" gem "activerecord", "~> 4.2.0" +gem "with_model", "~> 2.0.0" gemspec path: "../" diff --git a/gemfiles/5.2.gemfile b/gemfiles/5.2.gemfile index 027888d..cabee12 100644 --- a/gemfiles/5.2.gemfile +++ b/gemfiles/5.2.gemfile @@ -3,5 +3,6 @@ source "https://rubygems.org" gem "activerecord", "~> 5.2.0" +gem "with_model", "~> 2.1.6" gemspec path: "../" diff --git a/gemfiles/6.0.gemfile b/gemfiles/6.0.gemfile index b07bd13..87af46f 100644 --- a/gemfiles/6.0.gemfile +++ b/gemfiles/6.0.gemfile @@ -3,5 +3,6 @@ source "https://rubygems.org" gem "activerecord", "~> 6.0.0" +gem "with_model", "~> 2.1.6" gemspec path: "../" diff --git a/gemfiles/6.1.gemfile b/gemfiles/6.1.gemfile index 07548db..ad31f32 100644 --- a/gemfiles/6.1.gemfile +++ b/gemfiles/6.1.gemfile @@ -3,5 +3,6 @@ source "https://rubygems.org" gem "activerecord", "~> 6.1.0" +gem "with_model", "~> 2.1.6" gemspec path: "../" diff --git a/gemfiles/7.0.gemfile b/gemfiles/7.0.gemfile index bc1dfc9..6088ab3 100644 --- a/gemfiles/7.0.gemfile +++ b/gemfiles/7.0.gemfile @@ -3,5 +3,6 @@ source "https://rubygems.org" gem "activerecord", "~> 7.0.0" +gem "with_model", "~> 2.2.0" gemspec path: "../" diff --git a/gemfiles/7.1.gemfile b/gemfiles/7.1.gemfile index 69bc38a..75d9883 100644 --- a/gemfiles/7.1.gemfile +++ b/gemfiles/7.1.gemfile @@ -3,5 +3,6 @@ source "https://rubygems.org" gem "activerecord", "~> 7.1.0" +gem "with_model", "~> 2.2.0" gemspec path: "../" diff --git a/gemfiles/8.0.gemfile b/gemfiles/8.0.gemfile index c606dc0..02ac397 100644 --- a/gemfiles/8.0.gemfile +++ b/gemfiles/8.0.gemfile @@ -3,5 +3,6 @@ source "https://rubygems.org" gem "activerecord", "~> 8.0.0" +gem "with_model", "~> 2.2.0" gemspec path: "../" diff --git a/sql_query.gemspec b/sql_query.gemspec index 80e36de..b162036 100644 --- a/sql_query.gemspec +++ b/sql_query.gemspec @@ -16,6 +16,10 @@ Gem::Specification.new do |spec| spec.homepage = 'https://github.com/sufleR/sql_query' spec.license = 'MIT' + spec.metadata = { + 'rubygems_mfa_required' => 'true' + } + spec.files = `git ls-files -z`.split("\x0") spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } spec.require_paths = ['lib'] @@ -30,7 +34,5 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'rspec', '~> 3.12' spec.add_development_dependency 'rubocop', '~> 1.60' spec.add_development_dependency 'simplecov' - spec.add_development_dependency 'with_model', '~> 2.2' - - spec.metadata['rubygems_mfa_required'] = 'true' + spec.add_development_dependency 'with_model' end From 7d0a505fb5f55b75b0f7292bcd6ef7c1bb000831 Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 20:21:07 +0100 Subject: [PATCH 07/14] Fix Rails/Ruby compatibility issues in test matrix - Update test matrix to only include officially supported combinations: - Ruby 2.7: Rails 5.2, 6.0, 6.1, 7.0 (4 combinations) - Ruby 3.2: Rails 7.0, 7.1, 8.0 (3 combinations) - Remove Rails 4.2 from CI (not compatible with Ruby 2.7+) - Fix spec_helper to use hash-based connection config for better Rails compatibility - Change from connection URL strings to explicit connection hashes Total: 7 test combinations covering all officially supported Rails versions --- .github/workflows/test-matrix.yml | 22 ++++++++++------------ spec/spec_helper.rb | 26 +++++++++++++++++++------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index 78cc710..e9d3a7a 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -15,18 +15,20 @@ jobs: fail-fast: false matrix: ruby: ['2.7', '3.2'] - rails: ['4.2', '5.2', '6.0', '6.1', '7.0', '7.1', '8.0'] + rails: ['5.2', '6.0', '6.1', '7.0', '7.1', '8.0'] exclude: - # Ruby 2.7 is not compatible with Rails 7+ - - ruby: '2.7' - rails: '7.0' + # Ruby 2.7 officially supports Rails 5.2-7.0 only - ruby: '2.7' rails: '7.1' - ruby: '2.7' rails: '8.0' - # Ruby 3.2 doesn't work well with Rails 4.2 + # Ruby 3.2 requires Rails 7.0+ + - ruby: '3.2' + rails: '5.2' + - ruby: '3.2' + rails: '6.0' - ruby: '3.2' - rails: '4.2' + rails: '6.1' services: postgres: @@ -64,9 +66,7 @@ jobs: run: | gem install bundler bundle config set --local path vendor/bundle - if [ "${{ matrix.rails }}" = "4.2" ]; then - bundle install --gemfile=gemfiles/4.2.gemfile - elif [ "${{ matrix.rails }}" = "5.2" ]; then + if [ "${{ matrix.rails }}" = "5.2" ]; then bundle install --gemfile=gemfiles/5.2.gemfile elif [ "${{ matrix.rails }}" = "6.0" ]; then bundle install --gemfile=gemfiles/6.0.gemfile @@ -84,9 +84,7 @@ jobs: - name: Run tests run: | - if [ "${{ matrix.rails }}" = "4.2" ]; then - bundle exec --gemfile=gemfiles/4.2.gemfile rspec - elif [ "${{ matrix.rails }}" = "5.2" ]; then + if [ "${{ matrix.rails }}" = "5.2" ]; then bundle exec --gemfile=gemfiles/5.2.gemfile rspec elif [ "${{ matrix.rails }}" = "6.0" ]; then bundle exec --gemfile=gemfiles/6.0.gemfile rspec diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4cba666..f665939 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -22,13 +22,25 @@ mocks.verify_partial_doubles = true end - connection = if ENV['CI'] - 'postgres://postgres:postgres@localhost/sqlquery_test' - else - 'postgres://sqlquery:sqlquery@localhost/sqlquery' - end - - ActiveRecord::Base.establish_connection(connection) + connection_config = if ENV['CI'] + { + adapter: 'postgresql', + host: 'localhost', + username: 'postgres', + password: 'postgres', + database: 'sqlquery_test' + } + else + { + adapter: 'postgresql', + host: 'localhost', + username: 'sqlquery', + password: 'sqlquery', + database: 'sqlquery' + } + end + + ActiveRecord::Base.establish_connection(connection_config) ActiveRecord::Base.connection.execute( 'CREATE TABLE IF NOT EXISTS players (email text);' From c29d4baa777e64ceee018057f5bebc8aadb94dce Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 20:27:55 +0100 Subject: [PATCH 08/14] Fix RuboCop and bundler issues in CI - Remove manual bundler installation that was incompatible with Ruby 2.7 (ruby/setup-ruby already installs appropriate bundler version) - Remove unnecessary bundle config path setting - Add --jobs=4 --retry=3 to bundle install for better CI performance - Fix RuboCop BlockLength rule to exclude all spec files, not just *_spec.rb (spec_helper.rb was being incorrectly linted) --- .github/workflows/test-matrix.yml | 16 +++++++--------- .rubocop.yml | 4 ++-- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index e9d3a7a..c702f14 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -64,22 +64,20 @@ jobs: - name: Install dependencies with specific Rails version run: | - gem install bundler - bundle config set --local path vendor/bundle if [ "${{ matrix.rails }}" = "5.2" ]; then - bundle install --gemfile=gemfiles/5.2.gemfile + bundle install --gemfile=gemfiles/5.2.gemfile --jobs=4 --retry=3 elif [ "${{ matrix.rails }}" = "6.0" ]; then - bundle install --gemfile=gemfiles/6.0.gemfile + bundle install --gemfile=gemfiles/6.0.gemfile --jobs=4 --retry=3 elif [ "${{ matrix.rails }}" = "6.1" ]; then - bundle install --gemfile=gemfiles/6.1.gemfile + bundle install --gemfile=gemfiles/6.1.gemfile --jobs=4 --retry=3 elif [ "${{ matrix.rails }}" = "7.0" ]; then - bundle install --gemfile=gemfiles/7.0.gemfile + bundle install --gemfile=gemfiles/7.0.gemfile --jobs=4 --retry=3 elif [ "${{ matrix.rails }}" = "7.1" ]; then - bundle install --gemfile=gemfiles/7.1.gemfile + bundle install --gemfile=gemfiles/7.1.gemfile --jobs=4 --retry=3 elif [ "${{ matrix.rails }}" = "8.0" ]; then - bundle install --gemfile=gemfiles/8.0.gemfile + bundle install --gemfile=gemfiles/8.0.gemfile --jobs=4 --retry=3 else - bundle install + bundle install --jobs=4 --retry=3 fi - name: Run tests diff --git a/.rubocop.yml b/.rubocop.yml index 35bc9d4..45757c1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -16,13 +16,13 @@ Style/OptionalBooleanParameter: # Metrics - Allow longer blocks in specs Metrics/BlockLength: Exclude: - - 'spec/**/*_spec.rb' + - 'spec/**/*.rb' - '**/*.gemspec' # Lint - Allow constant definition in RSpec blocks Lint/ConstantDefinitionInBlock: Exclude: - - 'spec/**/*_spec.rb' + - 'spec/**/*.rb' # Gemspec - Ruby version is intentionally broad for compatibility Gemspec/RequiredRubyVersion: From c3193cbcb31054ed8930bfc31bcc67d6a4b844a0 Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 20:32:03 +0100 Subject: [PATCH 09/14] Fix Ruby 2.7 compatibility issues with Rails 6.0-8.0 - Change Rails 7.0-8.0 to use with_model ~> 2.1.7 instead of 2.2.0 (with_model 2.2.0 requires Ruby >= 3.1, incompatible with Ruby 2.7) - Add 'require logger' before 'require active_record' in spec_helper (fixes NameError: uninitialized constant ActiveSupport::LoggerThreadSafeLevel::Logger) - This allows Ruby 2.7 to successfully test against Rails 6.0, 6.1, and 7.0 --- Appraisals | 6 +++--- gemfiles/7.0.gemfile | 2 +- gemfiles/7.1.gemfile | 2 +- gemfiles/8.0.gemfile | 2 +- spec/spec_helper.rb | 1 + 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Appraisals b/Appraisals index 6b97a54..563e8f8 100644 --- a/Appraisals +++ b/Appraisals @@ -22,15 +22,15 @@ end appraise '7.0' do gem 'activerecord', '~> 7.0.0' - gem 'with_model', '~> 2.2.0' + gem 'with_model', '~> 2.1.7' end appraise '7.1' do gem 'activerecord', '~> 7.1.0' - gem 'with_model', '~> 2.2.0' + gem 'with_model', '~> 2.1.7' end appraise '8.0' do gem 'activerecord', '~> 8.0.0' - gem 'with_model', '~> 2.2.0' + gem 'with_model', '~> 2.1.7' end diff --git a/gemfiles/7.0.gemfile b/gemfiles/7.0.gemfile index 6088ab3..a6295cb 100644 --- a/gemfiles/7.0.gemfile +++ b/gemfiles/7.0.gemfile @@ -3,6 +3,6 @@ source "https://rubygems.org" gem "activerecord", "~> 7.0.0" -gem "with_model", "~> 2.2.0" +gem "with_model", "~> 2.1.7" gemspec path: "../" diff --git a/gemfiles/7.1.gemfile b/gemfiles/7.1.gemfile index 75d9883..00b9986 100644 --- a/gemfiles/7.1.gemfile +++ b/gemfiles/7.1.gemfile @@ -3,6 +3,6 @@ source "https://rubygems.org" gem "activerecord", "~> 7.1.0" -gem "with_model", "~> 2.2.0" +gem "with_model", "~> 2.1.7" gemspec path: "../" diff --git a/gemfiles/8.0.gemfile b/gemfiles/8.0.gemfile index 02ac397..983c3b8 100644 --- a/gemfiles/8.0.gemfile +++ b/gemfiles/8.0.gemfile @@ -3,6 +3,6 @@ source "https://rubygems.org" gem "activerecord", "~> 8.0.0" -gem "with_model", "~> 2.2.0" +gem "with_model", "~> 2.1.7" gemspec path: "../" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f665939..d48f16d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,7 @@ add_filter '/spec/' end +require 'logger' require 'active_record' require 'sql_query' # require 'pry' From bbc5e9a939e801f9b9a41c5a3e836f010e8839a4 Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 21:24:19 +0100 Subject: [PATCH 10/14] Add Rails 4.2 testing with Ruby 2.7 - Add Rails 4.2 to test matrix for Ruby 2.7 only - Rails 4.2 is excluded from Ruby 3.2 (not compatible) - This provides coverage for Rails 4.x with supported Ruby version - Total: 8 test combinations (5 for Ruby 2.7, 3 for Ruby 3.2) --- .github/workflows/test-matrix.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-matrix.yml b/.github/workflows/test-matrix.yml index c702f14..9e19ecd 100644 --- a/.github/workflows/test-matrix.yml +++ b/.github/workflows/test-matrix.yml @@ -15,14 +15,16 @@ jobs: fail-fast: false matrix: ruby: ['2.7', '3.2'] - rails: ['5.2', '6.0', '6.1', '7.0', '7.1', '8.0'] + rails: ['4.2', '5.2', '6.0', '6.1', '7.0', '7.1', '8.0'] exclude: - # Ruby 2.7 officially supports Rails 5.2-7.0 only + # Ruby 2.7 officially supports Rails 4.2-7.0 - ruby: '2.7' rails: '7.1' - ruby: '2.7' rails: '8.0' # Ruby 3.2 requires Rails 7.0+ + - ruby: '3.2' + rails: '4.2' - ruby: '3.2' rails: '5.2' - ruby: '3.2' @@ -64,7 +66,9 @@ jobs: - name: Install dependencies with specific Rails version run: | - if [ "${{ matrix.rails }}" = "5.2" ]; then + if [ "${{ matrix.rails }}" = "4.2" ]; then + bundle install --gemfile=gemfiles/4.2.gemfile --jobs=4 --retry=3 + elif [ "${{ matrix.rails }}" = "5.2" ]; then bundle install --gemfile=gemfiles/5.2.gemfile --jobs=4 --retry=3 elif [ "${{ matrix.rails }}" = "6.0" ]; then bundle install --gemfile=gemfiles/6.0.gemfile --jobs=4 --retry=3 @@ -82,7 +86,9 @@ jobs: - name: Run tests run: | - if [ "${{ matrix.rails }}" = "5.2" ]; then + if [ "${{ matrix.rails }}" = "4.2" ]; then + bundle exec --gemfile=gemfiles/4.2.gemfile rspec + elif [ "${{ matrix.rails }}" = "5.2" ]; then bundle exec --gemfile=gemfiles/5.2.gemfile rspec elif [ "${{ matrix.rails }}" = "6.0" ]; then bundle exec --gemfile=gemfiles/6.0.gemfile rspec From 7ce16854a1880db2c7b66255c3279797522eb1a4 Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 21:29:20 +0100 Subject: [PATCH 11/14] Add BigDecimal.new compatibility shim for Ruby 2.7 with Rails 4.2 - Rails 4.2 uses deprecated BigDecimal.new API - Ruby 2.7 deprecated BigDecimal.new in favor of BigDecimal() kernel method - Add compatibility shim to restore BigDecimal.new for Ruby 2.6-2.7 - Only activates for Ruby < 3.0 to avoid affecting modern Ruby versions --- spec/spec_helper.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d48f16d..9361f61 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,16 @@ add_filter '/spec/' end +# Fix BigDecimal.new deprecation for Ruby 2.6-2.7 with Rails < 5.0 +if RUBY_VERSION >= '2.6' && RUBY_VERSION < '3.0' + require 'bigdecimal' + unless BigDecimal.respond_to?(:new) + def BigDecimal.new(*args, **kwargs) + BigDecimal(*args, **kwargs) + end + end +end + require 'logger' require 'active_record' require 'sql_query' From 6c4dbae4916dabdb0897ba955e7354d0b8299e16 Mon Sep 17 00:00:00 2001 From: sufleR Date: Thu, 11 Dec 2025 21:40:13 +0100 Subject: [PATCH 12/14] Fix RuboCop style issues in BigDecimal compatibility shim - Use anonymous argument forwarding (*, **) instead of named arguments - Cleaner syntax for Ruby 2.7+ argument forwarding --- spec/spec_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 9361f61..95b30d3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,8 +9,8 @@ if RUBY_VERSION >= '2.6' && RUBY_VERSION < '3.0' require 'bigdecimal' unless BigDecimal.respond_to?(:new) - def BigDecimal.new(*args, **kwargs) - BigDecimal(*args, **kwargs) + def BigDecimal.new(*, **) + BigDecimal(*, **) end end end From 3262a36134f4e0cc4dcf6454764c42cd49d42fd5 Mon Sep 17 00:00:00 2001 From: sufleR Date: Fri, 12 Dec 2025 08:58:56 +0100 Subject: [PATCH 13/14] Fix RuboCop style issues in BigDecimal compatibility shim - Use anonymous argument forwarding (*, **) instead of named arguments - Cleaner syntax for Ruby 2.7+ argument forwarding --- spec/spec_helper.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 95b30d3..67a4845 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,8 +9,8 @@ if RUBY_VERSION >= '2.6' && RUBY_VERSION < '3.0' require 'bigdecimal' unless BigDecimal.respond_to?(:new) - def BigDecimal.new(*, **) - BigDecimal(*, **) + def BigDecimal.new(...) + BigDecimal(...) end end end From feaf97a154d03907520a4a49593731680317b055 Mon Sep 17 00:00:00 2001 From: sufleR Date: Fri, 12 Dec 2025 09:04:58 +0100 Subject: [PATCH 14/14] Add pg gem version constraints per Rails version - Rails 4.2: pg ~> 0.21 (compatible with both Rails 4.2 and Ruby 2.7) - Rails 5.2-6.1: pg ~> 1.1 (stable version for these Rails) - Rails 7.0+: pg ~> 1.5 (from gemspec, latest stable) Fixes version conflict where Rails 4.2 tried to load pg 0.15 but pg 1.6 was already loaded --- Appraisals | 4 ++++ gemfiles/4.2.gemfile | 1 + gemfiles/5.2.gemfile | 1 + gemfiles/6.0.gemfile | 1 + gemfiles/6.1.gemfile | 1 + 5 files changed, 8 insertions(+) diff --git a/Appraisals b/Appraisals index 563e8f8..9985795 100644 --- a/Appraisals +++ b/Appraisals @@ -3,21 +3,25 @@ appraise '4.2' do gem 'activerecord', '~> 4.2.0' gem 'with_model', '~> 2.0.0' + gem 'pg', '~> 0.21' end appraise '5.2' do gem 'activerecord', '~> 5.2.0' gem 'with_model', '~> 2.1.6' + gem 'pg', '~> 1.1' end appraise '6.0' do gem 'activerecord', '~> 6.0.0' gem 'with_model', '~> 2.1.6' + gem 'pg', '~> 1.1' end appraise '6.1' do gem 'activerecord', '~> 6.1.0' gem 'with_model', '~> 2.1.6' + gem 'pg', '~> 1.1' end appraise '7.0' do diff --git a/gemfiles/4.2.gemfile b/gemfiles/4.2.gemfile index d4229db..3024630 100644 --- a/gemfiles/4.2.gemfile +++ b/gemfiles/4.2.gemfile @@ -4,5 +4,6 @@ source "https://rubygems.org" gem "activerecord", "~> 4.2.0" gem "with_model", "~> 2.0.0" +gem "pg", "~> 0.21" gemspec path: "../" diff --git a/gemfiles/5.2.gemfile b/gemfiles/5.2.gemfile index cabee12..138bbd8 100644 --- a/gemfiles/5.2.gemfile +++ b/gemfiles/5.2.gemfile @@ -4,5 +4,6 @@ source "https://rubygems.org" gem "activerecord", "~> 5.2.0" gem "with_model", "~> 2.1.6" +gem "pg", "~> 1.1" gemspec path: "../" diff --git a/gemfiles/6.0.gemfile b/gemfiles/6.0.gemfile index 87af46f..fd90c8a 100644 --- a/gemfiles/6.0.gemfile +++ b/gemfiles/6.0.gemfile @@ -4,5 +4,6 @@ source "https://rubygems.org" gem "activerecord", "~> 6.0.0" gem "with_model", "~> 2.1.6" +gem "pg", "~> 1.1" gemspec path: "../" diff --git a/gemfiles/6.1.gemfile b/gemfiles/6.1.gemfile index ad31f32..76e0df3 100644 --- a/gemfiles/6.1.gemfile +++ b/gemfiles/6.1.gemfile @@ -4,5 +4,6 @@ source "https://rubygems.org" gem "activerecord", "~> 6.1.0" gem "with_model", "~> 2.1.6" +gem "pg", "~> 1.1" gemspec path: "../"