audited 5.3.3 → 5.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1979018213d9b4793bf6c450161759ad6e2ee8c0749c21c9c361bb012b703016
4
- data.tar.gz: 113875c36e93998ef49e54e1ee65812996a28d553f5fd17c9a6252ea046f2cbc
3
+ metadata.gz: 8064f489d5ebd438af237683541fb2436fc687d786a688f5d6ce936e24e6d89b
4
+ data.tar.gz: b6acaf26b868f64883dcd9af556cfc5233be1395c3fc03fdea13c3c7449de6b8
5
5
  SHA512:
6
- metadata.gz: 9d490c64b590cc9df55d67551908bd450c2737f04d55201000c637122682aaf6c1df069cc61894774c1778ddb29488e0f6e22d5786f155f6415cb47c12fc45f5
7
- data.tar.gz: 7801bb4dadea8bef4499f50115749cf589f59ffc795c950dbfdf918989311ec6a1380237ef0bbd05f1c1c9edcfe9c42ff5d66d3e44fb71666127fe57dfbcaaee
6
+ metadata.gz: 9466b4f7ab9a100e9ff0e9e5dbec591dc30e9027d8529c481f3e3faa72cb6d89c2cf5eb6c19e1cbbb6ceba5ea2f55a882e7c4fe2ef587a6eed676640d63372ff
7
+ data.tar.gz: 5f9050ffcff6dcadd3e4040aa941f2f48773ef575e69f2012d4088e9fed327ec35e3a386c7437bbe019cbfc2c32e0e4ac348f49977915ffac6c6e1b1d8580c6c
@@ -18,6 +18,7 @@ jobs:
18
18
  - rails60
19
19
  - rails61
20
20
  - rails70
21
+ - rails71
21
22
  db: [POSTGRES, MYSQL, SQLITE]
22
23
  exclude:
23
24
  # MySQL has issues on Ruby 2.3
@@ -96,6 +97,16 @@ jobs:
96
97
  - appraisal: rails70
97
98
  ruby: 2.6
98
99
 
100
+ # Rails 7.1 supports Ruby 2.7+
101
+ - appraisal: rails71
102
+ ruby: 2.3
103
+ - appraisal: rails71
104
+ ruby: 2.4
105
+ - appraisal: rails71
106
+ ruby: 2.5
107
+ - appraisal: rails71
108
+ ruby: 2.6
109
+
99
110
  services:
100
111
  postgres:
101
112
  image: postgres
data/Appraisals CHANGED
@@ -7,6 +7,7 @@ appraise "rails50" do
7
7
  gem "pg", ">= 0.18", "< 2.0"
8
8
  gem "sqlite3", "~> 1.3.6"
9
9
  gem "psych", "~> 3.1"
10
+ gem "loofah", "2.20.0"
10
11
  end
11
12
 
12
13
  appraise "rails51" do
@@ -15,6 +16,7 @@ appraise "rails51" do
15
16
  gem "pg", ">= 0.18", "< 2.0"
16
17
  gem "sqlite3", "~> 1.3.6"
17
18
  gem "psych", "~> 3.1"
19
+ gem "loofah", "2.20.0"
18
20
  end
19
21
 
20
22
  appraise "rails52" do
@@ -23,6 +25,7 @@ appraise "rails52" do
23
25
  gem "pg", ">= 0.18", "< 2.0"
24
26
  gem "sqlite3", "~> 1.3.6"
25
27
  gem "psych", "~> 3.1"
28
+ gem "loofah", "2.20.0"
26
29
  end
27
30
 
28
31
  appraise "rails60" do
@@ -45,3 +48,10 @@ appraise "rails70" do
45
48
  gem "pg", ">= 1.1"
46
49
  gem "sqlite3", ">= 1.4"
47
50
  end
51
+
52
+ appraise "rails71" do
53
+ gem "rails", ">= 7.1.0.beta1", "< 7.2"
54
+ gem "mysql2", ">= 0.4.4"
55
+ gem "pg", ">= 1.1"
56
+ gem "sqlite3", ">= 1.4"
57
+ end
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Audited ChangeLog
2
2
 
3
+ ## 5.4.1 (2023-09-30)
4
+
5
+ - Replace RequestStore with ActiveSupport::CurrentAttributes - @the-spectator
6
+ [#673](https://github.com/collectiveidea/audited/pull/673/)
7
+ - Don't require railtie when used outside of Rails - @nicduke38degrees
8
+ [#665](https://github.com/collectiveidea/audited/pull/665)
9
+
10
+ ## 5.4.0 (2023-09-30)
11
+
12
+ - Add Rails 7.1 support - @yuki24
13
+ [#686](https://github.com/collectiveidea/audited/pull/686)
14
+
3
15
  ## 5.3.3 (2023-03-24)
4
16
 
5
17
  - Use RequestStore instead of Thread.current for thread-safe requests - @tiagocassio
data/README.md CHANGED
@@ -8,7 +8,7 @@ Audited
8
8
  **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.
9
9
 
10
10
 
11
- Audited currently (5.x) works with Rails 7.0, 6.1, 6.0, 5.2, 5.1, and 5.0.
11
+ Audited currently (5.x) works with Rails 7.1, 7.0, 6.1, 6.0, 5.2, 5.1, and 5.0.
12
12
 
13
13
  For Rails 4, use gem version 4.x
14
14
  For Rails 3, use gem version 3.0 or see the [3.0-stable branch](https://github.com/collectiveidea/audited/tree/3.0-stable).
@@ -7,5 +7,6 @@ gem "mysql2", ">= 0.3.18", "< 0.6.0"
7
7
  gem "pg", ">= 0.18", "< 2.0"
8
8
  gem "sqlite3", "~> 1.3.6"
9
9
  gem "psych", "~> 3.1"
10
+ gem "loofah", "2.20.0"
10
11
 
11
12
  gemspec name: "audited", path: "../"
@@ -7,5 +7,6 @@ gem "mysql2", ">= 0.3.18", "< 0.6.0"
7
7
  gem "pg", ">= 0.18", "< 2.0"
8
8
  gem "sqlite3", "~> 1.3.6"
9
9
  gem "psych", "~> 3.1"
10
+ gem "loofah", "2.20.0"
10
11
 
11
12
  gemspec name: "audited", path: "../"
@@ -7,5 +7,6 @@ gem "mysql2", ">= 0.4.4", "< 0.6.0"
7
7
  gem "pg", ">= 0.18", "< 2.0"
8
8
  gem "sqlite3", "~> 1.3.6"
9
9
  gem "psych", "~> 3.1"
10
+ gem "loofah", "2.20.0"
10
11
 
11
12
  gemspec name: "audited", path: "../"
@@ -0,0 +1,10 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", ">= 7.1.0.beta1", "< 7.2"
6
+ gem "mysql2", ">= 0.4.4"
7
+ gem "pg", ">= 1.1"
8
+ gem "sqlite3", ">= 1.4"
9
+
10
+ gemspec name: "audited", path: "../"
data/lib/audited/audit.rb CHANGED
@@ -49,7 +49,11 @@ module Audited
49
49
  cattr_accessor :audited_class_names
50
50
  self.audited_class_names = Set.new
51
51
 
52
- serialize :audited_changes, YAMLIfTextColumnType
52
+ if Rails.version >= "7.1"
53
+ serialize :audited_changes, coder: YAMLIfTextColumnType
54
+ else
55
+ serialize :audited_changes, YAMLIfTextColumnType
56
+ end
53
57
 
54
58
  scope :ascending, -> { reorder(version: :asc) }
55
59
  scope :descending, -> { reorder(version: :desc) }
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support"
4
+
5
+ module Audited
6
+ class RequestStore < ActiveSupport::CurrentAttributes
7
+ attribute :audited_store
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Audited
4
- VERSION = "5.3.3"
4
+ VERSION = "5.4.1"
5
5
  end
data/lib/audited.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "active_record"
4
- require "request_store"
5
4
 
6
5
  module Audited
7
6
  class << self
@@ -22,10 +21,11 @@ module Audited
22
21
 
23
22
  # remove audit_model in next major version it was only shortly present in 5.1.0
24
23
  alias_method :audit_model, :audit_class
25
- deprecate audit_model: "use Audited.audit_class instead of Audited.audit_model. This method will be removed."
24
+ deprecate audit_model: "use Audited.audit_class instead of Audited.audit_model. This method will be removed.",
25
+ deprecator: ActiveSupport::Deprecation.new('6.0.0', 'Audited')
26
26
 
27
27
  def store
28
- RequestStore.store[:audited_store] ||= {}
28
+ Audited::RequestStore.audited_store ||= {}
29
29
  end
30
30
 
31
31
  def config
@@ -41,6 +41,7 @@ module Audited
41
41
  end
42
42
 
43
43
  require "audited/auditor"
44
+ require "audited/request_store"
44
45
 
45
46
  ActiveSupport.on_load :active_record do
46
47
  require "audited/audit"
@@ -48,4 +49,4 @@ ActiveSupport.on_load :active_record do
48
49
  end
49
50
 
50
51
  require "audited/sweeper"
51
- require "audited/railtie"
52
+ require "audited/railtie" if Audited.const_defined?(:Rails)
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- SingleCov.covered! uncovered: 1 # Rails version check
3
+ SingleCov.covered! uncovered: 2 # Rails version check
4
4
 
5
5
  class CustomAudit < Audited::Audit
6
6
  def custom_method
data/spec/audited_spec.rb CHANGED
@@ -3,12 +3,16 @@ require "spec_helper"
3
3
  describe Audited do
4
4
  describe "#store" do
5
5
  describe "maintains state of store" do
6
- let(:current_user) { RequestStore.store[:audited_store] }
6
+ let(:current_user) { Audited::RequestStore.audited_store }
7
7
  before { Audited.store[:current_user] = current_user }
8
8
 
9
9
  it "checks store is not nil" do
10
10
  expect(Audited.store[:current_user]).to eq(current_user)
11
11
  end
12
+
13
+ it "when executed with Fibers" do
14
+ Fiber.new { expect(Audited.store[:current_user]).to eq(current_user) }.resume
15
+ end
12
16
  end
13
17
  end
14
18
  end
@@ -5,11 +5,34 @@ module RailsApp
5
5
  config.root = File.expand_path("../../", __FILE__)
6
6
  config.i18n.enforce_available_locales = true
7
7
 
8
- if !Rails.version.start_with?("5.0") && !Rails.version.start_with?("5.1") && config.active_record.respond_to?(:yaml_column_permitted_classes=)
8
+ if Rails.version.start_with?("7.1") && config.active_record.respond_to?(:yaml_column_permitted_classes=)
9
+ config.active_record.yaml_column_permitted_classes = [
10
+ String,
11
+ Symbol,
12
+ Integer,
13
+ NilClass,
14
+ Float,
15
+ Time,
16
+ Date,
17
+ FalseClass,
18
+ Hash,
19
+ Array,
20
+ DateTime,
21
+ TrueClass,
22
+ BigDecimal,
23
+ ActiveSupport::TimeWithZone,
24
+ ActiveSupport::TimeZone,
25
+ ActiveSupport::HashWithIndifferentAccess
26
+ ]
27
+ elsif !Rails.version.start_with?("5.0") && !Rails.version.start_with?("5.1") && config.active_record.respond_to?(:yaml_column_permitted_classes=)
9
28
  config.active_record.yaml_column_permitted_classes =
10
29
  %w[String Symbol Integer NilClass Float Time Date FalseClass Hash Array DateTime TrueClass BigDecimal
11
30
  ActiveSupport::TimeWithZone ActiveSupport::TimeZone ActiveSupport::HashWithIndifferentAccess]
12
31
  end
32
+
33
+ if Rails.version >= "7.1"
34
+ config.active_support.cache_format_version = 7.1
35
+ end
13
36
  end
14
37
  end
15
38
 
@@ -8,7 +8,12 @@ module Models
8
8
  attribute :non_column_attr if Rails.version >= "5.1"
9
9
  attr_protected :logins if respond_to?(:attr_protected)
10
10
  enum status: {active: 0, reliable: 1, banned: 2}
11
- serialize :phone_numbers, Array
11
+
12
+ if Rails.version >= "7.1"
13
+ serialize :phone_numbers, type: Array
14
+ else
15
+ serialize :phone_numbers, Array
16
+ end
12
17
 
13
18
  def name=(val)
14
19
  write_attribute(:name, CGI.escapeHTML(val))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audited
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.3
4
+ version: 5.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keepers
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2023-04-24 00:00:00.000000000 Z
16
+ date: 2023-11-06 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: activerecord
@@ -24,7 +24,7 @@ dependencies:
24
24
  version: '5.0'
25
25
  - - "<"
26
26
  - !ruby/object:Gem::Version
27
- version: '7.1'
27
+ version: '7.7'
28
28
  type: :runtime
29
29
  prerelease: false
30
30
  version_requirements: !ruby/object:Gem::Requirement
@@ -34,21 +34,27 @@ dependencies:
34
34
  version: '5.0'
35
35
  - - "<"
36
36
  - !ruby/object:Gem::Version
37
- version: '7.1'
37
+ version: '7.7'
38
38
  - !ruby/object:Gem::Dependency
39
- name: request_store
39
+ name: activesupport
40
40
  requirement: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - "~>"
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '5.0'
45
+ - - "<"
43
46
  - !ruby/object:Gem::Version
44
- version: '1.2'
47
+ version: '7.7'
45
48
  type: :runtime
46
49
  prerelease: false
47
50
  version_requirements: !ruby/object:Gem::Requirement
48
51
  requirements:
49
- - - "~>"
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '5.0'
55
+ - - "<"
50
56
  - !ruby/object:Gem::Version
51
- version: '1.2'
57
+ version: '7.7'
52
58
  - !ruby/object:Gem::Dependency
53
59
  name: appraisal
54
60
  requirement: !ruby/object:Gem::Requirement
@@ -72,7 +78,7 @@ dependencies:
72
78
  version: '5.0'
73
79
  - - "<"
74
80
  - !ruby/object:Gem::Version
75
- version: '7.1'
81
+ version: '7.7'
76
82
  type: :development
77
83
  prerelease: false
78
84
  version_requirements: !ruby/object:Gem::Requirement
@@ -82,7 +88,7 @@ dependencies:
82
88
  version: '5.0'
83
89
  - - "<"
84
90
  - !ruby/object:Gem::Version
85
- version: '7.1'
91
+ version: '7.7'
86
92
  - !ruby/object:Gem::Dependency
87
93
  name: rspec-rails
88
94
  requirement: !ruby/object:Gem::Requirement
@@ -196,11 +202,13 @@ files:
196
202
  - gemfiles/rails60.gemfile
197
203
  - gemfiles/rails61.gemfile
198
204
  - gemfiles/rails70.gemfile
205
+ - gemfiles/rails71.gemfile
199
206
  - lib/audited-rspec.rb
200
207
  - lib/audited.rb
201
208
  - lib/audited/audit.rb
202
209
  - lib/audited/auditor.rb
203
210
  - lib/audited/railtie.rb
211
+ - lib/audited/request_store.rb
204
212
  - lib/audited/rspec_matchers.rb
205
213
  - lib/audited/sweeper.rb
206
214
  - lib/audited/version.rb