From a49b02d1b754e4eb9fef84bb019a08c92d51448e Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Tue, 10 May 2022 13:09:15 -0400 Subject: [PATCH 1/2] Add ruby 3.1 and activesupport 7.0 support --- .github/workflows/prs.yml | 18 +++++++++++++++--- .gitignore | 1 + Gemfile | 3 ++- gemfiles/Gemfile.activesupport-5.2 | 4 ++++ gemfiles/Gemfile.activesupport-6.0 | 4 ++++ gemfiles/Gemfile.activesupport-6.1 | 4 ++++ gemfiles/Gemfile.activesupport-7.0 | 4 ++++ gemfiles/Gemfile.base | 4 ++++ lib/schema_dev/config.rb | 6 +++++- schema_dev.gemspec | 2 +- .../gemfiles/activerecord-7.0/Gemfile.base.erb | 4 ++++ .../activerecord-7.0/Gemfile.mysql2.erb | 10 ++++++++++ .../activerecord-7.0/Gemfile.postgresql.erb | 10 ++++++++++ .../activerecord-7.0/Gemfile.sqlite3.erb | 10 ++++++++++ 14 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 gemfiles/Gemfile.activesupport-5.2 create mode 100644 gemfiles/Gemfile.activesupport-6.0 create mode 100644 gemfiles/Gemfile.activesupport-6.1 create mode 100644 gemfiles/Gemfile.activesupport-7.0 create mode 100644 gemfiles/Gemfile.base create mode 100644 templates/gemfiles/activerecord-7.0/Gemfile.base.erb create mode 100644 templates/gemfiles/activerecord-7.0/Gemfile.mysql2.erb create mode 100644 templates/gemfiles/activerecord-7.0/Gemfile.postgresql.erb create mode 100644 templates/gemfiles/activerecord-7.0/Gemfile.sqlite3.erb diff --git a/.github/workflows/prs.yml b/.github/workflows/prs.yml index 1e41f20..34dd1ec 100644 --- a/.github/workflows/prs.yml +++ b/.github/workflows/prs.yml @@ -16,14 +16,26 @@ jobs: strategy: fail-fast: false matrix: - ruby-version: ['2.5', '2.6', '2.7', '3.0'] + ruby: ['2.5', '2.6', '2.7', '3.0', '3.1'] + activesupport: ['5.2', '6.0', '6.1', '7.0'] + exclude: + - ruby: '2.5' + activesupport: '7.0' + - ruby: '2.6' + activesupport: '7.0' + - ruby: '3.0' + activesupport: '5.2' + - ruby: '3.1' + activesupport: '5.2' + env: + BUNDLE_GEMFILE: "${{ github.workspace }}/gemfiles/Gemfile.activesupport-${{ matrix.activesupport }}" steps: - uses: actions/checkout@v2 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby-version }} + ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: 'Run bundle update' @@ -36,7 +48,7 @@ jobs: uses: coverallsapp/github-action@master with: github-token: ${{ secrets.GITHUB_TOKEN }} - flag-name: run-${{ matrix.ruby-version }} + flag-name: run-${{ matrix.ruby }}-${{ matrix.activesupport }} parallel: true finish: needs: 'test' diff --git a/.gitignore b/.gitignore index ae3fdc2..80ec423 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /.bundle/ /.yardoc /Gemfile.lock +/gemfiles/*.lock /_yardoc/ /coverage/ /doc/ diff --git a/Gemfile b/Gemfile index 9ece414..a41c27d 100644 --- a/Gemfile +++ b/Gemfile @@ -5,4 +5,5 @@ source 'https://rubygems.org' # Specify your gem's dependencies in schema_dev.gemspec gemspec -gem 'byebug' +gemfile_local = File.expand_path '../Gemfile.local', __FILE__ +eval File.read(gemfile_local), binding, gemfile_local if File.exist? gemfile_local diff --git a/gemfiles/Gemfile.activesupport-5.2 b/gemfiles/Gemfile.activesupport-5.2 new file mode 100644 index 0000000..4a91bf8 --- /dev/null +++ b/gemfiles/Gemfile.activesupport-5.2 @@ -0,0 +1,4 @@ +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/Gemfile.activesupport-6.0 b/gemfiles/Gemfile.activesupport-6.0 new file mode 100644 index 0000000..28917dc --- /dev/null +++ b/gemfiles/Gemfile.activesupport-6.0 @@ -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/Gemfile.activesupport-6.1 b/gemfiles/Gemfile.activesupport-6.1 new file mode 100644 index 0000000..18f0663 --- /dev/null +++ b/gemfiles/Gemfile.activesupport-6.1 @@ -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/Gemfile.activesupport-7.0 b/gemfiles/Gemfile.activesupport-7.0 new file mode 100644 index 0000000..e42685e --- /dev/null +++ b/gemfiles/Gemfile.activesupport-7.0 @@ -0,0 +1,4 @@ +base_gemfile = File.expand_path('../Gemfile.base', __FILE__) +eval File.read(base_gemfile) + +gem "activerecord", ">= 7.0", "< 7.1" diff --git a/gemfiles/Gemfile.base b/gemfiles/Gemfile.base new file mode 100644 index 0000000..ea17434 --- /dev/null +++ b/gemfiles/Gemfile.base @@ -0,0 +1,4 @@ +source 'https://rubygems.org' +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/lib/schema_dev/config.rb b/lib/schema_dev/config.rb index ecc20cd..3961c81 100644 --- a/lib/schema_dev/config.rb +++ b/lib/schema_dev/config.rb @@ -17,7 +17,11 @@ def self._reset end def self.read - new(**YAML.safe_load(Pathname.new(CONFIG_FILE).read, [Symbol]).symbolize_keys) + if ::Gem::Version.new(RUBY_VERSION) >= ::Gem::Version.new('3.1') + new(**YAML.safe_load(Pathname.new(CONFIG_FILE).read, permitted_classes: [Symbol], symbolize_names: true)) + else + new(**YAML.safe_load(Pathname.new(CONFIG_FILE).read, [Symbol], symbolize_names: true)) + end end def self.load diff --git a/schema_dev.gemspec b/schema_dev.gemspec index 0aa5a16..469a793 100644 --- a/schema_dev.gemspec +++ b/schema_dev.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |gem| gem.required_ruby_version = '>= 2.5.0' - gem.add_dependency 'activesupport', '>= 5.2', '< 6.2' + gem.add_dependency 'activesupport', '>= 5.2', '< 7.1' gem.add_dependency 'faraday', '~> 1.0' gem.add_dependency 'simplecov' gem.add_dependency 'simplecov-lcov', '~> 0.8.0' diff --git a/templates/gemfiles/activerecord-7.0/Gemfile.base.erb b/templates/gemfiles/activerecord-7.0/Gemfile.base.erb new file mode 100644 index 0000000..b7f5994 --- /dev/null +++ b/templates/gemfiles/activerecord-7.0/Gemfile.base.erb @@ -0,0 +1,4 @@ +base_gemfile = File.expand_path('../../Gemfile.base', __FILE__) +eval File.read(base_gemfile) + +gem "activerecord", ">= 7.0", "< 7.1" diff --git a/templates/gemfiles/activerecord-7.0/Gemfile.mysql2.erb b/templates/gemfiles/activerecord-7.0/Gemfile.mysql2.erb new file mode 100644 index 0000000..832c90b --- /dev/null +++ b/templates/gemfiles/activerecord-7.0/Gemfile.mysql2.erb @@ -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/templates/gemfiles/activerecord-7.0/Gemfile.postgresql.erb b/templates/gemfiles/activerecord-7.0/Gemfile.postgresql.erb new file mode 100644 index 0000000..1716cd8 --- /dev/null +++ b/templates/gemfiles/activerecord-7.0/Gemfile.postgresql.erb @@ -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/templates/gemfiles/activerecord-7.0/Gemfile.sqlite3.erb b/templates/gemfiles/activerecord-7.0/Gemfile.sqlite3.erb new file mode 100644 index 0000000..3d85216 --- /dev/null +++ b/templates/gemfiles/activerecord-7.0/Gemfile.sqlite3.erb @@ -0,0 +1,10 @@ +base_gemfile = File.expand_path('../Gemfile.base', __FILE__) +eval File.read(base_gemfile), binding, base_gemfile + +platform :ruby do + gem "sqlite3" +end + +platform :jruby do + gem 'activerecord-jdbcsqlite3-adapter', '>=1.3.0.beta2' +end From 5e7c0c660d7b098c6f347657299c138ee677e817 Mon Sep 17 00:00:00 2001 From: Edward Rudd Date: Tue, 10 May 2022 13:43:11 -0400 Subject: [PATCH 2/2] temp: beta version --- lib/schema_dev/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/schema_dev/version.rb b/lib/schema_dev/version.rb index 31b0bc2..fc9409e 100644 --- a/lib/schema_dev/version.rb +++ b/lib/schema_dev/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module SchemaDev - VERSION = '4.1.1' + VERSION = '4.2.beta.2' end