audited 5.0.2 → 5.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Appraisals +15 -2
  3. data/CHANGELOG.md +105 -1
  4. data/README.md +29 -11
  5. data/Rakefile +1 -3
  6. data/audited.gemspec +38 -0
  7. data/lib/audited/audit.rb +8 -4
  8. data/lib/audited/auditor.rb +81 -28
  9. data/lib/audited/version.rb +1 -1
  10. data/lib/audited.rb +18 -9
  11. data/lib/generators/audited/migration.rb +10 -2
  12. metadata +39 -57
  13. data/.github/workflows/ci.yml +0 -115
  14. data/.gitignore +0 -17
  15. data/.standard.yml +0 -5
  16. data/.yardopts +0 -3
  17. data/gemfiles/rails50.gemfile +0 -10
  18. data/gemfiles/rails51.gemfile +0 -10
  19. data/gemfiles/rails52.gemfile +0 -10
  20. data/gemfiles/rails60.gemfile +0 -10
  21. data/gemfiles/rails61.gemfile +0 -10
  22. data/gemfiles/rails70.gemfile +0 -10
  23. data/spec/audited/audit_spec.rb +0 -357
  24. data/spec/audited/auditor_spec.rb +0 -1097
  25. data/spec/audited/rspec_matchers_spec.rb +0 -69
  26. data/spec/audited/sweeper_spec.rb +0 -133
  27. data/spec/audited_spec.rb +0 -18
  28. data/spec/audited_spec_helpers.rb +0 -32
  29. data/spec/rails_app/app/assets/config/manifest.js +0 -2
  30. data/spec/rails_app/config/application.rb +0 -13
  31. data/spec/rails_app/config/database.yml +0 -26
  32. data/spec/rails_app/config/environment.rb +0 -5
  33. data/spec/rails_app/config/environments/test.rb +0 -47
  34. data/spec/rails_app/config/initializers/backtrace_silencers.rb +0 -7
  35. data/spec/rails_app/config/initializers/inflections.rb +0 -2
  36. data/spec/rails_app/config/initializers/secret_token.rb +0 -3
  37. data/spec/rails_app/config/routes.rb +0 -3
  38. data/spec/spec_helper.rb +0 -24
  39. data/spec/support/active_record/models.rb +0 -151
  40. data/spec/support/active_record/postgres/1_change_audited_changes_type_to_json.rb +0 -11
  41. data/spec/support/active_record/postgres/2_change_audited_changes_type_to_jsonb.rb +0 -11
  42. data/spec/support/active_record/schema.rb +0 -90
  43. data/test/db/version_1.rb +0 -17
  44. data/test/db/version_2.rb +0 -18
  45. data/test/db/version_3.rb +0 -18
  46. data/test/db/version_4.rb +0 -19
  47. data/test/db/version_5.rb +0 -17
  48. data/test/db/version_6.rb +0 -19
  49. data/test/install_generator_test.rb +0 -62
  50. data/test/test_helper.rb +0 -18
  51. data/test/upgrade_generator_test.rb +0 -97
@@ -4,14 +4,22 @@ module Audited
4
4
  module Generators
5
5
  module Migration
6
6
  # Implement the required interface for Rails::Generators::Migration.
7
- def next_migration_number(dirname) #:nodoc:
7
+ def next_migration_number(dirname) # :nodoc:
8
8
  next_migration_number = current_migration_number(dirname) + 1
9
- if ::ActiveRecord::Base.timestamped_migrations
9
+ if timestamped_migrations?
10
10
  [Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
11
11
  else
12
12
  "%.3d" % next_migration_number
13
13
  end
14
14
  end
15
+
16
+ private
17
+
18
+ def timestamped_migrations?
19
+ (Rails.gem_version >= Gem::Version.new("7.0")) ?
20
+ ::ActiveRecord.timestamped_migrations :
21
+ ::ActiveRecord::Base.timestamped_migrations
22
+ end
15
23
  end
16
24
  end
17
25
  end
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.0.2
4
+ version: 5.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keepers
@@ -10,10 +10,10 @@ authors:
10
10
  - Brian Ryckbost
11
11
  - Steve Richert
12
12
  - Ryan Glover
13
- autorequire:
13
+ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2021-09-16 00:00:00.000000000 Z
16
+ date: 2024-04-05 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: activerecord
@@ -21,20 +21,40 @@ dependencies:
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: '5.0'
24
+ version: '5.2'
25
25
  - - "<"
26
26
  - !ruby/object:Gem::Version
27
- version: '7.1'
27
+ version: '7.2'
28
28
  type: :runtime
29
29
  prerelease: false
30
30
  version_requirements: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '5.0'
34
+ version: '5.2'
35
35
  - - "<"
36
36
  - !ruby/object:Gem::Version
37
- version: '7.1'
37
+ version: '7.2'
38
+ - !ruby/object:Gem::Dependency
39
+ name: activesupport
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: '5.2'
45
+ - - "<"
46
+ - !ruby/object:Gem::Version
47
+ version: '7.2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '5.2'
55
+ - - "<"
56
+ - !ruby/object:Gem::Version
57
+ version: '7.2'
38
58
  - !ruby/object:Gem::Dependency
39
59
  name: appraisal
40
60
  requirement: !ruby/object:Gem::Requirement
@@ -55,20 +75,20 @@ dependencies:
55
75
  requirements:
56
76
  - - ">="
57
77
  - !ruby/object:Gem::Version
58
- version: '5.0'
78
+ version: '5.2'
59
79
  - - "<"
60
80
  - !ruby/object:Gem::Version
61
- version: '7.1'
81
+ version: '7.2'
62
82
  type: :development
63
83
  prerelease: false
64
84
  version_requirements: !ruby/object:Gem::Requirement
65
85
  requirements:
66
86
  - - ">="
67
87
  - !ruby/object:Gem::Version
68
- version: '5.0'
88
+ version: '5.2'
69
89
  - - "<"
70
90
  - !ruby/object:Gem::Version
71
- version: '7.1'
91
+ version: '7.2'
72
92
  - !ruby/object:Gem::Dependency
73
93
  name: rspec-rails
74
94
  requirement: !ruby/object:Gem::Requirement
@@ -115,16 +135,16 @@ dependencies:
115
135
  name: sqlite3
116
136
  requirement: !ruby/object:Gem::Requirement
117
137
  requirements:
118
- - - "~>"
138
+ - - ">="
119
139
  - !ruby/object:Gem::Version
120
- version: '1.3'
140
+ version: 1.3.6
121
141
  type: :development
122
142
  prerelease: false
123
143
  version_requirements: !ruby/object:Gem::Requirement
124
144
  requirements:
125
- - - "~>"
145
+ - - ">="
126
146
  - !ruby/object:Gem::Version
127
- version: '1.3'
147
+ version: 1.3.6
128
148
  - !ruby/object:Gem::Dependency
129
149
  name: mysql2
130
150
  requirement: !ruby/object:Gem::Requirement
@@ -165,22 +185,13 @@ executables: []
165
185
  extensions: []
166
186
  extra_rdoc_files: []
167
187
  files:
168
- - ".github/workflows/ci.yml"
169
- - ".gitignore"
170
- - ".standard.yml"
171
- - ".yardopts"
172
188
  - Appraisals
173
189
  - CHANGELOG.md
174
190
  - Gemfile
175
191
  - LICENSE
176
192
  - README.md
177
193
  - Rakefile
178
- - gemfiles/rails50.gemfile
179
- - gemfiles/rails51.gemfile
180
- - gemfiles/rails52.gemfile
181
- - gemfiles/rails60.gemfile
182
- - gemfiles/rails61.gemfile
183
- - gemfiles/rails70.gemfile
194
+ - audited.gemspec
184
195
  - lib/audited-rspec.rb
185
196
  - lib/audited.rb
186
197
  - lib/audited/audit.rb
@@ -203,40 +214,11 @@ files:
203
214
  - lib/generators/audited/templates/rename_parent_to_association.rb
204
215
  - lib/generators/audited/templates/revert_polymorphic_indexes_order.rb
205
216
  - lib/generators/audited/upgrade_generator.rb
206
- - spec/audited/audit_spec.rb
207
- - spec/audited/auditor_spec.rb
208
- - spec/audited/rspec_matchers_spec.rb
209
- - spec/audited/sweeper_spec.rb
210
- - spec/audited_spec.rb
211
- - spec/audited_spec_helpers.rb
212
- - spec/rails_app/app/assets/config/manifest.js
213
- - spec/rails_app/config/application.rb
214
- - spec/rails_app/config/database.yml
215
- - spec/rails_app/config/environment.rb
216
- - spec/rails_app/config/environments/test.rb
217
- - spec/rails_app/config/initializers/backtrace_silencers.rb
218
- - spec/rails_app/config/initializers/inflections.rb
219
- - spec/rails_app/config/initializers/secret_token.rb
220
- - spec/rails_app/config/routes.rb
221
- - spec/spec_helper.rb
222
- - spec/support/active_record/models.rb
223
- - spec/support/active_record/postgres/1_change_audited_changes_type_to_json.rb
224
- - spec/support/active_record/postgres/2_change_audited_changes_type_to_jsonb.rb
225
- - spec/support/active_record/schema.rb
226
- - test/db/version_1.rb
227
- - test/db/version_2.rb
228
- - test/db/version_3.rb
229
- - test/db/version_4.rb
230
- - test/db/version_5.rb
231
- - test/db/version_6.rb
232
- - test/install_generator_test.rb
233
- - test/test_helper.rb
234
- - test/upgrade_generator_test.rb
235
217
  homepage: https://github.com/collectiveidea/audited
236
218
  licenses:
237
219
  - MIT
238
220
  metadata: {}
239
- post_install_message:
221
+ post_install_message:
240
222
  rdoc_options: []
241
223
  require_paths:
242
224
  - lib
@@ -251,8 +233,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
233
  - !ruby/object:Gem::Version
252
234
  version: '0'
253
235
  requirements: []
254
- rubygems_version: 3.1.6
255
- signing_key:
236
+ rubygems_version: 3.5.3
237
+ signing_key:
256
238
  specification_version: 4
257
239
  summary: Log all changes to your models
258
240
  test_files: []
@@ -1,115 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- pull_request:
5
- push:
6
- branches:
7
- - master
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
- strategy:
13
- fail-fast: false
14
- matrix:
15
- ruby: [2.3, 2.4, 2.5, 2.6, 2.7, 3.0]
16
- appraisal:
17
- - rails50
18
- - rails51
19
- - rails52
20
- - rails60
21
- - rails61
22
- - rails70
23
- db: [POSTGRES, MYSQL, SQLITE]
24
- exclude:
25
- # MySQL has issues on Ruby 2.3
26
- # https://github.com/ruby/setup-ruby/issues/150
27
- - ruby: 2.3
28
- db: MYSQL
29
-
30
- # Rails 5.0 supports Ruby 2.2-2.4
31
- - appraisal: rails50
32
- ruby: 2.5
33
- - appraisal: rails50
34
- ruby: 2.6
35
- - appraisal: rails50
36
- ruby: 2.7
37
- - appraisal: rails50
38
- ruby: 3.0
39
-
40
- # Rails 5.1 supports Ruby 2.2-2.5
41
- - appraisal: rails51
42
- ruby: 2.6
43
- - appraisal: rails51
44
- ruby: 2.7
45
- - appraisal: rails51
46
- ruby: 3.0
47
-
48
- # Rails 5.2 supports Ruby 2.2-2.5
49
- - appraisal: rails52
50
- ruby: 2.6
51
- - appraisal: rails52
52
- ruby: 2.7
53
- - appraisal: rails52
54
- ruby: 3.0
55
-
56
- # Rails 6.0 supports Ruby 2.5-2.7
57
- - appraisal: rails60
58
- ruby: 2.3
59
- - appraisal: rails60
60
- ruby: 2.4
61
- - appraisal: rails60
62
- ruby: 3.0
63
-
64
- # Rails 6.1 supports Ruby 2.5+
65
- - appraisal: rails61
66
- ruby: 2.3
67
- - appraisal: rails61
68
- ruby: 2.4
69
-
70
- # Rails 7 supports Ruby 2.7+
71
- - appraisal: rails70
72
- ruby: 2.3
73
- - appraisal: rails70
74
- ruby: 2.4
75
- - appraisal: rails70
76
- ruby: 2.5
77
- - appraisal: rails70
78
- ruby: 2.6
79
-
80
- services:
81
- postgres:
82
- image: postgres
83
- env:
84
- POSTGRES_USER: postgres
85
- POSTGRES_PASSWORD: postgres
86
- POSTGRES_DB: audited_test
87
- ports:
88
- - 5432:5432
89
- # needed because the postgres container does not provide a healthcheck
90
- options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
91
-
92
- env:
93
- DB_DATABASE: audited_test
94
- DB_USER: root
95
- DB_PASSWORD: 'root'
96
- DB_HOST: localhost
97
-
98
- steps:
99
- - name: Setup MySQL
100
- run: |
101
- sudo /etc/init.d/mysql start
102
- mysql -e 'CREATE DATABASE audited_test;' -uroot -proot
103
- mysql -e 'SHOW DATABASES;' -uroot -proot
104
- - uses: actions/checkout@v2
105
- - name: Copy Gemfile
106
- run: sed 's/\.\././' gemfiles/${{ matrix.appraisal }}.gemfile > Gemfile
107
- - name: Set up Ruby ${{ matrix.ruby }}
108
- uses: ruby/setup-ruby@v1
109
- with:
110
- ruby-version: ${{ matrix.ruby }}
111
- bundler-cache: true
112
- - name: Run tests
113
- env:
114
- DB: ${{ matrix.db }}
115
- run: bundle exec rake
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.iml
2
- *.ipr
3
- *.iws
4
- *.log
5
- *.swp
6
- .bundle
7
- .rakeTasks
8
- .ruby-gemset
9
- .ruby-version
10
- .rvmrc
11
- .yardoc
12
- doc/
13
- Gemfile.lock
14
- gemfiles/*.lock
15
- pkg
16
- tmp/*
17
- audited_test.sqlite3.db
data/.standard.yml DELETED
@@ -1,5 +0,0 @@
1
- ruby_version: 2.3
2
- ignore:
3
- - lib/generators/audited/templates/**/*
4
- - vendor/bundle/**/*
5
- - gemfiles/vendor/bundle/**/*
data/.yardopts DELETED
@@ -1,3 +0,0 @@
1
- --no-private
2
- --title acts_as_audited
3
- --exclude lib/generators
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 5.0.0"
6
- gem "mysql2", ">= 0.3.18", "< 0.6.0"
7
- gem "pg", ">= 0.18", "< 2.0"
8
- gem "sqlite3", "~> 1.3.6"
9
-
10
- gemspec name: "audited", path: "../"
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", "~> 5.1.4"
6
- gem "mysql2", ">= 0.3.18", "< 0.6.0"
7
- gem "pg", ">= 0.18", "< 2.0"
8
- gem "sqlite3", "~> 1.3.6"
9
-
10
- gemspec name: "audited", path: "../"
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", ">= 5.2.0", "< 5.3"
6
- gem "mysql2", ">= 0.4.4", "< 0.6.0"
7
- gem "pg", ">= 0.18", "< 2.0"
8
- gem "sqlite3", "~> 1.3.6"
9
-
10
- gemspec name: "audited", path: "../"
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", ">= 6.0.0", "< 6.1"
6
- gem "mysql2", ">= 0.4.4"
7
- gem "pg", ">= 0.18", "< 2.0"
8
- gem "sqlite3", "~> 1.4"
9
-
10
- gemspec name: "audited", path: "../"
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", ">= 6.1.0", "< 6.2"
6
- gem "mysql2", ">= 0.4.4"
7
- gem "pg", ">= 1.1", "< 2.0"
8
- gem "sqlite3", "~> 1.4"
9
-
10
- gemspec name: "audited", path: "../"
@@ -1,10 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "rails", ">= 7.0.0.alpha2", "< 7.1"
6
- gem "mysql2", ">= 0.4.4"
7
- gem "pg", ">= 1.1"
8
- gem "sqlite3", ">= 1.4"
9
-
10
- gemspec name: "audited", path: "../"