From db25cca4dc7a1dc4d1ee4b93d27a4aa4f803b404 Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Tue, 7 Dec 2021 12:45:57 -0500 Subject: [PATCH 1/4] bump schema_dev and tests rails 6.0 and 6.1 and drop rails < 5.2 and test on ruby 2.5, 2.7, and 3.0 --- .github/workflows/prs.yml | 147 ++++++++++++++++++ .gitignore | 2 +- .simplecov | 18 +++ .travis.yml | 27 ---- Gemfile | 3 +- README.md | 18 ++- gemfiles/Gemfile.base | 2 +- gemfiles/activerecord-4.2/Gemfile.base | 3 - gemfiles/activerecord-4.2/Gemfile.mysql2 | 10 -- gemfiles/activerecord-4.2/Gemfile.postgresql | 10 -- gemfiles/activerecord-5.0/Gemfile.base | 3 - gemfiles/activerecord-5.0/Gemfile.mysql2 | 10 -- gemfiles/activerecord-5.0/Gemfile.postgresql | 10 -- gemfiles/activerecord-5.1/Gemfile.base | 3 - gemfiles/activerecord-5.1/Gemfile.mysql2 | 10 -- gemfiles/activerecord-5.1/Gemfile.postgresql | 10 -- gemfiles/activerecord-5.1/Gemfile.sqlite3 | 10 -- gemfiles/activerecord-5.2/Gemfile.base | 3 +- gemfiles/activerecord-5.2/Gemfile.mysql2 | 4 +- gemfiles/activerecord-5.2/Gemfile.postgresql | 4 +- gemfiles/activerecord-5.2/Gemfile.sqlite3 | 6 +- gemfiles/activerecord-6.0/Gemfile.base | 4 + gemfiles/activerecord-6.0/Gemfile.mysql2 | 10 ++ gemfiles/activerecord-6.0/Gemfile.postgresql | 10 ++ .../Gemfile.sqlite3 | 6 +- gemfiles/activerecord-6.1/Gemfile.base | 4 + gemfiles/activerecord-6.1/Gemfile.mysql2 | 10 ++ gemfiles/activerecord-6.1/Gemfile.postgresql | 10 ++ .../Gemfile.sqlite3 | 6 +- schema_dev.yml | 17 +- schema_monkey.gemspec | 9 +- spec/spec_helper.rb | 15 +- 32 files changed, 266 insertions(+), 148 deletions(-) create mode 100644 .github/workflows/prs.yml create mode 100644 .simplecov delete mode 100644 .travis.yml delete mode 100644 gemfiles/activerecord-4.2/Gemfile.base delete mode 100644 gemfiles/activerecord-4.2/Gemfile.mysql2 delete mode 100644 gemfiles/activerecord-4.2/Gemfile.postgresql delete mode 100644 gemfiles/activerecord-5.0/Gemfile.base delete mode 100644 gemfiles/activerecord-5.0/Gemfile.mysql2 delete mode 100644 gemfiles/activerecord-5.0/Gemfile.postgresql delete mode 100644 gemfiles/activerecord-5.1/Gemfile.base delete mode 100644 gemfiles/activerecord-5.1/Gemfile.mysql2 delete mode 100644 gemfiles/activerecord-5.1/Gemfile.postgresql delete mode 100644 gemfiles/activerecord-5.1/Gemfile.sqlite3 create mode 100644 gemfiles/activerecord-6.0/Gemfile.base create mode 100644 gemfiles/activerecord-6.0/Gemfile.mysql2 create mode 100644 gemfiles/activerecord-6.0/Gemfile.postgresql rename gemfiles/{activerecord-4.2 => activerecord-6.0}/Gemfile.sqlite3 (50%) create mode 100644 gemfiles/activerecord-6.1/Gemfile.base create mode 100644 gemfiles/activerecord-6.1/Gemfile.mysql2 create mode 100644 gemfiles/activerecord-6.1/Gemfile.postgresql rename gemfiles/{activerecord-5.0 => activerecord-6.1}/Gemfile.sqlite3 (50%) diff --git a/.github/workflows/prs.yml b/.github/workflows/prs.yml new file mode 100644 index 0000000..7667ce4 --- /dev/null +++ b/.github/workflows/prs.yml @@ -0,0 +1,147 @@ +# This file was auto-generated by the schema_dev tool, based on the data in +# ./schema_dev.yml +# Please do not edit this file; any changes will be overwritten next time +# schema_dev gets run. +--- +name: CI PR Builds +'on': + push: + branches: + - master + pull_request: +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: + - '2.5' + - '2.7' + - '3.0' + activerecord: + - '5.2' + - '6.0' + - '6.1' + db: + - mysql2 + - sqlite3 + - skip + dbversion: + - skip + exclude: + - ruby: '3.0' + activerecord: '5.2' + - db: skip + dbversion: skip + include: + - ruby: '2.5' + activerecord: '5.2' + db: postgresql + dbversion: '9.6' + - ruby: '2.5' + activerecord: '6.0' + db: postgresql + dbversion: '9.6' + - ruby: '2.5' + activerecord: '6.1' + db: postgresql + dbversion: '9.6' + - ruby: '2.7' + activerecord: '5.2' + db: postgresql + dbversion: '9.6' + - ruby: '2.7' + activerecord: '6.0' + db: postgresql + dbversion: '9.6' + - ruby: '2.7' + activerecord: '6.1' + db: postgresql + dbversion: '9.6' + - ruby: '3.0' + activerecord: '6.0' + db: postgresql + dbversion: '9.6' + - ruby: '3.0' + activerecord: '6.1' + db: postgresql + dbversion: '9.6' + env: + BUNDLE_GEMFILE: "${{ github.workspace }}/gemfiles/activerecord-${{ matrix.activerecord }}/Gemfile.${{ matrix.db }}" + MYSQL_DB_HOST: 127.0.0.1 + MYSQL_DB_USER: root + MYSQL_DB_PASS: database + POSTGRESQL_DB_HOST: 127.0.0.1 + POSTGRESQL_DB_USER: schema_plus_test + POSTGRESQL_DB_PASS: database + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "${{ matrix.ruby }}" + bundler-cache: true + - name: Run bundle update + run: bundle update + - name: Start Mysql + if: matrix.db == 'mysql2' + run: | + docker run --rm --detach \ + -e MYSQL_ROOT_PASSWORD=$MYSQL_DB_PASS \ + -p 3306:3306 \ + --health-cmd "mysqladmin ping --host=127.0.0.1 --password=$MYSQL_DB_PASS --silent" \ + --health-interval 5s \ + --health-timeout 5s \ + --health-retries 5 \ + --name database mysql:5.6 + - name: Start Postgresql + if: matrix.db == 'postgresql' + run: | + docker run --rm --detach \ + -e POSTGRES_USER=$POSTGRESQL_DB_USER \ + -e POSTGRES_PASSWORD=$POSTGRESQL_DB_PASS \ + -p 5432:5432 \ + --health-cmd "pg_isready -q" \ + --health-interval 5s \ + --health-timeout 5s \ + --health-retries 5 \ + --name database postgres:${{ matrix.dbversion }} + - name: Wait for database to start + if: "(matrix.db == 'postgresql' || matrix.db == 'mysql2')" + run: | + COUNT=0 + ATTEMPTS=20 + until [[ $COUNT -eq $ATTEMPTS ]]; do + [ "$(docker inspect -f {{.State.Health.Status}} database)" == "healthy" ] && break + echo $(( COUNT++ )) > /dev/null + sleep 2 + done + - name: Create testing database + if: "(matrix.db == 'postgresql' || matrix.db == 'mysql2')" + run: bundle exec rake create_ci_database + - name: Run tests + run: bundle exec rake spec + - name: Shutdown database + if: always() && (matrix.db == 'postgresql' || matrix.db == 'mysql2') + run: docker stop database + - name: Coveralls Parallel + if: "${{ !env.ACT }}" + uses: coverallsapp/github-action@master + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + flag-name: run-${{ matrix.ruby }}-${{ matrix.activerecord }}-${{ matrix.db }}-${{ matrix.dbversion }} + parallel: true + finish: + needs: test + runs-on: ubuntu-latest + steps: + - name: Coveralls Finished + if: "${{ !env.ACT }}" + uses: coverallsapp/github-action@master + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + parallel-finished: true diff --git a/.gitignore b/.gitignore index 3d7b55a..66fefb6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ /coverage /tmp /pkg -Gemfile.local +/Gemfile.local *.lock *.log diff --git a/.simplecov b/.simplecov new file mode 100644 index 0000000..59f463c --- /dev/null +++ b/.simplecov @@ -0,0 +1,18 @@ +SimpleCov.configure do + enable_coverage :branch + add_filter '/spec/' + + add_group 'Binaries', '/bin/' + add_group 'Libraries', '/lib/' + + if ENV['CI'] + require 'simplecov-lcov' + + SimpleCov::Formatter::LcovFormatter.config do |c| + c.report_with_single_file = true + c.single_report_path = 'coverage/lcov.info' + end + + formatter SimpleCov::Formatter::LcovFormatter + end +end diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2d68410..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -# This file was auto-generated by the schema_dev tool, based on the data in -# ./schema_dev.yml -# Please do not edit this file; any changes will be overwritten next time -# schema_dev gets run. ---- -sudo: false -rvm: -- 2.3.1 -gemfile: -- gemfiles/activerecord-4.2/Gemfile.mysql2 -- gemfiles/activerecord-4.2/Gemfile.postgresql -- gemfiles/activerecord-4.2/Gemfile.sqlite3 -- gemfiles/activerecord-5.0/Gemfile.mysql2 -- gemfiles/activerecord-5.0/Gemfile.postgresql -- gemfiles/activerecord-5.0/Gemfile.sqlite3 -- gemfiles/activerecord-5.1/Gemfile.mysql2 -- gemfiles/activerecord-5.1/Gemfile.postgresql -- gemfiles/activerecord-5.1/Gemfile.sqlite3 -- gemfiles/activerecord-5.2/Gemfile.mysql2 -- gemfiles/activerecord-5.2/Gemfile.postgresql -- gemfiles/activerecord-5.2/Gemfile.sqlite3 -env: POSTGRESQL_DB_USER=postgres MYSQL_DB_USER=travis -addons: - postgresql: '9.4' -before_script: bundle exec rake create_databases -after_script: bundle exec rake drop_databases -script: bundle exec rake travis diff --git a/Gemfile b/Gemfile index 51a05a8..d6f0559 100644 --- a/Gemfile +++ b/Gemfile @@ -2,4 +2,5 @@ source "http://rubygems.org" gemspec -File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local +gemfile_local = File.expand_path '../Gemfile.local', __FILE__ +eval File.read(gemfile_local), binding, gemfile_local if File.exist? gemfile_local diff --git a/README.md b/README.md index 2af4062..85f7f82 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ [![Gem Version](https://badge.fury.io/rb/schema_monkey.svg)](http://badge.fury.io/rb/schema_monkey) -[![Build Status](https://secure.travis-ci.org/SchemaPlus/schema_monkey.svg)](http://travis-ci.org/SchemaPlus/schema_monkey) +[![Build Status](https://github.com/SchemaPlus/schema_monkey/actions/workflows/prs.yml/badge.svg)](https://github.com/SchemaPlus/schema_monkey/actions) [![Coverage Status](https://img.shields.io/coveralls/SchemaPlus/schema_monkey.svg)](https://coveralls.io/r/SchemaPlus/schema_monkey) -[![Dependency Status](https://gemnasium.com/lomba/schema_monkey.svg)](https://gemnasium.com/SchemaPlus/schema_monkey) # SchemaMonkey @@ -227,10 +226,14 @@ SchemaMonkey is tested on: -* ruby **2.3.1** with activerecord **4.2**, using **mysql2**, **sqlite3** or **postgresql** -* ruby **2.3.1** with activerecord **5.0**, using **mysql2**, **sqlite3** or **postgresql** -* ruby **2.3.1** with activerecord **5.1**, using **mysql2**, **sqlite3** or **postgresql** -* ruby **2.3.1** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql** +* ruby **2.5** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql:9.6** +* ruby **2.5** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6** +* ruby **2.5** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6** +* ruby **2.7** with activerecord **5.2**, using **mysql2**, **sqlite3** or **postgresql:9.6** +* ruby **2.7** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6** +* ruby **2.7** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6** +* ruby **3.0** with activerecord **6.0**, using **mysql2**, **sqlite3** or **postgresql:9.6** +* ruby **3.0** with activerecord **6.1**, using **mysql2**, **sqlite3** or **postgresql:9.6** @@ -256,7 +259,7 @@ Some things to know about to help you develop and test: * **schema_dev**: SchemaMonkey uses [schema_dev](https://github.com/SchemaPlus/schema_dev) to facilitate running rspec tests on the matrix of ruby, activerecord, and database versions that the gem supports, both locally and on - [travis-ci](http://travis-ci.org/SchemaPlus/schema_monkey) + [github actions](https://github.com/SchemaPlus/schema_monkey/actions) To to run rspec locally on the full matrix, do: @@ -268,5 +271,4 @@ Some things to know about to help you develop and test: The matrix of configurations is specified in `schema_dev.yml` in the project root. - diff --git a/gemfiles/Gemfile.base b/gemfiles/Gemfile.base index 9831e95..ea17434 100644 --- a/gemfiles/Gemfile.base +++ b/gemfiles/Gemfile.base @@ -1,4 +1,4 @@ source 'https://rubygems.org' -gemspec :path => File.expand_path('..', __FILE__) +gemspec path: File.expand_path('..', __FILE__) File.exist?(gemfile_local = File.expand_path('../Gemfile.local', __FILE__)) and eval File.read(gemfile_local), binding, gemfile_local diff --git a/gemfiles/activerecord-4.2/Gemfile.base b/gemfiles/activerecord-4.2/Gemfile.base deleted file mode 100644 index ad6a424..0000000 --- a/gemfiles/activerecord-4.2/Gemfile.base +++ /dev/null @@ -1,3 +0,0 @@ -eval File.read File.expand_path('../../Gemfile.base', __FILE__) - -gem "activerecord", "~> 4.2.6" diff --git a/gemfiles/activerecord-4.2/Gemfile.mysql2 b/gemfiles/activerecord-4.2/Gemfile.mysql2 deleted file mode 100644 index 9ce0bb5..0000000 --- a/gemfiles/activerecord-4.2/Gemfile.mysql2 +++ /dev/null @@ -1,10 +0,0 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) - -platform :ruby do - gem "mysql2", '>= 0.3.18', '< 0.5' -end - -platform :jruby do - gem 'activerecord-jdbcmysql-adapter' -end diff --git a/gemfiles/activerecord-4.2/Gemfile.postgresql b/gemfiles/activerecord-4.2/Gemfile.postgresql deleted file mode 100644 index add48c4..0000000 --- a/gemfiles/activerecord-4.2/Gemfile.postgresql +++ /dev/null @@ -1,10 +0,0 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) - -platform :ruby do - gem "pg", "< 1" -end - -platform :jruby do - gem 'activerecord-jdbcpostgresql-adapter' -end diff --git a/gemfiles/activerecord-5.0/Gemfile.base b/gemfiles/activerecord-5.0/Gemfile.base deleted file mode 100644 index 4db520c..0000000 --- a/gemfiles/activerecord-5.0/Gemfile.base +++ /dev/null @@ -1,3 +0,0 @@ -eval File.read File.expand_path('../../Gemfile.base', __FILE__) - -gem "activerecord", "~> 5.0.1" diff --git a/gemfiles/activerecord-5.0/Gemfile.mysql2 b/gemfiles/activerecord-5.0/Gemfile.mysql2 deleted file mode 100644 index f6e58e3..0000000 --- a/gemfiles/activerecord-5.0/Gemfile.mysql2 +++ /dev/null @@ -1,10 +0,0 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) - -platform :ruby do - gem "mysql2" -end - -platform :jruby do - gem 'activerecord-jdbcmysql-adapter' -end diff --git a/gemfiles/activerecord-5.0/Gemfile.postgresql b/gemfiles/activerecord-5.0/Gemfile.postgresql deleted file mode 100644 index add48c4..0000000 --- a/gemfiles/activerecord-5.0/Gemfile.postgresql +++ /dev/null @@ -1,10 +0,0 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) - -platform :ruby do - gem "pg", "< 1" -end - -platform :jruby do - gem 'activerecord-jdbcpostgresql-adapter' -end diff --git a/gemfiles/activerecord-5.1/Gemfile.base b/gemfiles/activerecord-5.1/Gemfile.base deleted file mode 100644 index 2ceae37..0000000 --- a/gemfiles/activerecord-5.1/Gemfile.base +++ /dev/null @@ -1,3 +0,0 @@ -eval File.read File.expand_path('../../Gemfile.base', __FILE__) - -gem "activerecord", "~> 5.1.0" diff --git a/gemfiles/activerecord-5.1/Gemfile.mysql2 b/gemfiles/activerecord-5.1/Gemfile.mysql2 deleted file mode 100644 index f6e58e3..0000000 --- a/gemfiles/activerecord-5.1/Gemfile.mysql2 +++ /dev/null @@ -1,10 +0,0 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) - -platform :ruby do - gem "mysql2" -end - -platform :jruby do - gem 'activerecord-jdbcmysql-adapter' -end diff --git a/gemfiles/activerecord-5.1/Gemfile.postgresql b/gemfiles/activerecord-5.1/Gemfile.postgresql deleted file mode 100644 index add48c4..0000000 --- a/gemfiles/activerecord-5.1/Gemfile.postgresql +++ /dev/null @@ -1,10 +0,0 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) - -platform :ruby do - gem "pg", "< 1" -end - -platform :jruby do - gem 'activerecord-jdbcpostgresql-adapter' -end diff --git a/gemfiles/activerecord-5.1/Gemfile.sqlite3 b/gemfiles/activerecord-5.1/Gemfile.sqlite3 deleted file mode 100644 index a116d6d..0000000 --- a/gemfiles/activerecord-5.1/Gemfile.sqlite3 +++ /dev/null @@ -1,10 +0,0 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) - -platform :ruby do - gem "sqlite3" -end - -platform :jruby do - gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2' -end \ No newline at end of file diff --git a/gemfiles/activerecord-5.2/Gemfile.base b/gemfiles/activerecord-5.2/Gemfile.base index efbdc60..b8fb447 100644 --- a/gemfiles/activerecord-5.2/Gemfile.base +++ b/gemfiles/activerecord-5.2/Gemfile.base @@ -1,3 +1,4 @@ -eval File.read File.expand_path('../../Gemfile.base', __FILE__) +base_gemfile = File.expand_path('../../Gemfile.base', __FILE__) +eval File.read(base_gemfile) gem "activerecord", ">= 5.2.0.beta0", "< 5.3" diff --git a/gemfiles/activerecord-5.2/Gemfile.mysql2 b/gemfiles/activerecord-5.2/Gemfile.mysql2 index f6e58e3..832c90b 100644 --- a/gemfiles/activerecord-5.2/Gemfile.mysql2 +++ b/gemfiles/activerecord-5.2/Gemfile.mysql2 @@ -1,5 +1,5 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) +base_gemfile = File.expand_path('../Gemfile.base', __FILE__) +eval File.read(base_gemfile), binding, base_gemfile platform :ruby do gem "mysql2" diff --git a/gemfiles/activerecord-5.2/Gemfile.postgresql b/gemfiles/activerecord-5.2/Gemfile.postgresql index d47da55..1716cd8 100644 --- a/gemfiles/activerecord-5.2/Gemfile.postgresql +++ b/gemfiles/activerecord-5.2/Gemfile.postgresql @@ -1,5 +1,5 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) +base_gemfile = File.expand_path('../Gemfile.base', __FILE__) +eval File.read(base_gemfile), binding, base_gemfile platform :ruby do gem "pg" diff --git a/gemfiles/activerecord-5.2/Gemfile.sqlite3 b/gemfiles/activerecord-5.2/Gemfile.sqlite3 index a116d6d..3d85216 100644 --- a/gemfiles/activerecord-5.2/Gemfile.sqlite3 +++ b/gemfiles/activerecord-5.2/Gemfile.sqlite3 @@ -1,5 +1,5 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) +base_gemfile = File.expand_path('../Gemfile.base', __FILE__) +eval File.read(base_gemfile), binding, base_gemfile platform :ruby do gem "sqlite3" @@ -7,4 +7,4 @@ end platform :jruby do gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2' -end \ No newline at end of file +end diff --git a/gemfiles/activerecord-6.0/Gemfile.base b/gemfiles/activerecord-6.0/Gemfile.base new file mode 100644 index 0000000..4fe90d1 --- /dev/null +++ b/gemfiles/activerecord-6.0/Gemfile.base @@ -0,0 +1,4 @@ +base_gemfile = File.expand_path('../../Gemfile.base', __FILE__) +eval File.read(base_gemfile) + +gem "activerecord", ">= 6.0", "< 6.1" diff --git a/gemfiles/activerecord-6.0/Gemfile.mysql2 b/gemfiles/activerecord-6.0/Gemfile.mysql2 new file mode 100644 index 0000000..832c90b --- /dev/null +++ b/gemfiles/activerecord-6.0/Gemfile.mysql2 @@ -0,0 +1,10 @@ +base_gemfile = File.expand_path('../Gemfile.base', __FILE__) +eval File.read(base_gemfile), binding, base_gemfile + +platform :ruby do + gem "mysql2" +end + +platform :jruby do + gem 'activerecord-jdbcmysql-adapter' +end diff --git a/gemfiles/activerecord-6.0/Gemfile.postgresql b/gemfiles/activerecord-6.0/Gemfile.postgresql new file mode 100644 index 0000000..1716cd8 --- /dev/null +++ b/gemfiles/activerecord-6.0/Gemfile.postgresql @@ -0,0 +1,10 @@ +base_gemfile = File.expand_path('../Gemfile.base', __FILE__) +eval File.read(base_gemfile), binding, base_gemfile + +platform :ruby do + gem "pg" +end + +platform :jruby do + gem 'activerecord-jdbcpostgresql-adapter' +end diff --git a/gemfiles/activerecord-4.2/Gemfile.sqlite3 b/gemfiles/activerecord-6.0/Gemfile.sqlite3 similarity index 50% rename from gemfiles/activerecord-4.2/Gemfile.sqlite3 rename to gemfiles/activerecord-6.0/Gemfile.sqlite3 index a116d6d..3d85216 100644 --- a/gemfiles/activerecord-4.2/Gemfile.sqlite3 +++ b/gemfiles/activerecord-6.0/Gemfile.sqlite3 @@ -1,5 +1,5 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) +base_gemfile = File.expand_path('../Gemfile.base', __FILE__) +eval File.read(base_gemfile), binding, base_gemfile platform :ruby do gem "sqlite3" @@ -7,4 +7,4 @@ end platform :jruby do gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2' -end \ No newline at end of file +end diff --git a/gemfiles/activerecord-6.1/Gemfile.base b/gemfiles/activerecord-6.1/Gemfile.base new file mode 100644 index 0000000..a66a91f --- /dev/null +++ b/gemfiles/activerecord-6.1/Gemfile.base @@ -0,0 +1,4 @@ +base_gemfile = File.expand_path('../../Gemfile.base', __FILE__) +eval File.read(base_gemfile) + +gem "activerecord", ">= 6.1", "< 6.2" diff --git a/gemfiles/activerecord-6.1/Gemfile.mysql2 b/gemfiles/activerecord-6.1/Gemfile.mysql2 new file mode 100644 index 0000000..832c90b --- /dev/null +++ b/gemfiles/activerecord-6.1/Gemfile.mysql2 @@ -0,0 +1,10 @@ +base_gemfile = File.expand_path('../Gemfile.base', __FILE__) +eval File.read(base_gemfile), binding, base_gemfile + +platform :ruby do + gem "mysql2" +end + +platform :jruby do + gem 'activerecord-jdbcmysql-adapter' +end diff --git a/gemfiles/activerecord-6.1/Gemfile.postgresql b/gemfiles/activerecord-6.1/Gemfile.postgresql new file mode 100644 index 0000000..1716cd8 --- /dev/null +++ b/gemfiles/activerecord-6.1/Gemfile.postgresql @@ -0,0 +1,10 @@ +base_gemfile = File.expand_path('../Gemfile.base', __FILE__) +eval File.read(base_gemfile), binding, base_gemfile + +platform :ruby do + gem "pg" +end + +platform :jruby do + gem 'activerecord-jdbcpostgresql-adapter' +end diff --git a/gemfiles/activerecord-5.0/Gemfile.sqlite3 b/gemfiles/activerecord-6.1/Gemfile.sqlite3 similarity index 50% rename from gemfiles/activerecord-5.0/Gemfile.sqlite3 rename to gemfiles/activerecord-6.1/Gemfile.sqlite3 index a116d6d..3d85216 100644 --- a/gemfiles/activerecord-5.0/Gemfile.sqlite3 +++ b/gemfiles/activerecord-6.1/Gemfile.sqlite3 @@ -1,5 +1,5 @@ -require "pathname" -eval(Pathname.new(__FILE__).dirname.join("Gemfile.base").read, binding) +base_gemfile = File.expand_path('../Gemfile.base', __FILE__) +eval File.read(base_gemfile), binding, base_gemfile platform :ruby do gem "sqlite3" @@ -7,4 +7,4 @@ end platform :jruby do gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2' -end \ No newline at end of file +end diff --git a/schema_dev.yml b/schema_dev.yml index f4672e6..18b0948 100644 --- a/schema_dev.yml +++ b/schema_dev.yml @@ -1,11 +1,12 @@ ruby: - - 2.3.1 + - 2.5 + - 2.7 + - 3.0 activerecord: - - 4.2 - - 5.0 - - 5.1 - - 5.2 + - 5.2 + - 6.0 + - 6.1 db: - - mysql2 - - sqlite3 - - postgresql + - mysql2 + - sqlite3 + - postgresql diff --git a/schema_monkey.gemspec b/schema_monkey.gemspec index 7523936..a03c882 100644 --- a/schema_monkey.gemspec +++ b/schema_monkey.gemspec @@ -18,15 +18,14 @@ Gem::Specification.new do |spec| spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) spec.require_paths = ["lib"] - spec.required_ruby_version = ">= 2.1.0" - spec.add_dependency "activerecord", ">= 4.2" + spec.required_ruby_version = ">= 2.5.0" + + spec.add_dependency "activerecord", ">= 5.2" spec.add_dependency "modware", "~> 0.1.0" spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 13.0" spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "rspec-given", "~> 3.6" - spec.add_development_dependency "schema_dev", "~> 3.7" - spec.add_development_dependency "simplecov" - spec.add_development_dependency "simplecov-gem-profile" + spec.add_development_dependency "schema_dev", "~> 4.1" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cf25032..f7499f7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,8 +1,5 @@ require 'simplecov' -require 'simplecov-gem-profile' -SimpleCov.start "gem" do - add_filter "/tasks/" -end +SimpleCov.start $LOAD_PATH.unshift(File.dirname(__FILE__)) $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) @@ -13,6 +10,16 @@ require 'schema_monkey' require 'schema_dev/rspec' +def create_database + config = SchemaDev::Rspec.db_configuration + + return if config['host'].nil? + + ActiveRecord::Tasks::DatabaseTasks.create(config) +end + +create_database + SchemaDev::Rspec.setup Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each {|f| require f} From 8d86f97c6cceac2694f8ce785a2d1ae5aceb9cfe Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Wed, 8 Dec 2021 16:51:42 -0500 Subject: [PATCH 2/4] compatibility with ruby 3 --- lib/schema_monkey.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/schema_monkey.rb b/lib/schema_monkey.rb index b93acf2..82d7c50 100644 --- a/lib/schema_monkey.rb +++ b/lib/schema_monkey.rb @@ -30,7 +30,7 @@ def self.register(mod) end def self.insert(opts={}) - monkey.insert(opts) + monkey.insert(**opts) end private From f221121863e1f915c60b8a2f4a5e84ce59a16a7e Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Wed, 13 Apr 2022 17:50:07 -0400 Subject: [PATCH 3/4] update modware --- schema_monkey.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schema_monkey.gemspec b/schema_monkey.gemspec index a03c882..2538efe 100644 --- a/schema_monkey.gemspec +++ b/schema_monkey.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 2.5.0" spec.add_dependency "activerecord", ">= 5.2" - spec.add_dependency "modware", "~> 0.1.0" + spec.add_dependency "modware", "~> 1.0.0" spec.add_development_dependency "bundler" spec.add_development_dependency "rake", "~> 13.0" From b5a987d5720c748d9bbb97994f0370a6c374e31d Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Wed, 13 Apr 2022 18:15:36 -0400 Subject: [PATCH 4/4] release: 3.0.0 --- README.md | 2 ++ lib/schema_monkey/version.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 85f7f82..ec4d112 100644 --- a/README.md +++ b/README.md @@ -238,6 +238,8 @@ SchemaMonkey is tested on: ## Release Notes + +* 3.0.0 -- updated to support ruby 2.5+ only and rails 5.2 through 6.1 * 2.1.6 -- stricter dependency on modware * 2.1.5 -- Remove dependency on its-it :( #12 * 2.1.4 -- Loosen dependency to allow AR 5.0, and include it in the test matrix diff --git a/lib/schema_monkey/version.rb b/lib/schema_monkey/version.rb index ea37d3d..919493c 100644 --- a/lib/schema_monkey/version.rb +++ b/lib/schema_monkey/version.rb @@ -1,3 +1,3 @@ module SchemaMonkey - VERSION = "2.1.6" + VERSION = "3.0.0" end