From 251a382c51dff66a93c45b62bcf3b31b5014dde3 Mon Sep 17 00:00:00 2001 From: Will Leonard Date: Fri, 4 Apr 2025 21:04:14 -0400 Subject: [PATCH 1/4] Add rails 7.1 and 7.2 support --- Appraisals | 18 +++++++++--------- CHANGELOG.md | 4 ++++ activerecord-type-symbol.gemspec | 4 ++-- gemfiles/rails_7.0.gemfile | 10 ++++------ gemfiles/rails_7.1.gemfile | 8 ++++++++ gemfiles/rails_7.2.gemfile | 8 ++++++++ lib/active_record/type/symbol.rb | 2 +- spec/activerecord/type/symbol_spec.rb | 8 ++++---- 8 files changed, 40 insertions(+), 22 deletions(-) create mode 100644 gemfiles/rails_7.1.gemfile create mode 100644 gemfiles/rails_7.2.gemfile diff --git a/Appraisals b/Appraisals index db10739..2818706 100644 --- a/Appraisals +++ b/Appraisals @@ -1,16 +1,16 @@ # frozen_string_literal: true -appraise 'rails-6.0' do - gem 'activemodel', '6.0.3.3' - gem 'activerecord', '6.0.3.3' +appraise 'rails-7.0' do + gem 'activemodel', '~> 7.0.8' + gem 'activerecord', '~> 7.0.8' end -appraise 'rails-6.1' do - gem 'activemodel', '6.1.0' - gem 'activerecord', '6.1.0' +appraise 'rails-7.1' do + gem 'activemodel', '~> 7.1.5' + gem 'activerecord', '~> 7.1.5' end -appraise 'rails-7.0' do - gem 'activemodel', '7.0.1' - gem 'activerecord', '7.0.1' +appraise 'rails-7.2' do + gem 'activemodel', '~> 7.2.2' + gem 'activerecord', '~> 7.2.2' end diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ca098e..f6f4da5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.6.0 +- Support rails 7.1 and 7.2 +- Drop support rails < 7.0 + ## 0.5.0 - Support rails 7.0 and ruby 3.1 - Drop support rails < 6.0 diff --git a/activerecord-type-symbol.gemspec b/activerecord-type-symbol.gemspec index e7bf4e3..0c071e8 100644 --- a/activerecord-type-symbol.gemspec +++ b/activerecord-type-symbol.gemspec @@ -29,8 +29,8 @@ Gem::Specification.new do |spec| spec.required_ruby_version = '>= 2.7' - spec.add_dependency 'activemodel', '>= 5.0', '< 7.1' - spec.add_dependency 'activerecord', '>= 5.0', '< 7.1' + spec.add_dependency 'activemodel', '>= 7.0', '< 8.0' + spec.add_dependency 'activerecord', '>= 7.0', '< 8.0' spec.add_development_dependency 'appraisal' spec.add_development_dependency 'bundler', '>= 1.3.0' diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile index 6007a7b..1ef528c 100644 --- a/gemfiles/rails_7.0.gemfile +++ b/gemfiles/rails_7.0.gemfile @@ -1,10 +1,8 @@ -# frozen_string_literal: true - # This file was generated by Appraisal -source 'https://rubygems.org' +source "https://rubygems.org" -gem 'activemodel', '7.0.1' -gem 'activerecord', '7.0.1' +gem "activemodel", "~> 7.0.8" +gem "activerecord", "~> 7.0.8" -gemspec path: '../' +gemspec path: "../" diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_7.1.gemfile new file mode 100644 index 0000000..558f98b --- /dev/null +++ b/gemfiles/rails_7.1.gemfile @@ -0,0 +1,8 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activemodel", "~> 7.1.5" +gem "activerecord", "~> 7.1.5" + +gemspec path: "../" diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile new file mode 100644 index 0000000..c5525b7 --- /dev/null +++ b/gemfiles/rails_7.2.gemfile @@ -0,0 +1,8 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "activemodel", "~> 7.2.2" +gem "activerecord", "~> 7.2.2" + +gemspec path: "../" diff --git a/lib/active_record/type/symbol.rb b/lib/active_record/type/symbol.rb index a27eab9..e6c2954 100644 --- a/lib/active_record/type/symbol.rb +++ b/lib/active_record/type/symbol.rb @@ -3,7 +3,7 @@ module ActiveRecord module Type class Symbol < ActiveModel::Type::Value - VERSION = '0.5.0' + VERSION = '0.6.0' def type :symbol diff --git a/spec/activerecord/type/symbol_spec.rb b/spec/activerecord/type/symbol_spec.rb index 14abac5..ec73197 100644 --- a/spec/activerecord/type/symbol_spec.rb +++ b/spec/activerecord/type/symbol_spec.rb @@ -97,7 +97,7 @@ end context 'default value' do - with_model :ModelWithSymbolAttributeWithDefaultValue do + with_model :ModelWithSymbolAttrWithDefaultValue do table do |t| t.string :data_type end @@ -108,7 +108,7 @@ end context 'new record' do - let(:model) { ModelWithSymbolAttributeWithDefaultValue.new } + let(:model) { ModelWithSymbolAttrWithDefaultValue.new } specify 'returns the default value' do expect(model.data_type).to eq(:string) @@ -116,7 +116,7 @@ end context 'saved record' do - let(:model) { ModelWithSymbolAttributeWithDefaultValue.create } + let(:model) { ModelWithSymbolAttrWithDefaultValue.create } specify 'returns the default value' do model.reload @@ -125,7 +125,7 @@ end context 'saved record with nil in the database' do - let(:model) { ModelWithSymbolAttributeWithDefaultValue.create } + let(:model) { ModelWithSymbolAttrWithDefaultValue.create } specify 'returns nil' do model.update(data_type: nil) From 247b887b2d28d88b322afb2d90670753d6dfdbba Mon Sep 17 00:00:00 2001 From: Will Leonard Date: Fri, 4 Apr 2025 21:06:21 -0400 Subject: [PATCH 2/4] Update github action --- .github/workflows/ruby_ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ruby_ci.yml b/.github/workflows/ruby_ci.yml index 1116a6a..d5383f3 100644 --- a/.github/workflows/ruby_ci.yml +++ b/.github/workflows/ruby_ci.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: ruby-version: ['2.7.5', '3.0.3', '3.1.0'] - gemfile: ['gemfiles/rails_6.0.gemfile', 'gemfiles/rails_6.1.gemfile', 'gemfiles/rails_7.0.gemfile'] + gemfile: ['gemfiles/rails_7.0.gemfile', 'gemfiles/rails_7.1.gemfile', 'gemfiles/rails_7.2.gemfile'] steps: - name: Checkout code @@ -49,4 +49,4 @@ jobs: run: bundle install --jobs 4 --retry 3 - name: Run RuboCop - run: BUNDLE_GEMFILE=${{ matrix.gemfile }} bundle exec rubocop \ No newline at end of file + run: BUNDLE_GEMFILE=${{ matrix.gemfile }} bundle exec rubocop From f97ac2124ce117036c52533f3ab6d9c7bb3fb309 Mon Sep 17 00:00:00 2001 From: Will Leonard Date: Fri, 4 Apr 2025 21:12:00 -0400 Subject: [PATCH 3/4] Do this --- .github/workflows/ruby_ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ruby_ci.yml b/.github/workflows/ruby_ci.yml index d5383f3..bc1162f 100644 --- a/.github/workflows/ruby_ci.yml +++ b/.github/workflows/ruby_ci.yml @@ -13,8 +13,13 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['2.7.5', '3.0.3', '3.1.0'] + ruby-version: ['2.7.8', '3.0.7', '3.1.7'] gemfile: ['gemfiles/rails_7.0.gemfile', 'gemfiles/rails_7.1.gemfile', 'gemfiles/rails_7.2.gemfile'] + exclude: + - ruby-version: '2.7.8' + gemfile: 'gemfiles/rails_7.2.gemfile' + - ruby-version: '3.0.7' + gemfile: 'gemfiles/rails_7.2.gemfile' steps: - name: Checkout code From f315746fb877a24b6c80964a4d9af0f2d31e0ad6 Mon Sep 17 00:00:00 2001 From: Will Leonard Date: Fri, 4 Apr 2025 21:19:23 -0400 Subject: [PATCH 4/4] Rubocop --- .rubocop.yml | 2 +- gemfiles/rails_7.0.gemfile | 10 ++++++---- gemfiles/rails_7.1.gemfile | 10 ++++++---- gemfiles/rails_7.2.gemfile | 10 ++++++---- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 33d9610..e5ca953 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -25,7 +25,7 @@ Metrics/BlockLength: - 'spec/**/*.rb' - 'activerecord-type-symbol.gemspec' -Metrics/LineLength: +Layout/LineLength: Max: 120 Exclude: - 'activerecord-type-symbol.gemspec' diff --git a/gemfiles/rails_7.0.gemfile b/gemfiles/rails_7.0.gemfile index 1ef528c..a2e8a4e 100644 --- a/gemfiles/rails_7.0.gemfile +++ b/gemfiles/rails_7.0.gemfile @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # This file was generated by Appraisal -source "https://rubygems.org" +source 'https://rubygems.org' -gem "activemodel", "~> 7.0.8" -gem "activerecord", "~> 7.0.8" +gem 'activemodel', '~> 7.0.8' +gem 'activerecord', '~> 7.0.8' -gemspec path: "../" +gemspec path: '../' diff --git a/gemfiles/rails_7.1.gemfile b/gemfiles/rails_7.1.gemfile index 558f98b..f7ae473 100644 --- a/gemfiles/rails_7.1.gemfile +++ b/gemfiles/rails_7.1.gemfile @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # This file was generated by Appraisal -source "https://rubygems.org" +source 'https://rubygems.org' -gem "activemodel", "~> 7.1.5" -gem "activerecord", "~> 7.1.5" +gem 'activemodel', '~> 7.1.5' +gem 'activerecord', '~> 7.1.5' -gemspec path: "../" +gemspec path: '../' diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile index c5525b7..3425e1d 100644 --- a/gemfiles/rails_7.2.gemfile +++ b/gemfiles/rails_7.2.gemfile @@ -1,8 +1,10 @@ +# frozen_string_literal: true + # This file was generated by Appraisal -source "https://rubygems.org" +source 'https://rubygems.org' -gem "activemodel", "~> 7.2.2" -gem "activerecord", "~> 7.2.2" +gem 'activemodel', '~> 7.2.2' +gem 'activerecord', '~> 7.2.2' -gemspec path: "../" +gemspec path: '../'