From 88b0942a436ba15b638a46b7734b90922e60126b Mon Sep 17 00:00:00 2001 From: m-nakamura145 Date: Tue, 21 May 2024 21:46:23 +0900 Subject: [PATCH 01/25] Bump actions/checkout --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 892ca86a..591e9e47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,7 @@ jobs: sudo /etc/init.d/mysql start mysql -e 'CREATE DATABASE audited_test;' -uroot -proot mysql -e 'SHOW DATABASES;' -uroot -proot - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Copy Gemfile run: sed 's/\.\././' gemfiles/${{ matrix.appraisal }}.gemfile > Gemfile - name: Set up Ruby ${{ matrix.ruby }} From 1666b3f5e3ee41687df66399857c55b891e2dbad Mon Sep 17 00:00:00 2001 From: Fernando Menolli Date: Fri, 21 Jun 2024 16:23:56 -0300 Subject: [PATCH 02/25] added support to rails 8.0 --- .github/workflows/ci.yml | 3 +++ Appraisals | 7 +++++++ audited.gemspec | 6 +++--- gemfiles/rails80.gemfile | 10 ++++++++++ 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 gemfiles/rails80.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 892ca86a..bc52386f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: - rails61 - rails70 - rails71 + - rails80 db: [POSTGRES, MYSQL, SQLITE] exclude: # MySQL has issues on Ruby 2.3 @@ -78,6 +79,8 @@ jobs: ruby: 2.5 - appraisal: rails71 ruby: 2.6 + - appraisal: rails80 + ruby: 2.6 services: postgres: diff --git a/Appraisals b/Appraisals index e724b7b4..7cfda3f7 100644 --- a/Appraisals +++ b/Appraisals @@ -55,3 +55,10 @@ appraise "rails71" do gem "pg", ">= 1.1" gem "sqlite3", ">= 1.4" end + +appraise "rails80" do + gem "rails", ">= 7.1.0.beta1", "< 8.0" + gem "mysql2", ">= 0.4.4" + gem "pg", ">= 1.1" + gem "sqlite3", ">= 1.4" +end diff --git a/audited.gemspec b/audited.gemspec index 1f52c860..bc1b17ff 100644 --- a/audited.gemspec +++ b/audited.gemspec @@ -16,11 +16,11 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.3.0" - gem.add_dependency "activerecord", ">= 5.2", "< 7.2" - gem.add_dependency "activesupport", ">= 5.2", "< 7.2" + gem.add_dependency "activerecord", ">= 5.2", "< 8.0" + gem.add_dependency "activesupport", ">= 5.2", "< 8.0" gem.add_development_dependency "appraisal" - gem.add_development_dependency "rails", ">= 5.2", "< 7.2" + gem.add_development_dependency "rails", ">= 5.2", "< 8.0" gem.add_development_dependency "rspec-rails" gem.add_development_dependency "standard" gem.add_development_dependency "single_cov" diff --git a/gemfiles/rails80.gemfile b/gemfiles/rails80.gemfile new file mode 100644 index 00000000..0a86ef23 --- /dev/null +++ b/gemfiles/rails80.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", ">= 7.1.0.beta1", "< 8.0" +gem "mysql2", ">= 0.4.4" +gem "pg", ">= 1.1" +gem "sqlite3", ">= 1.4" + +gemspec name: "audited", path: "../" From 471de35e0fa57b5edb4af23e142715c0be6c0cd8 Mon Sep 17 00:00:00 2001 From: Fernando Menolli Date: Fri, 21 Jun 2024 16:33:19 -0300 Subject: [PATCH 03/25] correct version --- Appraisals | 2 +- audited.gemspec | 6 +++--- gemfiles/rails80.gemfile | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Appraisals b/Appraisals index 7cfda3f7..4035e37c 100644 --- a/Appraisals +++ b/Appraisals @@ -57,7 +57,7 @@ appraise "rails71" do end appraise "rails80" do - gem "rails", ">= 7.1.0.beta1", "< 8.0" + gem "rails", ">= 7.1.0.beta1", "< 8.1" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1" gem "sqlite3", ">= 1.4" diff --git a/audited.gemspec b/audited.gemspec index bc1b17ff..8257f8b2 100644 --- a/audited.gemspec +++ b/audited.gemspec @@ -16,11 +16,11 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.3.0" - gem.add_dependency "activerecord", ">= 5.2", "< 8.0" - gem.add_dependency "activesupport", ">= 5.2", "< 8.0" + gem.add_dependency "activerecord", ">= 5.2", "< 8.1" + gem.add_dependency "activesupport", ">= 5.2", "< 8.1" gem.add_development_dependency "appraisal" - gem.add_development_dependency "rails", ">= 5.2", "< 8.0" + gem.add_development_dependency "rails", ">= 5.2", "< 8.1" gem.add_development_dependency "rspec-rails" gem.add_development_dependency "standard" gem.add_development_dependency "single_cov" diff --git a/gemfiles/rails80.gemfile b/gemfiles/rails80.gemfile index 0a86ef23..8da34e57 100644 --- a/gemfiles/rails80.gemfile +++ b/gemfiles/rails80.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "rails", ">= 7.1.0.beta1", "< 8.0" +gem "rails", ">= 7.1.0.beta1", "< 8.1" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1" gem "sqlite3", ">= 1.4" From 9a628a5f8662bdcbb38eaace40d587780cb9b278 Mon Sep 17 00:00:00 2001 From: gmhawash Date: Tue, 25 Jun 2024 04:52:06 +0300 Subject: [PATCH 04/25] dynamic max_audits to be proc or symbol --- lib/audited/auditor.rb | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/audited/auditor.rb b/lib/audited/auditor.rb index e2f1388e..c9c867ae 100644 --- a/lib/audited/auditor.rb +++ b/lib/audited/auditor.rb @@ -384,13 +384,25 @@ def comment_required_state? end def combine_audits_if_needed - max_audits = audited_options[:max_audits] + max_audits = evaluate_max_audits + if max_audits && (extra_count = audits.count - max_audits) > 0 audits_to_combine = audits.limit(extra_count + 1) combine_audits(audits_to_combine) end end + def evaluate_max_audits + max_audits = case (option = audited_options[:max_audits]) + when Proc then option.call + when Symbol then send(option) + else + option + end + + Integer(max_audits).abs if max_audits + end + def require_comment if auditing_enabled && audit_comment.blank? errors.add(:audit_comment, :blank) @@ -502,8 +514,7 @@ def normalize_audited_options audited_options[:on] = ([:create, :update, :touch, :destroy] - Audited.ignored_default_callbacks) if audited_options[:on].empty? audited_options[:only] = Array.wrap(audited_options[:only]).map(&:to_s) audited_options[:except] = Array.wrap(audited_options[:except]).map(&:to_s) - max_audits = audited_options[:max_audits] || Audited.max_audits - audited_options[:max_audits] = Integer(max_audits).abs if max_audits + audited_options[:max_audits] ||= Audited.max_audits end def calculate_non_audited_columns From 8031a1aab1cdf60b45275ba59cecd1a2ddf3f326 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:14:20 -0700 Subject: [PATCH 05/25] Remove unsupported Rails 5.0 and 5.1 gemfiles --- Appraisals | 18 ------------------ gemfiles/rails50.gemfile | 12 ------------ gemfiles/rails51.gemfile | 12 ------------ 3 files changed, 42 deletions(-) delete mode 100644 gemfiles/rails50.gemfile delete mode 100644 gemfiles/rails51.gemfile diff --git a/Appraisals b/Appraisals index 4035e37c..d3c2f817 100644 --- a/Appraisals +++ b/Appraisals @@ -1,24 +1,6 @@ # Include DB adapters matching the version requirements in # rails/activerecord/lib/active_record/connection_adapters/*adapter.rb -appraise "rails50" do - gem "rails", "~> 5.0.0" - gem "mysql2", ">= 0.3.18", "< 0.6.0" - gem "pg", ">= 0.18", "< 2.0" - gem "sqlite3", "~> 1.3.6" - gem "psych", "~> 3.1" - gem "loofah", "2.20.0" -end - -appraise "rails51" do - gem "rails", "~> 5.1.4" - gem "mysql2", ">= 0.3.18", "< 0.6.0" - gem "pg", ">= 0.18", "< 2.0" - gem "sqlite3", "~> 1.3.6" - gem "psych", "~> 3.1" - gem "loofah", "2.20.0" -end - appraise "rails52" do gem "rails", ">= 5.2.8.1", "< 5.3" gem "mysql2", ">= 0.4.4", "< 0.6.0" diff --git a/gemfiles/rails50.gemfile b/gemfiles/rails50.gemfile deleted file mode 100644 index 92d5f8c4..00000000 --- a/gemfiles/rails50.gemfile +++ /dev/null @@ -1,12 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rails", "~> 5.0.0" -gem "mysql2", ">= 0.3.18", "< 0.6.0" -gem "pg", ">= 0.18", "< 2.0" -gem "sqlite3", "~> 1.3.6" -gem "psych", "~> 3.1" -gem "loofah", "2.20.0" - -gemspec name: "audited", path: "../" diff --git a/gemfiles/rails51.gemfile b/gemfiles/rails51.gemfile deleted file mode 100644 index fa43c66f..00000000 --- a/gemfiles/rails51.gemfile +++ /dev/null @@ -1,12 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "rails", "~> 5.1.4" -gem "mysql2", ">= 0.3.18", "< 0.6.0" -gem "pg", ">= 0.18", "< 2.0" -gem "sqlite3", "~> 1.3.6" -gem "psych", "~> 3.1" -gem "loofah", "2.20.0" - -gemspec name: "audited", path: "../" From c4ca3d3a9dbfa04ebf3ef77483c6167e16407599 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:15:25 -0700 Subject: [PATCH 06/25] Simplify rails version requirements --- Appraisals | 10 +++++----- gemfiles/rails52.gemfile | 2 +- gemfiles/rails60.gemfile | 2 +- gemfiles/rails61.gemfile | 2 +- gemfiles/rails70.gemfile | 2 +- gemfiles/rails71.gemfile | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Appraisals b/Appraisals index d3c2f817..c1fd6b6c 100644 --- a/Appraisals +++ b/Appraisals @@ -2,7 +2,7 @@ # rails/activerecord/lib/active_record/connection_adapters/*adapter.rb appraise "rails52" do - gem "rails", ">= 5.2.8.1", "< 5.3" + gem "rails", "~> 5.2.8" gem "mysql2", ">= 0.4.4", "< 0.6.0" gem "pg", ">= 0.18", "< 2.0" gem "sqlite3", "~> 1.3.6" @@ -11,28 +11,28 @@ appraise "rails52" do end appraise "rails60" do - gem "rails", ">= 6.0.0", "< 6.1" + gem "rails", "~> 6.0.6" gem "mysql2", ">= 0.4.4" gem "pg", ">= 0.18", "< 2.0" gem "sqlite3", "~> 1.4" end appraise "rails61" do - gem "rails", ">= 6.1.0", "< 6.2" + gem "rails", "~> 6.1.7" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1", "< 2.0" gem "sqlite3", "~> 1.4" end appraise "rails70" do - gem "rails", ">= 7.0.0", "< 7.1" + gem "rails", "~> 7.0.8" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1" gem "sqlite3", ">= 1.4" end appraise "rails71" do - gem "rails", ">= 7.1.0.beta1", "< 7.2" + gem "rails", "~> 7.1.3" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1" gem "sqlite3", ">= 1.4" diff --git a/gemfiles/rails52.gemfile b/gemfiles/rails52.gemfile index b8d7a12b..5b4e53b1 100644 --- a/gemfiles/rails52.gemfile +++ b/gemfiles/rails52.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "rails", ">= 5.2.8.1", "< 5.3" +gem "rails", "~> 5.2.8" gem "mysql2", ">= 0.4.4", "< 0.6.0" gem "pg", ">= 0.18", "< 2.0" gem "sqlite3", "~> 1.3.6" diff --git a/gemfiles/rails60.gemfile b/gemfiles/rails60.gemfile index e4c46a7a..b182f534 100644 --- a/gemfiles/rails60.gemfile +++ b/gemfiles/rails60.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "rails", ">= 6.0.0", "< 6.1" +gem "rails", "~> 6.0.6" gem "mysql2", ">= 0.4.4" gem "pg", ">= 0.18", "< 2.0" gem "sqlite3", "~> 1.4" diff --git a/gemfiles/rails61.gemfile b/gemfiles/rails61.gemfile index b2915340..7fa51886 100644 --- a/gemfiles/rails61.gemfile +++ b/gemfiles/rails61.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "rails", ">= 6.1.0", "< 6.2" +gem "rails", "~> 6.1.7" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1", "< 2.0" gem "sqlite3", "~> 1.4" diff --git a/gemfiles/rails70.gemfile b/gemfiles/rails70.gemfile index 396fda4d..ca0509b7 100644 --- a/gemfiles/rails70.gemfile +++ b/gemfiles/rails70.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "rails", ">= 7.0.0", "< 7.1" +gem "rails", "~> 7.0.8" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1" gem "sqlite3", ">= 1.4" diff --git a/gemfiles/rails71.gemfile b/gemfiles/rails71.gemfile index e34fc967..4244e2c9 100644 --- a/gemfiles/rails71.gemfile +++ b/gemfiles/rails71.gemfile @@ -2,7 +2,7 @@ source "https://rubygems.org" -gem "rails", ">= 7.1.0.beta1", "< 7.2" +gem "rails", "~> 7.1.3" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1" gem "sqlite3", ">= 1.4" From 892baa9e3bf16fa9ca8aaa60e00ed9a8c3a18334 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:16:11 -0700 Subject: [PATCH 07/25] Fix incorrect sqlite3 requirement for rails 7.0 and 7.1 --- Appraisals | 4 ++-- gemfiles/rails70.gemfile | 2 +- gemfiles/rails71.gemfile | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Appraisals b/Appraisals index c1fd6b6c..1e6de7a1 100644 --- a/Appraisals +++ b/Appraisals @@ -28,14 +28,14 @@ appraise "rails70" do gem "rails", "~> 7.0.8" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1" - gem "sqlite3", ">= 1.4" + gem "sqlite3", "~> 1.4" end appraise "rails71" do gem "rails", "~> 7.1.3" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1" - gem "sqlite3", ">= 1.4" + gem "sqlite3", "~> 1.4" end appraise "rails80" do diff --git a/gemfiles/rails70.gemfile b/gemfiles/rails70.gemfile index ca0509b7..592d2cd8 100644 --- a/gemfiles/rails70.gemfile +++ b/gemfiles/rails70.gemfile @@ -5,6 +5,6 @@ source "https://rubygems.org" gem "rails", "~> 7.0.8" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1" -gem "sqlite3", ">= 1.4" +gem "sqlite3", "~> 1.4" gemspec name: "audited", path: "../" diff --git a/gemfiles/rails71.gemfile b/gemfiles/rails71.gemfile index 4244e2c9..90e3e25b 100644 --- a/gemfiles/rails71.gemfile +++ b/gemfiles/rails71.gemfile @@ -5,6 +5,6 @@ source "https://rubygems.org" gem "rails", "~> 7.1.3" gem "mysql2", ">= 0.4.4" gem "pg", ">= 1.1" -gem "sqlite3", ">= 1.4" +gem "sqlite3", "~> 1.4" gemspec name: "audited", path: "../" From 821a3b622b27eda2d79ad25320b2c71a31622c7b Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:17:39 -0700 Subject: [PATCH 08/25] Add gemfile for testing Rails 7.2; remove 8.0 for now --- Appraisals | 8 ++++---- audited.gemspec | 6 +++--- gemfiles/{rails80.gemfile => rails72.gemfile} | 6 +++--- spec/rails_app/config/application.rb | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) rename gemfiles/{rails80.gemfile => rails72.gemfile} (61%) diff --git a/Appraisals b/Appraisals index 1e6de7a1..6df14d46 100644 --- a/Appraisals +++ b/Appraisals @@ -38,9 +38,9 @@ appraise "rails71" do gem "sqlite3", "~> 1.4" end -appraise "rails80" do - gem "rails", ">= 7.1.0.beta1", "< 8.1" - gem "mysql2", ">= 0.4.4" - gem "pg", ">= 1.1" +appraise "rails72" do + gem "rails", "~> 7.2.0" + gem "mysql2", "~> 0.5" + gem "pg", "~> 1.1" gem "sqlite3", ">= 1.4" end diff --git a/audited.gemspec b/audited.gemspec index 8257f8b2..bc1b17ff 100644 --- a/audited.gemspec +++ b/audited.gemspec @@ -16,11 +16,11 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.3.0" - gem.add_dependency "activerecord", ">= 5.2", "< 8.1" - gem.add_dependency "activesupport", ">= 5.2", "< 8.1" + gem.add_dependency "activerecord", ">= 5.2", "< 8.0" + gem.add_dependency "activesupport", ">= 5.2", "< 8.0" gem.add_development_dependency "appraisal" - gem.add_development_dependency "rails", ">= 5.2", "< 8.1" + gem.add_development_dependency "rails", ">= 5.2", "< 8.0" gem.add_development_dependency "rspec-rails" gem.add_development_dependency "standard" gem.add_development_dependency "single_cov" diff --git a/gemfiles/rails80.gemfile b/gemfiles/rails72.gemfile similarity index 61% rename from gemfiles/rails80.gemfile rename to gemfiles/rails72.gemfile index 8da34e57..52cd9d17 100644 --- a/gemfiles/rails80.gemfile +++ b/gemfiles/rails72.gemfile @@ -2,9 +2,9 @@ source "https://rubygems.org" -gem "rails", ">= 7.1.0.beta1", "< 8.1" -gem "mysql2", ">= 0.4.4" -gem "pg", ">= 1.1" +gem "rails", "~> 7.2.0" +gem "mysql2", "~> 0.5" +gem "pg", "~> 1.1" gem "sqlite3", ">= 1.4" gemspec name: "audited", path: "../" diff --git a/spec/rails_app/config/application.rb b/spec/rails_app/config/application.rb index ef40455f..6de73c8e 100644 --- a/spec/rails_app/config/application.rb +++ b/spec/rails_app/config/application.rb @@ -5,7 +5,7 @@ class Application < Rails::Application config.root = File.expand_path("../../", __FILE__) config.i18n.enforce_available_locales = true - if Rails.version.start_with?("7.1") && config.active_record.respond_to?(:yaml_column_permitted_classes=) + if Rails.gem_version >= Gem::Version.new("7.1") && config.active_record.respond_to?(:yaml_column_permitted_classes=) config.active_record.yaml_column_permitted_classes = [ String, Symbol, From 575c29be3a06710aade358dfdd0abd0dde11fe4e Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:17:59 -0700 Subject: [PATCH 09/25] Fix enum deprecation warning on Rails 7.2 --- spec/support/active_record/models.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/spec/support/active_record/models.rb b/spec/support/active_record/models.rb index 2922afe4..34dde868 100644 --- a/spec/support/active_record/models.rb +++ b/spec/support/active_record/models.rb @@ -7,7 +7,12 @@ class User < ::ActiveRecord::Base audited except: :password attribute :non_column_attr if Rails.gem_version >= Gem::Version.new("5.1") attr_protected :logins if respond_to?(:attr_protected) - enum status: {active: 0, reliable: 1, banned: 2} + + if Rails.gem_version >= Gem::Version.new("7.2") + enum :status, {active: 0, reliable: 1, banned: 2} + else + enum status: {active: 0, reliable: 1, banned: 2} + end if Rails.gem_version >= Gem::Version.new("7.1") serialize :phone_numbers, type: Array @@ -136,7 +141,12 @@ class Owner < ::ActiveRecord::Base has_associated_audits has_many :companies, class_name: "OwnedCompany", dependent: :destroy accepts_nested_attributes_for :companies - enum status: {active: 0, reliable: 1, banned: 2} + + if Rails.gem_version >= Gem::Version.new("7.2") + enum :status, {active: 0, reliable: 1, banned: 2} + else + enum status: {active: 0, reliable: 1, banned: 2} + end end class OwnedCompany < ::ActiveRecord::Base From 7b7a9dee51c691244096e3dc6a840e3256bd6c9a Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:20:38 -0700 Subject: [PATCH 10/25] Add Rails 7.2 to CI; remove 8.0 for now --- .github/workflows/ci.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d3e99c5..c5277e47 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: - rails61 - rails70 - rails71 - - rails80 + - rails72 db: [POSTGRES, MYSQL, SQLITE] exclude: # MySQL has issues on Ruby 2.3 @@ -79,8 +79,20 @@ jobs: ruby: 2.5 - appraisal: rails71 ruby: 2.6 - - appraisal: rails80 + + # Rails 7.2 supports Ruby 3.1+ + - appraisal: rails72 + ruby: 2.3 + - appraisal: rails72 + ruby: 2.4 + - appraisal: rails72 + ruby: 2.5 + - appraisal: rails72 ruby: 2.6 + - appraisal: rails72 + ruby: 2.7 + - appraisal: rails72 + ruby: 3.0 services: postgres: From 053ca2ed3d036e42ee374b1f4b8894f6a609b004 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:22:56 -0700 Subject: [PATCH 11/25] Fix problem where 3.0 in CI YAML is interpreted as "3" --- .github/workflows/ci.yml | 58 ++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5277e47..42716160 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2] + ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] appraisal: - rails52 - rails60 @@ -22,77 +22,77 @@ jobs: exclude: # MySQL has issues on Ruby 2.3 # https://github.com/ruby/setup-ruby/issues/150 - - ruby: 2.3 + - ruby: "2.3" db: MYSQL # PostgreSQL is segfaulting on 2.3 # Doesn't seem worth solving. - - ruby: 2.3 + - ruby: "2.3" db: POSTGRES # Rails 5.2 supports Ruby 2.2-2.5 - appraisal: rails52 - ruby: 2.6 + ruby: "2.6" - appraisal: rails52 - ruby: 2.7 + ruby: "2.7" - appraisal: rails52 - ruby: 3.0 + ruby: "3.0" - appraisal: rails52 - ruby: 3.1 + ruby: "3.1" - appraisal: rails52 - ruby: 3.2 + ruby: "3.2" # Rails 6.0 supports Ruby 2.5-2.7 - appraisal: rails60 - ruby: 2.3 + ruby: "2.3" - appraisal: rails60 - ruby: 2.4 + ruby: "2.4" - appraisal: rails60 - ruby: 3.0 + ruby: "3.0" - appraisal: rails60 - ruby: 3.1 + ruby: "3.1" - appraisal: rails60 - ruby: 3.2 + ruby: "3.2" # Rails 6.1 supports Ruby 2.5+ - appraisal: rails61 - ruby: 2.3 + ruby: "2.3" - appraisal: rails61 - ruby: 2.4 + ruby: "2.4" # Rails 7 supports Ruby 2.7+ - appraisal: rails70 - ruby: 2.3 + ruby: "2.3" - appraisal: rails70 - ruby: 2.4 + ruby: "2.4" - appraisal: rails70 - ruby: 2.5 + ruby: "2.5" - appraisal: rails70 - ruby: 2.6 + ruby: "2.6" # Rails 7.1 supports Ruby 2.7+ - appraisal: rails71 - ruby: 2.3 + ruby: "2.3" - appraisal: rails71 - ruby: 2.4 + ruby: "2.4" - appraisal: rails71 - ruby: 2.5 + ruby: "2.5" - appraisal: rails71 - ruby: 2.6 + ruby: "2.6" # Rails 7.2 supports Ruby 3.1+ - appraisal: rails72 - ruby: 2.3 + ruby: "2.3" - appraisal: rails72 - ruby: 2.4 + ruby: "2.4" - appraisal: rails72 - ruby: 2.5 + ruby: "2.5" - appraisal: rails72 - ruby: 2.6 + ruby: "2.6" - appraisal: rails72 - ruby: 2.7 + ruby: "2.7" - appraisal: rails72 - ruby: 3.0 + ruby: "3.0" services: postgres: From 831215bce9955cc6ec31498d6d7d1447951823ac Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:25:14 -0700 Subject: [PATCH 12/25] Add Ruby 3.3 to CI --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42716160..0bf1cdf8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2"] + ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3"] appraisal: - rails52 - rails60 @@ -41,6 +41,8 @@ jobs: ruby: "3.1" - appraisal: rails52 ruby: "3.2" + - appraisal: rails52 + ruby: "3.3" # Rails 6.0 supports Ruby 2.5-2.7 - appraisal: rails60 @@ -53,6 +55,8 @@ jobs: ruby: "3.1" - appraisal: rails60 ruby: "3.2" + - appraisal: rails60 + ruby: "3.3" # Rails 6.1 supports Ruby 2.5+ - appraisal: rails61 From af1efc58a617da4bd2226b58053767e118e8fea7 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:32:16 -0700 Subject: [PATCH 13/25] Increase uncovered baseline to get CI passing --- spec/audited/auditor_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/audited/auditor_spec.rb b/spec/audited/auditor_spec.rb index a8af7bcb..cff4044b 100644 --- a/spec/audited/auditor_spec.rb +++ b/spec/audited/auditor_spec.rb @@ -2,7 +2,8 @@ # not testing proxy_respond_to? hack / 2 methods / deprecation of `version` # also, an additional 6 around `after_touch` for Versions before 6. -uncovered = (ActiveRecord::VERSION::MAJOR < 6) ? 15 : 9 +# Increased to 17/10 to get to green CI as a new baseline, August 2024. +uncovered = (ActiveRecord::VERSION::MAJOR < 6) ? 17 : 10 SingleCov.covered! uncovered: uncovered class ConditionalPrivateCompany < ::ActiveRecord::Base From 83bab73dabf9f4a855e58e7a2f9239b5c10424a7 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:33:00 -0700 Subject: [PATCH 14/25] Fix incorrect YAML indentation --- .github/workflows/ci.yml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bf1cdf8..ed0a8dc4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,24 +113,24 @@ jobs: env: DB_DATABASE: audited_test DB_USER: root - DB_PASSWORD: 'root' + DB_PASSWORD: "root" DB_HOST: localhost steps: - - name: Setup MySQL - run: | - sudo /etc/init.d/mysql start - mysql -e 'CREATE DATABASE audited_test;' -uroot -proot - mysql -e 'SHOW DATABASES;' -uroot -proot - - uses: actions/checkout@v4 - - name: Copy Gemfile - run: sed 's/\.\././' gemfiles/${{ matrix.appraisal }}.gemfile > Gemfile - - name: Set up Ruby ${{ matrix.ruby }} - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Run tests - env: - DB: ${{ matrix.db }} - run: bundle exec rake + - name: Setup MySQL + run: | + sudo /etc/init.d/mysql start + mysql -e 'CREATE DATABASE audited_test;' -uroot -proot + mysql -e 'SHOW DATABASES;' -uroot -proot + - uses: actions/checkout@v4 + - name: Copy Gemfile + run: sed 's/\.\././' gemfiles/${{ matrix.appraisal }}.gemfile > Gemfile + - name: Set up Ruby ${{ matrix.ruby }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run tests + env: + DB: ${{ matrix.db }} + run: bundle exec rake From c7a002cc4c9f2ee3c8ccc90f8b7d31542f7631e7 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:54:27 -0700 Subject: [PATCH 15/25] Fix postgres migration issue in spec helper under Rails 7.2 --- spec/audited_spec_helpers.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/spec/audited_spec_helpers.rb b/spec/audited_spec_helpers.rb index dc1c57c6..06faba71 100644 --- a/spec/audited_spec_helpers.rb +++ b/spec/audited_spec_helpers.rb @@ -23,7 +23,7 @@ def create_versions(n = 2, attrs = {}) def run_migrations(direction, migrations_paths, target_version = nil) if rails_below?("5.2.0.rc1") ActiveRecord::Migrator.send(direction, migrations_paths, target_version) - elsif rails_below?("6.0.0.rc1") + elsif rails_below?("6.0.0.rc1") || rails_at_least?("7.2.0") ActiveRecord::MigrationContext.new(migrations_paths).send(direction, target_version) else ActiveRecord::MigrationContext.new(migrations_paths, ActiveRecord::SchemaMigration).send(direction, target_version) @@ -33,4 +33,8 @@ def run_migrations(direction, migrations_paths, target_version = nil) def rails_below?(rails_version) Gem::Version.new(Rails::VERSION::STRING) < Gem::Version.new(rails_version) end + + def rails_at_least?(rails_version) + Gem::Version.new(Rails::VERSION::STRING) >= Gem::Version.new(rails_version) + end end From a28a6a4ab1824c14f92950c68e8cbf427598c4c4 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Sat, 10 Aug 2024 17:59:10 -0700 Subject: [PATCH 16/25] Add Rails 7.2 and Ruby 3.3 to the README --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4dabfbb7..7a076c2c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Audited **Audited** (previously acts_as_audited) is an ORM extension that logs all changes to your models. Audited can also record who made those changes, save comments and associate models related to the changes. -Audited currently (5.6) works with Rails 7.1, 7.0, 6.1, 6.0, 5.2. +Audited currently (5.6) works with Rails 7.2, 7.1, 7.0, 6.1, 6.0, 5.2. For Rails 5.0 & 5.1, use gem version 5.4.3 For Rails 4, use gem version 4.x @@ -26,6 +26,7 @@ Audited supports and is [tested against](https://github.com/collectiveidea/audit * 3.0 * 3.1 * 3.2 +* 3.3 Audited may work just fine with a Ruby version not listed above, but we can't guarantee that it will. If you'd like to maintain a Ruby that isn't listed, please let us know with a [pull request](https://github.com/collectiveidea/audited/pulls). From 9aad4d46e52625d1608917df22d0f31fbd873db4 Mon Sep 17 00:00:00 2001 From: Daniel Morrison Date: Tue, 13 Aug 2024 08:56:13 -0400 Subject: [PATCH 17/25] Bump version to 5.7.0 --- CHANGELOG.md | 12 +++++++++++- lib/audited/version.rb | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47fb4bd0..d470758a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Audited ChangeLog +### 5.7.0 (2024-08-13) + +- Support for Rails 7.2 and Ruby 3.3, and testing cleanups - @mattbrictson + [#723](https://github.com/collectiveidea/audited/pull/723) +- Allow max_audits to be a proc or symbol - @gmhawash + [#718](https://github.com/collectiveidea/audited/pull/718) +- Support Rails 8 - @fernandomenolli + [#717](https://github.com/collectiveidea/audited/pull/717) + + ### 5.6.0 (2024-04-05) - Removed support for Rails 5.0 and 5.1. @@ -38,7 +48,7 @@ ## 5.3.3 (2023-03-24) - Use RequestStore instead of Thread.current for thread-safe requests - @tiagocassio - [#669](https://github.com/collectiveidea/audited/pull/669) + [#669](https://github.com/c ollectiveidea/audited/pull/669) - Clean up Touch audits - @mcyoung, @akostadinov [#668](https://github.com/collectiveidea/audited/pull/668) diff --git a/lib/audited/version.rb b/lib/audited/version.rb index 7532757a..54c7f198 100644 --- a/lib/audited/version.rb +++ b/lib/audited/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Audited - VERSION = "5.6.0" + VERSION = "5.7.0" end From ed7da081560bcc0e067fe41db1f4a26c29b231d5 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Mon, 2 Sep 2024 15:43:22 -0700 Subject: [PATCH 18/25] Relax gemspec to allow Rails 8.0; add Rails main branch to CI Rails 8 does not have an alpha or beta rubygems release, but it sounds like a release is imminent (to coincide with Rails World in late September). To prepare for Rails 8, this PR relaxes the Rails requirement in the audited gemspec to allow "< 8.1" instead of "< 8.0". This will allow audited to be used with Rails 8.0 when it is released. To test that audited will work with Rails 8, I added a `rails-main` Gemfile to `Appraisals` that targets the Rails main branch, and included this in the CI matrix. --- .github/workflows/ci.yml | 15 +++++++++++++++ Appraisals | 7 +++++++ audited.gemspec | 6 +++--- gemfiles/rails_main.gemfile | 10 ++++++++++ spec/rails_app/config/application.rb | 4 ++++ 5 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 gemfiles/rails_main.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed0a8dc4..1296c6d3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: - rails70 - rails71 - rails72 + - rails_main db: [POSTGRES, MYSQL, SQLITE] exclude: # MySQL has issues on Ruby 2.3 @@ -98,6 +99,20 @@ jobs: - appraisal: rails72 ruby: "3.0" + # Rails main supports Ruby 3.1+ + - appraisal: rails_main + ruby: "2.3" + - appraisal: rails_main + ruby: "2.4" + - appraisal: rails_main + ruby: "2.5" + - appraisal: rails_main + ruby: "2.6" + - appraisal: rails_main + ruby: "2.7" + - appraisal: rails_main + ruby: "3.0" + services: postgres: image: postgres diff --git a/Appraisals b/Appraisals index 6df14d46..17d2d81e 100644 --- a/Appraisals +++ b/Appraisals @@ -44,3 +44,10 @@ appraise "rails72" do gem "pg", "~> 1.1" gem "sqlite3", ">= 1.4" end + +appraise "rails_main" do + gem "rails", github: "rails/rails", branch: "main" + gem "mysql2", "~> 0.5" + gem "pg", "~> 1.1" + gem "sqlite3", ">= 2.0" +end diff --git a/audited.gemspec b/audited.gemspec index bc1b17ff..8257f8b2 100644 --- a/audited.gemspec +++ b/audited.gemspec @@ -16,11 +16,11 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.3.0" - gem.add_dependency "activerecord", ">= 5.2", "< 8.0" - gem.add_dependency "activesupport", ">= 5.2", "< 8.0" + gem.add_dependency "activerecord", ">= 5.2", "< 8.1" + gem.add_dependency "activesupport", ">= 5.2", "< 8.1" gem.add_development_dependency "appraisal" - gem.add_development_dependency "rails", ">= 5.2", "< 8.0" + gem.add_development_dependency "rails", ">= 5.2", "< 8.1" gem.add_development_dependency "rspec-rails" gem.add_development_dependency "standard" gem.add_development_dependency "single_cov" diff --git a/gemfiles/rails_main.gemfile b/gemfiles/rails_main.gemfile new file mode 100644 index 00000000..c0bd890a --- /dev/null +++ b/gemfiles/rails_main.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", github: "rails/rails", branch: "main" +gem "mysql2", "~> 0.5" +gem "pg", "~> 1.1" +gem "sqlite3", ">= 2.0" + +gemspec name: "audited", path: "../" diff --git a/spec/rails_app/config/application.rb b/spec/rails_app/config/application.rb index 6de73c8e..a485f848 100644 --- a/spec/rails_app/config/application.rb +++ b/spec/rails_app/config/application.rb @@ -33,6 +33,10 @@ class Application < Rails::Application if Rails.gem_version >= Gem::Version.new("7.1") config.active_support.cache_format_version = 7.1 end + + if Rails.gem_version >= Gem::Version.new("8.0.0.alpha") + config.active_support.to_time_preserves_timezone = :zone + end end end From 1a7b90959a0a068805dbd6460d5d2ebd25542e13 Mon Sep 17 00:00:00 2001 From: Matt Brictson Date: Wed, 2 Oct 2024 08:25:45 -0700 Subject: [PATCH 19/25] Rails 8 has dropped support for Ruby 3.1 --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1296c6d3..7a208ce3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,7 +99,7 @@ jobs: - appraisal: rails72 ruby: "3.0" - # Rails main supports Ruby 3.1+ + # Rails main supports Ruby 3.2+ - appraisal: rails_main ruby: "2.3" - appraisal: rails_main @@ -112,6 +112,8 @@ jobs: ruby: "2.7" - appraisal: rails_main ruby: "3.0" + - appraisal: rails_main + ruby: "3.1" services: postgres: From e3a9d1c9b87b83096877a9682fe5f81042ed00bb Mon Sep 17 00:00:00 2001 From: mohammednasser-32 Date: Mon, 21 Oct 2024 20:39:30 +0300 Subject: [PATCH 20/25] allow calling audited multiple times --- lib/audited/auditor.rb | 38 +++++++++++++++++++++++----- spec/audited/auditor_spec.rb | 16 ++++++++++++ spec/support/active_record/models.rb | 6 +++++ 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/lib/audited/auditor.rb b/lib/audited/auditor.rb index c9c867ae..ae43fdb4 100644 --- a/lib/audited/auditor.rb +++ b/lib/audited/auditor.rb @@ -59,9 +59,16 @@ module ClassMethods # end # def audited(options = {}) - # don't allow multiple calls - return if included_modules.include?(Audited::Auditor::AuditedInstanceMethods) + audited? ? update_audited_options(options) : set_audit(options) + end + + private + + def audited? + included_modules.include?(Audited::Auditor::AuditedInstanceMethods) + end + def set_audit(options) extend Audited::Auditor::AuditedClassMethods include Audited::Auditor::AuditedInstanceMethods @@ -69,10 +76,7 @@ def audited(options = {}) class_attribute :audited_options, instance_writer: false attr_accessor :audit_version, :audit_comment - self.audited_options = options - normalize_audited_options - - self.audit_associated_with = audited_options[:associated_with] + set_audited_options(options) if audited_options[:comment_required] validate :presence_of_audit_comment @@ -100,6 +104,23 @@ def audited(options = {}) def has_associated_audits has_many :associated_audits, as: :associated, class_name: Audited.audit_class.name end + + def update_audited_options(new_options) + previous_audit_options = self.audited_options + set_audited_options(new_options) + self.reset_audited_columns + + log_message = "#{self.name} is already audited, audit options will be updated\n"\ + "before: #{previous_audit_options}\n"\ + "after: #{self.audited_options}" + Logger.new($stdout).info(log_message) + end + + def set_audited_options(options) + self.audited_options = options + normalize_audited_options + self.audit_associated_with = audited_options[:associated_with] + end end module AuditedInstanceMethods @@ -530,6 +551,11 @@ def calculate_non_audited_columns def class_auditing_enabled Audited.store.fetch("#{table_name}_auditing_enabled", true) end + + def reset_audited_columns + @audited_columns = nil + @non_audited_columns = nil + end end end end diff --git a/spec/audited/auditor_spec.rb b/spec/audited/auditor_spec.rb index cff4044b..15ff2f77 100644 --- a/spec/audited/auditor_spec.rb +++ b/spec/audited/auditor_spec.rb @@ -1270,4 +1270,20 @@ def stub_global_max_audits(max_audits) }.to_not change(Audited::Audit, :count) end end + + describe "call audit multiple times" do + it "should update audit options" do + user = Models::ActiveRecord::UserOnlyName.create + user.update(password: "new password 1", name: "new name 1") + expect(user.audits.last.audited_changes.keys).to eq(%w[name]) + + user.class.class_eval do + audited only: :password + end + + user = Models::ActiveRecord::UserOnlyName.last + user.update(password: "new password 2", name: "new name 2") + expect(user.audits.last.audited_changes.keys).to eq(%w[password]) + end + end end diff --git a/spec/support/active_record/models.rb b/spec/support/active_record/models.rb index 34dde868..53b57863 100644 --- a/spec/support/active_record/models.rb +++ b/spec/support/active_record/models.rb @@ -36,6 +36,12 @@ class UserOnlyPassword < ::ActiveRecord::Base audited only: :password end + class UserOnlyName < ::ActiveRecord::Base + self.table_name = :users + attribute :non_column_attr if Rails.gem_version >= Gem::Version.new("5.1") + audited only: :name + end + class UserRedactedPassword < ::ActiveRecord::Base self.table_name = :users audited redacted: :password From d1c1b681a86e40238894db4615e4123b5e9e152e Mon Sep 17 00:00:00 2001 From: mohammednasser-32 Date: Tue, 22 Oct 2024 18:59:21 +0300 Subject: [PATCH 21/25] return if options did not change --- lib/audited/auditor.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/audited/auditor.rb b/lib/audited/auditor.rb index ae43fdb4..6b0eef15 100644 --- a/lib/audited/auditor.rb +++ b/lib/audited/auditor.rb @@ -108,6 +108,9 @@ def has_associated_audits def update_audited_options(new_options) previous_audit_options = self.audited_options set_audited_options(new_options) + + return if previous_audit_options == self.audited_options + self.reset_audited_columns log_message = "#{self.name} is already audited, audit options will be updated\n"\ From 882d1cb7742b7c779c5f6612578353e11bfa9f54 Mon Sep 17 00:00:00 2001 From: mohammednasser-32 Date: Tue, 22 Oct 2024 21:58:46 +0300 Subject: [PATCH 22/25] remove log message --- lib/audited/auditor.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/audited/auditor.rb b/lib/audited/auditor.rb index 6b0eef15..a164f72a 100644 --- a/lib/audited/auditor.rb +++ b/lib/audited/auditor.rb @@ -108,15 +108,7 @@ def has_associated_audits def update_audited_options(new_options) previous_audit_options = self.audited_options set_audited_options(new_options) - - return if previous_audit_options == self.audited_options - self.reset_audited_columns - - log_message = "#{self.name} is already audited, audit options will be updated\n"\ - "before: #{previous_audit_options}\n"\ - "after: #{self.audited_options}" - Logger.new($stdout).info(log_message) end def set_audited_options(options) From f2c9d7dca247561d69997467f778ff9d68f90e92 Mon Sep 17 00:00:00 2001 From: Bran Liang Date: Wed, 30 Oct 2024 20:36:15 +0800 Subject: [PATCH 23/25] Relax gemspec to allow Rails 8.1 --- audited.gemspec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/audited.gemspec b/audited.gemspec index 8257f8b2..386cdf67 100644 --- a/audited.gemspec +++ b/audited.gemspec @@ -16,11 +16,11 @@ Gem::Specification.new do |gem| gem.required_ruby_version = ">= 2.3.0" - gem.add_dependency "activerecord", ">= 5.2", "< 8.1" - gem.add_dependency "activesupport", ">= 5.2", "< 8.1" + gem.add_dependency "activerecord", ">= 5.2", "< 8.2" + gem.add_dependency "activesupport", ">= 5.2", "< 8.2" gem.add_development_dependency "appraisal" - gem.add_development_dependency "rails", ">= 5.2", "< 8.1" + gem.add_development_dependency "rails", ">= 5.2", "< 8.2" gem.add_development_dependency "rspec-rails" gem.add_development_dependency "standard" gem.add_development_dependency "single_cov" From e64b4e383801665e57f9fba10022875d99726a1d Mon Sep 17 00:00:00 2001 From: Daniel Morrison Date: Fri, 8 Nov 2024 15:25:26 -0500 Subject: [PATCH 24/25] Add Rails 8.0 to build matrix --- .github/workflows/ci.yml | 17 +++++++++++++++++ Appraisals | 7 +++++++ gemfiles/rails80.gemfile | 10 ++++++++++ 3 files changed, 34 insertions(+) create mode 100644 gemfiles/rails80.gemfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a208ce3..4f5bf267 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: - rails70 - rails71 - rails72 + - rails80 - rails_main db: [POSTGRES, MYSQL, SQLITE] exclude: @@ -99,6 +100,22 @@ jobs: - appraisal: rails72 ruby: "3.0" + # Rails 8.0 supports Ruby 3.2+ + - appraisal: rails80 + ruby: "2.3" + - appraisal: rails80 + ruby: "2.4" + - appraisal: rails80 + ruby: "2.5" + - appraisal: rails80 + ruby: "2.6" + - appraisal: rails80 + ruby: "2.7" + - appraisal: rails80 + ruby: "3.0" + - appraisal: rails80 + ruby: "3.1" + # Rails main supports Ruby 3.2+ - appraisal: rails_main ruby: "2.3" diff --git a/Appraisals b/Appraisals index 17d2d81e..d23f3ef0 100644 --- a/Appraisals +++ b/Appraisals @@ -45,6 +45,13 @@ appraise "rails72" do gem "sqlite3", ">= 1.4" end +appraise "rails80" do + gem "rails", "~> 8.0.0" + gem "mysql2", "~> 0.5" + gem "pg", "~> 1.1" + gem "sqlite3", ">= 1.4" +end + appraise "rails_main" do gem "rails", github: "rails/rails", branch: "main" gem "mysql2", "~> 0.5" diff --git a/gemfiles/rails80.gemfile b/gemfiles/rails80.gemfile new file mode 100644 index 00000000..2942329f --- /dev/null +++ b/gemfiles/rails80.gemfile @@ -0,0 +1,10 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "~> 8.0.0" +gem "mysql2", "~> 0.5" +gem "pg", "~> 1.1" +gem "sqlite3", ">= 1.4" + +gemspec name: "audited", path: "../" From f935285c27151dff179ef274776f865302d40b8d Mon Sep 17 00:00:00 2001 From: Daniel Morrison Date: Fri, 8 Nov 2024 15:40:08 -0500 Subject: [PATCH 25/25] Bump version --- CHANGELOG.md | 6 ++++++ lib/audited/version.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d470758a..6395c14f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Audited ChangeLog +### 5.8.0 (2024-11-08) +- Allow calling audited multiple times - @mohammednasser-32 + [734](https://github.com/collectiveidea/audited/pull/734) +- Relax gemspec to allow Rails 8.1 - @BranLiang + [738](https://github.com/collectiveidea/audited/pull/738) + ### 5.7.0 (2024-08-13) - Support for Rails 7.2 and Ruby 3.3, and testing cleanups - @mattbrictson diff --git a/lib/audited/version.rb b/lib/audited/version.rb index 54c7f198..4e622287 100644 --- a/lib/audited/version.rb +++ b/lib/audited/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Audited - VERSION = "5.7.0" + VERSION = "5.8.0" end