archival_record 2.0.2 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.gitlab-ci.yml +20 -0
- data/.rubocop.yml +7 -5
- data/.rubocop_todo.yml +1 -8
- data/Appraisals +8 -11
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +77 -43
- data/LICENSE +5 -2
- data/README.md +34 -10
- data/archival_record.gemspec +36 -31
- data/gemfiles/{rails_5.1.gemfile → rails_6.1.gemfile} +1 -2
- data/gemfiles/{rails_5.2.gemfile → rails_7.0.gemfile} +1 -2
- data/gemfiles/{rails_5.0.gemfile → rails_7.1.gemfile} +1 -2
- data/init.rb +2 -2
- data/lib/archival_record/version.rb +1 -1
- data/lib/archival_record.rb +5 -5
- data/lib/archival_record_core/archival_record.rb +29 -16
- data/lib/archival_record_core/archival_record_active_record_methods.rb +3 -2
- data/lib/archival_record_core/association_operation/base.rb +4 -2
- data/test/application_record_test.rb +1 -1
- data/test/archive_dependents_option_test.rb +54 -0
- data/test/basic_test.rb +5 -5
- data/test/deep_nesting_test.rb +1 -1
- data/test/fixtures/explicit_act_on_dependents_archival.rb +9 -0
- data/test/fixtures/ignorable_dependent.rb +10 -0
- data/test/fixtures/ignore_dependents_archival.rb +9 -0
- data/test/fixtures/nonignorable_dependent.rb +10 -0
- data/test/polymorphic_test.rb +2 -2
- data/test/relations_test.rb +1 -1
- data/test/schema.rb +22 -0
- data/test/scope_test.rb +6 -6
- data/test/test_helper.rb +12 -5
- data/test/transaction_test.rb +2 -1
- metadata +54 -53
- data/.travis.yml +0 -23
- /data/test/fixtures/{callback_archival_4.rb → callback_archival4.rb} +0 -0
- /data/test/fixtures/{callback_archival_5.rb → callback_archival5.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4b5a4d0030a23027b25b835935225c690a2d5badb2c80e1d37a145fd583e55c
|
4
|
+
data.tar.gz: 4a2e5a720bdab5cf97297cc66d9289f1beeced5d6c632d5c969816467a9928a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a989cbb3679373d79edec6e55f8393ba1c32ea8ee4cdea237b848a867208d436127cfb7465d50344c2fa45a05bb32917d2acd8282d010523c721fd3b7731285c
|
7
|
+
data.tar.gz: 4cefa4eac2f34e69c40029979760173db1c1d24852b3db8368e077fb60a78a592597d876f4ebc4875c4312f81bea55cab6b39cadce0fc05ecdee586951e678d4
|
data/.gitignore
CHANGED
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
image: "ruby:3.2"
|
2
|
+
|
3
|
+
before_script:
|
4
|
+
- apt-get update -qq && apt-get install -y -qq sqlite3 libsqlite3-dev nodejs
|
5
|
+
- ruby -v
|
6
|
+
- which ruby
|
7
|
+
- gem install bundler --no-document
|
8
|
+
- bundle install --jobs $(nproc) "${FLAGS[@]}"
|
9
|
+
- bundle install --gemfile=gemfiles/rails_6.0.gemfile
|
10
|
+
- bundle install --gemfile=gemfiles/rails_6.1.gemfile
|
11
|
+
- bundle install --gemfile=gemfiles/rails_7.0.gemfile
|
12
|
+
- bundle install --gemfile=gemfiles/rails_7.1.gemfile
|
13
|
+
|
14
|
+
rake:
|
15
|
+
script:
|
16
|
+
- bundle exec rake
|
17
|
+
|
18
|
+
appraisal:
|
19
|
+
script:
|
20
|
+
- bundle exec appraisal rake
|
data/.rubocop.yml
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
inherit_from: .rubocop_todo.yml
|
2
|
+
require:
|
3
|
+
- rubocop-rails
|
4
|
+
- rubocop-rake
|
2
5
|
|
3
6
|
AllCops:
|
4
7
|
Exclude:
|
5
8
|
- vendor/**/*
|
6
9
|
- gemfiles/**/*
|
7
|
-
TargetRubyVersion:
|
10
|
+
TargetRubyVersion: 3.0
|
8
11
|
NewCops: enable
|
9
12
|
|
10
13
|
|
@@ -17,9 +20,6 @@ Layout/EmptyLinesAroundClassBody:
|
|
17
20
|
Layout/EmptyLinesAroundModuleBody:
|
18
21
|
EnforcedStyle: empty_lines_except_namespace
|
19
22
|
|
20
|
-
Layout/LineLength:
|
21
|
-
Max: 140
|
22
|
-
|
23
23
|
Layout/SpaceInsideHashLiteralBraces:
|
24
24
|
EnforcedStyle: space
|
25
25
|
|
@@ -52,6 +52,7 @@ Style/Alias:
|
|
52
52
|
Style/AsciiComments:
|
53
53
|
Enabled: false
|
54
54
|
|
55
|
+
# TODO: class documentation
|
55
56
|
Style/Documentation:
|
56
57
|
Enabled: false
|
57
58
|
|
@@ -66,9 +67,10 @@ Style/FrozenStringLiteralComment:
|
|
66
67
|
|
67
68
|
Style/HashSyntax:
|
68
69
|
EnforcedStyle: ruby19
|
70
|
+
EnforcedShorthandSyntax: always
|
69
71
|
|
70
72
|
Style/RaiseArgs:
|
71
|
-
EnforcedStyle:
|
73
|
+
EnforcedStyle: exploded
|
72
74
|
|
73
75
|
Style/StringLiterals:
|
74
76
|
EnforcedStyle: double_quotes
|
data/.rubocop_todo.yml
CHANGED
@@ -1,14 +1,7 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2024-06-11 01:38:42 UTC using RuboCop version 1.64.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 7
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
Lint/SendWithMixinArgument:
|
12
|
-
Exclude:
|
13
|
-
- 'init.rb'
|
14
|
-
- 'lib/archival_record.rb'
|
data/Appraisals
CHANGED
@@ -1,18 +1,15 @@
|
|
1
|
-
appraise "rails-
|
2
|
-
gem "rails", "~>
|
3
|
-
gem "sqlite3", "~> 1.3.13"
|
1
|
+
appraise "rails-6.0" do
|
2
|
+
gem "rails", "~> 6.0.0"
|
4
3
|
end
|
5
4
|
|
6
|
-
appraise "rails-
|
7
|
-
gem "rails", "~>
|
8
|
-
gem "sqlite3", "~> 1.4.1"
|
5
|
+
appraise "rails-6.1" do
|
6
|
+
gem "rails", "~> 6.1.0"
|
9
7
|
end
|
10
8
|
|
11
|
-
appraise "rails-
|
12
|
-
gem "rails", "~>
|
13
|
-
gem "sqlite3", "~> 1.4.1"
|
9
|
+
appraise "rails-7.0" do
|
10
|
+
gem "rails", "~> 7.0.0"
|
14
11
|
end
|
15
12
|
|
16
|
-
appraise "rails-
|
17
|
-
gem "rails", "~>
|
13
|
+
appraise "rails-7.1" do
|
14
|
+
gem "rails", "~> 7.1.0"
|
18
15
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,16 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 3.0.0 - June 10, 2024
|
4
|
+
* **BREAKING CHANGE** Drop support for rails 5 - see `rails__4.x-and-5.x` branch for relevant code
|
5
|
+
* **BREAKING CHANGE** Drop support for Ruby 2.x
|
6
|
+
* **ADDED** new option for `archival_record` called `archive_dependents` which can control whether `dependent: :destroy` records are archived with their parent
|
7
|
+
* lots of cleanup of code, particularly the way `ApplicationRecord` gets patched
|
8
|
+
* remove travis-ci, use gitlab pipelines
|
9
|
+
|
10
|
+
## 2.0.2 - August 4, 2020
|
11
|
+
* fixing travis
|
12
|
+
* updating git hosting link
|
13
|
+
|
3
14
|
## 2.0.1 - August 3, 2020
|
4
15
|
* Add security policy
|
5
16
|
* Update depenedent gems: archival_record (:D oops) and rubocop, and dependencies
|
data/Gemfile.lock
CHANGED
@@ -1,60 +1,92 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
archival_record (
|
5
|
-
activerecord (>=
|
4
|
+
archival_record (3.0.0)
|
5
|
+
activerecord (>= 6.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (
|
11
|
-
activesupport (=
|
12
|
-
activerecord (
|
13
|
-
activemodel (=
|
14
|
-
activesupport (=
|
15
|
-
|
10
|
+
activemodel (7.1.3.4)
|
11
|
+
activesupport (= 7.1.3.4)
|
12
|
+
activerecord (7.1.3.4)
|
13
|
+
activemodel (= 7.1.3.4)
|
14
|
+
activesupport (= 7.1.3.4)
|
15
|
+
timeout (>= 0.4.0)
|
16
|
+
activesupport (7.1.3.4)
|
17
|
+
base64
|
18
|
+
bigdecimal
|
16
19
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
connection_pool (>= 2.2.5)
|
21
|
+
drb
|
22
|
+
i18n (>= 1.6, < 2)
|
23
|
+
minitest (>= 5.1)
|
24
|
+
mutex_m
|
25
|
+
tzinfo (~> 2.0)
|
26
|
+
appraisal (2.5.0)
|
22
27
|
bundler
|
23
28
|
rake
|
24
29
|
thor (>= 0.14.0)
|
25
|
-
ast (2.4.
|
26
|
-
|
27
|
-
|
28
|
-
|
30
|
+
ast (2.4.2)
|
31
|
+
base64 (0.2.0)
|
32
|
+
bigdecimal (3.1.8)
|
33
|
+
concurrent-ruby (1.3.3)
|
34
|
+
connection_pool (2.4.1)
|
35
|
+
database_cleaner (2.0.2)
|
36
|
+
database_cleaner-active_record (>= 2, < 3)
|
37
|
+
database_cleaner-active_record (2.1.0)
|
38
|
+
activerecord (>= 5.a)
|
39
|
+
database_cleaner-core (~> 2.0.0)
|
40
|
+
database_cleaner-core (2.0.1)
|
41
|
+
drb (2.2.1)
|
42
|
+
i18n (1.14.5)
|
29
43
|
concurrent-ruby (~> 1.0)
|
30
|
-
|
31
|
-
|
32
|
-
|
44
|
+
json (2.7.2)
|
45
|
+
language_server-protocol (3.17.0.3)
|
46
|
+
mini_portile2 (2.8.7)
|
47
|
+
minitest (5.23.1)
|
48
|
+
mutex_m (0.2.0)
|
49
|
+
parallel (1.25.1)
|
50
|
+
parser (3.3.2.0)
|
33
51
|
ast (~> 2.4.1)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
52
|
+
racc
|
53
|
+
racc (1.8.0)
|
54
|
+
rack (3.0.11)
|
55
|
+
rainbow (3.1.1)
|
56
|
+
rake (13.2.1)
|
57
|
+
regexp_parser (2.9.2)
|
58
|
+
rexml (3.2.9)
|
59
|
+
strscan
|
60
|
+
rr (3.1.0)
|
61
|
+
rubocop (1.64.1)
|
62
|
+
json (~> 2.3)
|
63
|
+
language_server-protocol (>= 3.17.0)
|
40
64
|
parallel (~> 1.10)
|
41
|
-
parser (>=
|
65
|
+
parser (>= 3.3.0.2)
|
42
66
|
rainbow (>= 2.2.2, < 4.0)
|
43
|
-
regexp_parser (>= 1.
|
44
|
-
rexml
|
45
|
-
rubocop-ast (>=
|
67
|
+
regexp_parser (>= 1.8, < 3.0)
|
68
|
+
rexml (>= 3.2.5, < 4.0)
|
69
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
46
70
|
ruby-progressbar (~> 1.7)
|
47
|
-
unicode-display_width (>=
|
48
|
-
rubocop-ast (
|
49
|
-
parser (>=
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
71
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
72
|
+
rubocop-ast (1.31.3)
|
73
|
+
parser (>= 3.3.1.0)
|
74
|
+
rubocop-rails (2.25.0)
|
75
|
+
activesupport (>= 4.2.0)
|
76
|
+
rack (>= 1.1)
|
77
|
+
rubocop (>= 1.33.0, < 2.0)
|
78
|
+
rubocop-ast (>= 1.31.1, < 2.0)
|
79
|
+
rubocop-rake (0.6.0)
|
80
|
+
rubocop (~> 1.0)
|
81
|
+
ruby-progressbar (1.13.0)
|
82
|
+
sqlite3 (1.7.3)
|
83
|
+
mini_portile2 (~> 2.8.0)
|
84
|
+
strscan (3.1.0)
|
85
|
+
thor (1.3.1)
|
86
|
+
timeout (0.4.1)
|
87
|
+
tzinfo (2.0.6)
|
88
|
+
concurrent-ruby (~> 1.0)
|
89
|
+
unicode-display_width (2.5.0)
|
58
90
|
|
59
91
|
PLATFORMS
|
60
92
|
ruby
|
@@ -66,7 +98,9 @@ DEPENDENCIES
|
|
66
98
|
rake
|
67
99
|
rr
|
68
100
|
rubocop
|
69
|
-
|
101
|
+
rubocop-rails
|
102
|
+
rubocop-rake
|
103
|
+
sqlite3 (< 2)
|
70
104
|
|
71
105
|
BUNDLED WITH
|
72
|
-
2.
|
106
|
+
2.5.11
|
data/LICENSE
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
Copyright for portions of project ArchivalRecord are held by Expected Behavior,
|
1
|
+
Copyright for portions of project ArchivalRecord are held by Expected Behavior,
|
2
|
+
2009-2020 as part of project ActsAsArchival.
|
3
|
+
|
4
|
+
All other copyright for project ArchivalRecord are held by Joel Meador, 2020.
|
2
5
|
|
3
6
|
-----
|
4
7
|
|
5
|
-
LICENSE for [ArchivalRecord](https://
|
8
|
+
LICENSE for [ArchivalRecord](https://gitlab.com/joelmeador/archival_record/)
|
6
9
|
|
7
10
|
Copyright (c) 2020 Joel Meador
|
8
11
|
|
data/README.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# ArchivalRecord
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/janxious/archival_record.svg?branch=main)](https://travis-ci.org/janxious/archival_record)
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/archival_record.svg)](https://badge.fury.io/rb/archival_record)
|
5
|
-
|
6
3
|
Atomically archive object trees in your ActiveRecord models.
|
7
4
|
|
8
5
|
`acts_as_paranoid` and similar plugins/gems work on a record-by-record basis and made it difficult to restore records atomically (or archive them, for that matter).
|
@@ -11,6 +8,8 @@ Because the `#archive!` and `#unarchive!` methods are in transactions, and every
|
|
11
8
|
|
12
9
|
Additionally, other plugins generally change how `destroy`/`delete` work. ArchivalRecord does not, and thus one can destroy records like normal.
|
13
10
|
|
11
|
+
_This is a fork of [ActsAsArchival](https://github.com/expectedbehavior/acts_as_archival/)._
|
12
|
+
|
14
13
|
## Maintenance
|
15
14
|
|
16
15
|
You might read the commit logs and think "This must be abandonware! This hasn't been updated in 2y!" But! This is a mature project that solves a specific problem in ActiveRecord. It tends to only be updated when a new major version of ActiveRecord comes out and hence the infrequent updates.
|
@@ -32,12 +31,12 @@ _If you're stuck on Rails 4.0x/3x/2x, check out the older tags/branches, which a
|
|
32
31
|
## Example
|
33
32
|
|
34
33
|
``` ruby
|
35
|
-
class Hole <
|
34
|
+
class Hole < ApplicationRecord
|
36
35
|
archival_record
|
37
36
|
has_many :rats, dependent: :destroy
|
38
37
|
end
|
39
38
|
|
40
|
-
class Rat <
|
39
|
+
class Rat < ApplicationRecord
|
41
40
|
archival_record
|
42
41
|
end
|
43
42
|
```
|
@@ -112,12 +111,13 @@ Hole.archival? # => true
|
|
112
111
|
|
113
112
|
### Options
|
114
113
|
|
114
|
+
#### `readonly_when_archived`
|
115
115
|
When defining an ArchivalRecord model, it is is possible to make it unmodifiable
|
116
116
|
when it is archived by passing `readonly_when_archived: true` to the
|
117
|
-
`archival_record` call in your model.
|
117
|
+
`archival_record` call in your model. The default value of this option is `false`.
|
118
118
|
|
119
119
|
``` ruby
|
120
|
-
class CantTouchThis <
|
120
|
+
class CantTouchThis < ApplicationRecord
|
121
121
|
archival_record readonly_when_archived: true
|
122
122
|
end
|
123
123
|
|
@@ -128,12 +128,32 @@ record.save # => false
|
|
128
128
|
record.errors.full_messages.first # => "Cannot modify an archived record."
|
129
129
|
```
|
130
130
|
|
131
|
+
#### `archive_dependents`
|
132
|
+
When defining an ArchivalRecord model, it is possible to deactivate archiving/unarchiving for `dependent: :destroy` relationships that are tied to ArchivalRecord models by passing `archive_dependents: false` to the `archival_record` call in your model. The default value of this option is `true`.
|
133
|
+
|
134
|
+
``` ruby
|
135
|
+
class WillArchive < ApplicationRecord
|
136
|
+
archival_record archive_dependents: false
|
137
|
+
has_many :wont_archives, dependent: :destroy
|
138
|
+
end
|
139
|
+
class WontArchive < ApplicationRecord
|
140
|
+
archival_record
|
141
|
+
end
|
142
|
+
|
143
|
+
record = WillArchive.create
|
144
|
+
wont_archive = record.wont_archives.create
|
145
|
+
record.archive!
|
146
|
+
|
147
|
+
record.archived? # => true
|
148
|
+
wont_archive.archived? # => false
|
149
|
+
```
|
150
|
+
|
131
151
|
### Callbacks
|
132
152
|
|
133
153
|
ArchivalRecord models have four additional callbacks to do any necessary cleanup or other processing before and after archiving and unarchiving, and can additionally halt the archive callback chain.
|
134
154
|
|
135
155
|
``` ruby
|
136
|
-
class Hole <
|
156
|
+
class Hole < ApplicationRecord
|
137
157
|
archival_record
|
138
158
|
|
139
159
|
# runs before #archive!
|
@@ -160,8 +180,12 @@ end
|
|
160
180
|
## Caveats
|
161
181
|
|
162
182
|
1. This will only work on associations that are dependent destroy. It
|
163
|
-
should be
|
164
|
-
1. If you would like to work on this, you will need to setup sqlite on your development machine. Alternately, you can
|
183
|
+
should be trivial to change that or make it optional.
|
184
|
+
1. If you would like to work on this, you will need to setup sqlite on your development machine. Alternately, you can deactivate specific dev dependencies in the gemspec and test_helper and ask for help.
|
185
|
+
|
186
|
+
## Compatibility with ActsAsArchival
|
187
|
+
|
188
|
+
For now, the `acts_as_archival` class method can be used, though it will print a deprecation warning. This is to allow users to transition without trouble to this library if they choose to.
|
165
189
|
|
166
190
|
## Testing
|
167
191
|
|
data/archival_record.gemspec
CHANGED
@@ -3,40 +3,44 @@ $LOAD_PATH.push File.expand_path("lib", __dir__)
|
|
3
3
|
require "archival_record/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
|
-
gem.name
|
7
|
-
gem.summary
|
8
|
-
gem.version
|
9
|
-
gem.authors
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
gem.email
|
25
|
-
gem.homepage
|
26
|
-
|
27
|
-
|
28
|
-
gem.
|
6
|
+
gem.name = "archival_record"
|
7
|
+
gem.summary = "Atomic archiving/unarchiving for ActiveRecord"
|
8
|
+
gem.version = ArchivalRecord::VERSION
|
9
|
+
gem.authors = ["Joel Meador",
|
10
|
+
"Michael Kuehl",
|
11
|
+
"Matthew Gordon",
|
12
|
+
"Vojtech Salbaba",
|
13
|
+
"David Jones",
|
14
|
+
"Dave Woodward",
|
15
|
+
"Miles Sterrett",
|
16
|
+
"James Hill",
|
17
|
+
"Maarten Claes",
|
18
|
+
"Anthony Panozzo",
|
19
|
+
"Aaron Milam",
|
20
|
+
"Anton Rieder",
|
21
|
+
"Josh Menden",
|
22
|
+
"Sergey Gnuskov",
|
23
|
+
"Elijah Miller"]
|
24
|
+
gem.email = ["joel.meador+archival_record@gmail.com"]
|
25
|
+
gem.homepage = "https://gitlab.com/joelmeador/archival_record/"
|
26
|
+
gem.licenses = ['MIT']
|
27
|
+
|
28
|
+
gem.files = `git ls-files`.split("\n")
|
29
29
|
gem.require_paths = ["lib"]
|
30
|
-
gem.required_ruby_version = ">=
|
30
|
+
gem.required_ruby_version = ">= 3.0"
|
31
31
|
|
32
|
-
gem.add_dependency
|
32
|
+
gem.add_dependency("activerecord", ">= 6.0")
|
33
33
|
|
34
|
-
|
35
|
-
gem.add_development_dependency
|
36
|
-
gem.add_development_dependency
|
37
|
-
gem.add_development_dependency
|
38
|
-
gem.add_development_dependency
|
39
|
-
gem.add_development_dependency
|
34
|
+
# rubocop:disable Gemspec/DevelopmentDependencies
|
35
|
+
gem.add_development_dependency("appraisal")
|
36
|
+
gem.add_development_dependency("database_cleaner")
|
37
|
+
gem.add_development_dependency("rake")
|
38
|
+
gem.add_development_dependency("rr")
|
39
|
+
gem.add_development_dependency("rubocop")
|
40
|
+
gem.add_development_dependency("rubocop-rails")
|
41
|
+
gem.add_development_dependency("rubocop-rake")
|
42
|
+
gem.add_development_dependency("sqlite3", "< 2")
|
43
|
+
# rubocop:enable Gemspec/DevelopmentDependencies
|
40
44
|
|
41
45
|
gem.description =
|
42
46
|
<<~DESCRIPTION
|
@@ -48,4 +52,5 @@ Gem::Specification.new do |gem|
|
|
48
52
|
|
49
53
|
Additionally, other plugins generally change how destroy/delete work. ArchivalRecord does not, and thus one can destroy records like normal.
|
50
54
|
DESCRIPTION
|
55
|
+
gem.metadata["rubygems_mfa_required"] = "true"
|
51
56
|
end
|
data/init.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
# Include hook code here
|
2
|
-
|
3
|
-
|
2
|
+
ActiveSupport.on_load(:active_record) { include ArchivalRecordCore::ArchivalRecordActiveRecordMethods }
|
3
|
+
ActiveSupport.on_load(:active_record) { include ArchivalRecordCore::ArchivalRecord }
|
data/lib/archival_record.rb
CHANGED
@@ -9,11 +9,11 @@ require "archival_record_core/archival_record_active_record_methods"
|
|
9
9
|
|
10
10
|
# This assumes a fully Rails 5 compatible set of ActiveRecord models
|
11
11
|
if defined?(ApplicationRecord)
|
12
|
-
ApplicationRecord.
|
13
|
-
ApplicationRecord.
|
12
|
+
ApplicationRecord.include ArchivalRecordCore::ArchivalRecord
|
13
|
+
ApplicationRecord.include ArchivalRecordCore::ArchivalRecordActiveRecordMethods
|
14
14
|
else
|
15
|
-
|
16
|
-
|
15
|
+
ActiveSupport.on_load(:active_record) { include ArchivalRecordCore::ArchivalRecord }
|
16
|
+
ActiveSupport.on_load(:active_record) { include ArchivalRecordCore::ArchivalRecordActiveRecordMethods }
|
17
17
|
end
|
18
18
|
|
19
|
-
ActiveRecord::Relation.
|
19
|
+
ActiveRecord::Relation.include ArchivalRecordCore::ArchivalRecordActiveRecordMethods::ARRelationMethods
|
@@ -3,17 +3,18 @@ module ArchivalRecordCore
|
|
3
3
|
|
4
4
|
require "digest/md5"
|
5
5
|
|
6
|
-
unless defined?(MissingArchivalColumnError) == "constant" && MissingArchivalColumnError.
|
6
|
+
unless defined?(MissingArchivalColumnError) == "constant" && MissingArchivalColumnError.instance_of?(Class)
|
7
7
|
MissingArchivalColumnError = Class.new(ActiveRecord::ActiveRecordError)
|
8
8
|
end
|
9
|
-
unless defined?(CouldNotArchiveError) == "constant" && CouldNotArchiveError.
|
9
|
+
unless defined?(CouldNotArchiveError) == "constant" && CouldNotArchiveError.instance_of?(Class)
|
10
10
|
CouldNotArchiveError = Class.new(ActiveRecord::ActiveRecordError)
|
11
11
|
end
|
12
|
-
unless defined?(CouldNotUnarchiveError) == "constant" && CouldNotUnarchiveError.
|
12
|
+
unless defined?(CouldNotUnarchiveError) == "constant" && CouldNotUnarchiveError.instance_of?(Class)
|
13
13
|
CouldNotUnarchiveError = Class.new(ActiveRecord::ActiveRecordError)
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.included(base)
|
17
|
+
super
|
17
18
|
base.extend ActMethods
|
18
19
|
end
|
19
20
|
|
@@ -24,6 +25,8 @@ module ArchivalRecordCore
|
|
24
25
|
|
25
26
|
include InstanceMethods
|
26
27
|
|
28
|
+
setup_options(options)
|
29
|
+
|
27
30
|
setup_validations(options)
|
28
31
|
|
29
32
|
setup_scopes
|
@@ -33,10 +36,17 @@ module ArchivalRecordCore
|
|
33
36
|
|
34
37
|
# Deprecated: Please use `archival_record` instead
|
35
38
|
def acts_as_archival(options = {})
|
36
|
-
ActiveSupport::Deprecation.
|
39
|
+
ActiveSupport::Deprecation.new("3.0", "ArchivalRecord")
|
37
40
|
archival_record(options)
|
38
41
|
end
|
39
42
|
|
43
|
+
private def setup_options(options)
|
44
|
+
default_options = { readonly_when_archived: false, archive_dependents: true }
|
45
|
+
options.reverse_merge!(default_options)
|
46
|
+
|
47
|
+
define_method(:archive_dependents?) { options[:archive_dependents] }
|
48
|
+
end
|
49
|
+
|
40
50
|
private def setup_validations(options)
|
41
51
|
before_validation :raise_if_not_archival
|
42
52
|
validate :readonly_when_archived if options[:readonly_when_archived]
|
@@ -73,6 +83,12 @@ module ArchivalRecordCore
|
|
73
83
|
private def define_callback_dsl_method(callbackable_type, action)
|
74
84
|
# rubocop:disable Security/Eval
|
75
85
|
eval <<-END_CALLBACKS, binding, __FILE__, __LINE__ + 1
|
86
|
+
# unless defined?(before_archive)
|
87
|
+
# def before_archive(*args, &blk)
|
88
|
+
# set_callback(:archive, :before, *args, &blk)
|
89
|
+
# end
|
90
|
+
# end
|
91
|
+
|
76
92
|
unless defined?(#{callbackable_type}_#{action})
|
77
93
|
def #{callbackable_type}_#{action}(*args, &blk)
|
78
94
|
set_callback(:#{action}, :#{callbackable_type}, *args, &blk)
|
@@ -99,7 +115,8 @@ module ArchivalRecordCore
|
|
99
115
|
missing_columns << "archived_at" unless respond_to?(:archived_at)
|
100
116
|
return if missing_columns.blank?
|
101
117
|
|
102
|
-
raise
|
118
|
+
raise(MissingArchivalColumnError,
|
119
|
+
"Add '#{missing_columns.join "', '"}' column(s) to '#{self.class.name}' to make it archival")
|
103
120
|
end
|
104
121
|
|
105
122
|
def archived?
|
@@ -138,24 +155,20 @@ module ArchivalRecordCore
|
|
138
155
|
AssociationOperation::Unarchive.new(self, head_archive_number).execute
|
139
156
|
end
|
140
157
|
|
141
|
-
private def execute_archival_action(action)
|
158
|
+
private def execute_archival_action(action, &block)
|
159
|
+
execution_result = false
|
142
160
|
self.class.transaction do
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
return !!success
|
147
|
-
rescue => e
|
148
|
-
handle_archival_action_exception(e)
|
149
|
-
end
|
150
|
-
# rubocop: enable Style/RescueStandardError
|
161
|
+
execution_result = !!run_callbacks(action, &block)
|
162
|
+
rescue StandardError => e
|
163
|
+
handle_archival_action_exception(e)
|
151
164
|
end
|
152
|
-
|
165
|
+
execution_result
|
153
166
|
end
|
154
167
|
|
155
168
|
private def handle_archival_action_exception(exception)
|
156
169
|
ActiveRecord::Base.logger.try(:debug, exception.message)
|
157
170
|
ActiveRecord::Base.logger.try(:debug, exception.backtrace)
|
158
|
-
raise
|
171
|
+
raise(ActiveRecord::Rollback)
|
159
172
|
end
|
160
173
|
|
161
174
|
end
|
@@ -2,6 +2,7 @@ module ArchivalRecordCore
|
|
2
2
|
module ArchivalRecordActiveRecordMethods
|
3
3
|
|
4
4
|
def self.included(base)
|
5
|
+
super
|
5
6
|
base.extend ARClassMethods
|
6
7
|
base.send :include, ARInstanceMethods
|
7
8
|
end
|
@@ -26,7 +27,7 @@ module ArchivalRecordCore
|
|
26
27
|
|
27
28
|
def archive_all!
|
28
29
|
error_message = "The #{klass} must implement 'act_on_archivals' in order to call `archive_all!`"
|
29
|
-
raise
|
30
|
+
raise(NotImplementedError, error_message) unless archival?
|
30
31
|
|
31
32
|
head_archive_number = Digest::MD5.hexdigest("#{klass}#{Time.now.utc.to_i}")
|
32
33
|
each { |record| record.archive!(head_archive_number) }.tap { reset }
|
@@ -34,7 +35,7 @@ module ArchivalRecordCore
|
|
34
35
|
|
35
36
|
def unarchive_all!
|
36
37
|
error_message = "The #{klass} must implement 'act_on_archivals' in order to call `unarchive_all!`"
|
37
|
-
raise
|
38
|
+
raise(NotImplementedError, error_message) unless archival?
|
38
39
|
|
39
40
|
each(&:unarchive!).tap { reset }
|
40
41
|
end
|
@@ -11,8 +11,10 @@ module ArchivalRecordCore
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def execute
|
14
|
+
return unless model.archive_dependents?
|
15
|
+
|
14
16
|
each_archivable_association do |association|
|
15
|
-
act_on_association(association) if association_conditions_met?
|
17
|
+
act_on_association(association) if association_conditions_met?(association)
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
@@ -45,7 +47,7 @@ module ArchivalRecordCore
|
|
45
47
|
end
|
46
48
|
|
47
49
|
def act_on_archivals(_scope)
|
48
|
-
raise
|
50
|
+
raise(NotImplementedError, "The #{self.class} hasn't implemented 'act_on_archivals(scope)'")
|
49
51
|
end
|
50
52
|
|
51
53
|
end
|
@@ -11,7 +11,7 @@ if defined?(ApplicationRecord)
|
|
11
11
|
end
|
12
12
|
|
13
13
|
test "unarchive unarchives archival records" do
|
14
|
-
archival = ApplicationRecordRow.create!(archived_at: Time.now, archive_number: 1)
|
14
|
+
archival = ApplicationRecordRow.create!(archived_at: Time.now.utc, archive_number: 1)
|
15
15
|
archival.unarchive!
|
16
16
|
assert_not archival.reload.archived?
|
17
17
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require_relative "test_helper"
|
2
|
+
|
3
|
+
class ArchiveDependentsOptionTest < ActiveSupport::TestCase
|
4
|
+
|
5
|
+
test "archive_dependents option will leave dependent archival records alone when parent is archived" do
|
6
|
+
archival = IgnoreDependentsArchival.create!
|
7
|
+
child = archival.ignorable_dependents.create!
|
8
|
+
|
9
|
+
assert archival.archival?
|
10
|
+
assert child.archival?
|
11
|
+
|
12
|
+
archival.archive!
|
13
|
+
|
14
|
+
assert archival.reload.archived?
|
15
|
+
assert_not child.reload.archived?
|
16
|
+
end
|
17
|
+
|
18
|
+
test "archive_dependents option will leave dependent archival records alone when parent is unarchived" do
|
19
|
+
archival = IgnoreDependentsArchival.create!
|
20
|
+
child = archival.ignorable_dependents.create!
|
21
|
+
|
22
|
+
assert archival.archival?
|
23
|
+
assert child.archival?
|
24
|
+
|
25
|
+
# This is simulating an unlikely scenario where the option has been added after records have been
|
26
|
+
# archived as a set but we want to unarchive after adding the option.
|
27
|
+
archival.archive!
|
28
|
+
child.update!(archived_at: archival.archived_at, archive_number: archival.archive_number)
|
29
|
+
|
30
|
+
archival.unarchive!
|
31
|
+
|
32
|
+
assert_not archival.reload.archived?
|
33
|
+
assert child.reload.archived?
|
34
|
+
end
|
35
|
+
|
36
|
+
test "archive_dependents option will work normally if set to true" do
|
37
|
+
archival = ExplicitActOnDependentsArchival.create!
|
38
|
+
child = archival.nonignorable_dependents.create!
|
39
|
+
|
40
|
+
assert archival.archival?
|
41
|
+
assert child.archival?
|
42
|
+
|
43
|
+
archival.archive!
|
44
|
+
|
45
|
+
assert archival.reload.archived?
|
46
|
+
assert child.reload.archived?
|
47
|
+
|
48
|
+
archival.unarchive!
|
49
|
+
|
50
|
+
assert_not archival.reload.archived?
|
51
|
+
assert_not child.reload.archived?
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/test/basic_test.rb
CHANGED
@@ -9,7 +9,7 @@ class BasicTest < ActiveSupport::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
test "unarchive unarchives archival records" do
|
12
|
-
archival = Archival.create!(archived_at: Time.now, archive_number: 1)
|
12
|
+
archival = Archival.create!(archived_at: Time.now.utc, archive_number: 1)
|
13
13
|
archival.unarchive!
|
14
14
|
assert_equal false, archival.reload.archived?
|
15
15
|
end
|
@@ -26,23 +26,23 @@ class BasicTest < ActiveSupport::TestCase
|
|
26
26
|
end
|
27
27
|
|
28
28
|
test "unarchive returns true on success" do
|
29
|
-
normal = Archival.create!(archived_at: Time.now, archive_number: "1")
|
29
|
+
normal = Archival.create!(archived_at: Time.now.utc, archive_number: "1")
|
30
30
|
assert_equal true, normal.unarchive!
|
31
31
|
end
|
32
32
|
|
33
33
|
test "unarchive returns false on failure" do
|
34
|
-
readonly = Archival.create!(archived_at: Time.now, archive_number: "1")
|
34
|
+
readonly = Archival.create!(archived_at: Time.now.utc, archive_number: "1")
|
35
35
|
readonly.readonly!
|
36
36
|
assert_equal false, readonly.unarchive!
|
37
37
|
end
|
38
38
|
|
39
39
|
test "archive sets archived_at to the time of archiving" do
|
40
40
|
archival = Archival.create!
|
41
|
-
before = DateTime.now
|
41
|
+
before = DateTime.now.utc
|
42
42
|
sleep(0.001)
|
43
43
|
archival.archive!
|
44
44
|
sleep(0.001)
|
45
|
-
after = DateTime.now
|
45
|
+
after = DateTime.now.utc
|
46
46
|
assert before < archival.archived_at.to_datetime
|
47
47
|
assert after > archival.archived_at.to_datetime
|
48
48
|
end
|
data/test/deep_nesting_test.rb
CHANGED
@@ -18,7 +18,7 @@ class DeepNestingTest < ActiveSupport::TestCase
|
|
18
18
|
|
19
19
|
test "unarchiving deeply nested items doesn't blow up" do
|
20
20
|
archival_attributes = {
|
21
|
-
archived_at: Time.now,
|
21
|
+
archived_at: Time.now.utc,
|
22
22
|
archive_number: "test"
|
23
23
|
}
|
24
24
|
archival = Archival.create!(archival_attributes)
|
data/test/polymorphic_test.rb
CHANGED
@@ -23,7 +23,7 @@ class PolymorphicTest < ActiveSupport::TestCase
|
|
23
23
|
test "unarchive item with polymorphic association" do
|
24
24
|
archive_attributes = {
|
25
25
|
archive_number: "test",
|
26
|
-
archived_at: Time.now
|
26
|
+
archived_at: Time.now.utc
|
27
27
|
}
|
28
28
|
archival = Archival.create!(archive_attributes)
|
29
29
|
poly = archival.polys.create!(archive_attributes)
|
@@ -36,7 +36,7 @@ class PolymorphicTest < ActiveSupport::TestCase
|
|
36
36
|
test "does not unarchive polymorphic association of different item with same id" do
|
37
37
|
archive_attributes = {
|
38
38
|
archive_number: "test",
|
39
|
-
archived_at: Time.now
|
39
|
+
archived_at: Time.now.utc
|
40
40
|
}
|
41
41
|
|
42
42
|
archival = Archival.create!(archive_attributes)
|
data/test/relations_test.rb
CHANGED
@@ -34,7 +34,7 @@ class RelationsTest < ActiveSupport::TestCase
|
|
34
34
|
assert parents.first.archivals.last.archived?
|
35
35
|
end
|
36
36
|
|
37
|
-
test "unarchive_all! unarchives all records in an AR
|
37
|
+
test "unarchive_all! unarchives all records in an AR association" do
|
38
38
|
3.times { Archival.create! }
|
39
39
|
|
40
40
|
archivals = Archival.all
|
data/test/schema.rb
CHANGED
@@ -93,4 +93,26 @@ ActiveRecord::Schema.define(version: 1) do
|
|
93
93
|
t.column :archive_number, :string
|
94
94
|
t.column :archived_at, :datetime
|
95
95
|
end
|
96
|
+
|
97
|
+
create_table :ignore_dependents_archivals, force: true do |t|
|
98
|
+
t.column :archive_number, :string
|
99
|
+
t.column :archived_at, :datetime
|
100
|
+
end
|
101
|
+
|
102
|
+
create_table :ignorable_dependents, force: true do |t|
|
103
|
+
t.column :ignore_dependents_archival_id, :integer
|
104
|
+
t.column :archive_number, :string
|
105
|
+
t.column :archived_at, :datetime
|
106
|
+
end
|
107
|
+
|
108
|
+
create_table :explicit_act_on_dependents_archivals, force: true do |t|
|
109
|
+
t.column :archive_number, :string
|
110
|
+
t.column :archived_at, :datetime
|
111
|
+
end
|
112
|
+
|
113
|
+
create_table :nonignorable_dependents, force: true do |t|
|
114
|
+
t.column :explicit_act_on_dependents_archival_id, :integer
|
115
|
+
t.column :archive_number, :string
|
116
|
+
t.column :archived_at, :datetime
|
117
|
+
end
|
96
118
|
end
|
data/test/scope_test.rb
CHANGED
@@ -52,14 +52,14 @@ class ScopeTest < ActiveSupport::TestCase
|
|
52
52
|
test "table_name is set to 'legacy'" do
|
53
53
|
archived_sql =
|
54
54
|
if ActiveRecord.version >= Gem::Version.new("5.2.0")
|
55
|
-
|
56
|
-
|
55
|
+
'SELECT "legacy".* FROM "legacy" ' \
|
56
|
+
'WHERE "legacy"."archived_at" IS NOT NULL AND "legacy"."archive_number" IS NOT NULL'
|
57
57
|
else
|
58
|
-
|
59
|
-
|
58
|
+
'SELECT "legacy".* FROM "legacy" ' \
|
59
|
+
'WHERE ("legacy"."archived_at" IS NOT NULL) AND ("legacy"."archive_number" IS NOT NULL)'
|
60
60
|
end
|
61
|
-
unarchived_sql =
|
62
|
-
|
61
|
+
unarchived_sql = 'SELECT "legacy".* FROM "legacy" ' \
|
62
|
+
'WHERE "legacy"."archived_at" IS NULL AND "legacy"."archive_number" IS NULL'
|
63
63
|
assert_equal archived_sql, ArchivalTableName.archived.to_sql
|
64
64
|
assert_equal unarchived_sql, ArchivalTableName.unarchived.to_sql
|
65
65
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__)
|
1
|
+
$LOAD_PATH.unshift("#{File.dirname(__FILE__)}/../lib")
|
2
2
|
|
3
3
|
require "bundler/setup"
|
4
4
|
require "minitest/autorun"
|
@@ -20,7 +20,7 @@ end
|
|
20
20
|
|
21
21
|
def setup_logging
|
22
22
|
require "logger"
|
23
|
-
logfile = File.dirname(__FILE__)
|
23
|
+
logfile = "#{File.dirname(__FILE__)}/debug.log"
|
24
24
|
ActiveRecord::Base.logger = Logger.new(logfile)
|
25
25
|
end
|
26
26
|
|
@@ -40,8 +40,11 @@ def sqlite_config
|
|
40
40
|
}
|
41
41
|
end
|
42
42
|
|
43
|
+
def schema_file
|
44
|
+
"#{File.dirname(__FILE__)}/schema.rb"
|
45
|
+
end
|
46
|
+
|
43
47
|
def create_test_tables
|
44
|
-
schema_file = File.dirname(__FILE__) + "/schema.rb"
|
45
48
|
puts "** Loading schema for SQLite"
|
46
49
|
ActiveRecord::Base.establish_connection(sqlite_config)
|
47
50
|
load(schema_file) if File.exist?(schema_file)
|
@@ -61,16 +64,20 @@ BASE_FIXTURE_CLASSES = %I[
|
|
61
64
|
poly
|
62
65
|
readonly_when_archived
|
63
66
|
deprecated_warning_archival
|
67
|
+
ignore_dependents_archival
|
68
|
+
ignorable_dependent
|
69
|
+
explicit_act_on_dependents_archival
|
70
|
+
nonignorable_dependent
|
64
71
|
].freeze
|
65
72
|
|
66
73
|
RAILS_4_FIXTURE_CLASSES = %I[
|
67
|
-
|
74
|
+
callback_archival4
|
68
75
|
].freeze
|
69
76
|
|
70
77
|
RAILS_5_FIXTURE_CLASSES = %I[
|
71
78
|
application_record
|
72
79
|
application_record_row
|
73
|
-
|
80
|
+
callback_archival5
|
74
81
|
].freeze
|
75
82
|
|
76
83
|
def require_test_classes
|
data/test/transaction_test.rb
CHANGED
@@ -11,7 +11,8 @@ class TransactionTest < ActiveSupport::TestCase
|
|
11
11
|
end
|
12
12
|
archival.archive!
|
13
13
|
|
14
|
-
|
14
|
+
failure_reason = "If this failed, you might be trying to test on a system that doesn't support nested transactions"
|
15
|
+
assert_not archival.archived?, failure_reason
|
15
16
|
assert_not exploder.reload.archived?
|
16
17
|
end
|
17
18
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: archival_record
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel Meador
|
@@ -19,10 +19,10 @@ authors:
|
|
19
19
|
- Josh Menden
|
20
20
|
- Sergey Gnuskov
|
21
21
|
- Elijah Miller
|
22
|
-
autorequire:
|
22
|
+
autorequire:
|
23
23
|
bindir: bin
|
24
24
|
cert_chain: []
|
25
|
-
date:
|
25
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
26
26
|
dependencies:
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '6.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '6.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: appraisal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,7 +109,21 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rubocop-rails
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop-rake
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
114
128
|
requirements:
|
115
129
|
- - ">="
|
@@ -122,6 +136,20 @@ dependencies:
|
|
122
136
|
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: sqlite3
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "<"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '2'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "<"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '2'
|
125
153
|
description: |
|
126
154
|
*Atomic archiving/unarchiving for ActiveRecord*
|
127
155
|
|
@@ -137,9 +165,9 @@ extensions: []
|
|
137
165
|
extra_rdoc_files: []
|
138
166
|
files:
|
139
167
|
- ".gitignore"
|
168
|
+
- ".gitlab-ci.yml"
|
140
169
|
- ".rubocop.yml"
|
141
170
|
- ".rubocop_todo.yml"
|
142
|
-
- ".travis.yml"
|
143
171
|
- Appraisals
|
144
172
|
- CHANGELOG.md
|
145
173
|
- Gemfile
|
@@ -149,10 +177,10 @@ files:
|
|
149
177
|
- Rakefile
|
150
178
|
- SECURITY.md
|
151
179
|
- archival_record.gemspec
|
152
|
-
- gemfiles/rails_5.0.gemfile
|
153
|
-
- gemfiles/rails_5.1.gemfile
|
154
|
-
- gemfiles/rails_5.2.gemfile
|
155
180
|
- gemfiles/rails_6.0.gemfile
|
181
|
+
- gemfiles/rails_6.1.gemfile
|
182
|
+
- gemfiles/rails_7.0.gemfile
|
183
|
+
- gemfiles/rails_7.1.gemfile
|
156
184
|
- init.rb
|
157
185
|
- lib/archival_record.rb
|
158
186
|
- lib/archival_record/version.rb
|
@@ -164,6 +192,7 @@ files:
|
|
164
192
|
- script/setup
|
165
193
|
- test/ambiguous_table_test.rb
|
166
194
|
- test/application_record_test.rb
|
195
|
+
- test/archive_dependents_option_test.rb
|
167
196
|
- test/associations_test.rb
|
168
197
|
- test/basic_test.rb
|
169
198
|
- test/callbacks_test.rb
|
@@ -177,13 +206,17 @@ files:
|
|
177
206
|
- test/fixtures/archival_grandkid.rb
|
178
207
|
- test/fixtures/archival_kid.rb
|
179
208
|
- test/fixtures/archival_table_name.rb
|
180
|
-
- test/fixtures/
|
181
|
-
- test/fixtures/
|
209
|
+
- test/fixtures/callback_archival4.rb
|
210
|
+
- test/fixtures/callback_archival5.rb
|
182
211
|
- test/fixtures/deprecated_warning_archival.rb
|
212
|
+
- test/fixtures/explicit_act_on_dependents_archival.rb
|
183
213
|
- test/fixtures/exploder.rb
|
214
|
+
- test/fixtures/ignorable_dependent.rb
|
215
|
+
- test/fixtures/ignore_dependents_archival.rb
|
184
216
|
- test/fixtures/independent_archival.rb
|
185
217
|
- test/fixtures/missing_archive_number.rb
|
186
218
|
- test/fixtures/missing_archived_at.rb
|
219
|
+
- test/fixtures/nonignorable_dependent.rb
|
187
220
|
- test/fixtures/plain.rb
|
188
221
|
- test/fixtures/poly.rb
|
189
222
|
- test/fixtures/readonly_when_archived.rb
|
@@ -197,9 +230,11 @@ files:
|
|
197
230
|
- test/through_association_test.rb
|
198
231
|
- test/transaction_test.rb
|
199
232
|
homepage: https://gitlab.com/joelmeador/archival_record/
|
200
|
-
licenses:
|
201
|
-
|
202
|
-
|
233
|
+
licenses:
|
234
|
+
- MIT
|
235
|
+
metadata:
|
236
|
+
rubygems_mfa_required: 'true'
|
237
|
+
post_install_message:
|
203
238
|
rdoc_options: []
|
204
239
|
require_paths:
|
205
240
|
- lib
|
@@ -207,49 +242,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
242
|
requirements:
|
208
243
|
- - ">="
|
209
244
|
- !ruby/object:Gem::Version
|
210
|
-
version: '
|
245
|
+
version: '3.0'
|
211
246
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
247
|
requirements:
|
213
248
|
- - ">="
|
214
249
|
- !ruby/object:Gem::Version
|
215
250
|
version: '0'
|
216
251
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
218
|
-
signing_key:
|
252
|
+
rubygems_version: 3.4.22
|
253
|
+
signing_key:
|
219
254
|
specification_version: 4
|
220
255
|
summary: Atomic archiving/unarchiving for ActiveRecord
|
221
|
-
test_files:
|
222
|
-
- test/ambiguous_table_test.rb
|
223
|
-
- test/application_record_test.rb
|
224
|
-
- test/associations_test.rb
|
225
|
-
- test/basic_test.rb
|
226
|
-
- test/callbacks_test.rb
|
227
|
-
- test/column_test.rb
|
228
|
-
- test/deep_nesting_test.rb
|
229
|
-
- test/deprecated_warning_archival_test.rb
|
230
|
-
- test/fixtures/another_polys_holder.rb
|
231
|
-
- test/fixtures/application_record.rb
|
232
|
-
- test/fixtures/application_record_row.rb
|
233
|
-
- test/fixtures/archival.rb
|
234
|
-
- test/fixtures/archival_grandkid.rb
|
235
|
-
- test/fixtures/archival_kid.rb
|
236
|
-
- test/fixtures/archival_table_name.rb
|
237
|
-
- test/fixtures/callback_archival_4.rb
|
238
|
-
- test/fixtures/callback_archival_5.rb
|
239
|
-
- test/fixtures/deprecated_warning_archival.rb
|
240
|
-
- test/fixtures/exploder.rb
|
241
|
-
- test/fixtures/independent_archival.rb
|
242
|
-
- test/fixtures/missing_archive_number.rb
|
243
|
-
- test/fixtures/missing_archived_at.rb
|
244
|
-
- test/fixtures/plain.rb
|
245
|
-
- test/fixtures/poly.rb
|
246
|
-
- test/fixtures/readonly_when_archived.rb
|
247
|
-
- test/polymorphic_test.rb
|
248
|
-
- test/readonly_when_archived_test.rb
|
249
|
-
- test/relations_test.rb
|
250
|
-
- test/responds_test.rb
|
251
|
-
- test/schema.rb
|
252
|
-
- test/scope_test.rb
|
253
|
-
- test/test_helper.rb
|
254
|
-
- test/through_association_test.rb
|
255
|
-
- test/transaction_test.rb
|
256
|
+
test_files: []
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
|
4
|
-
rvm:
|
5
|
-
- 2.4
|
6
|
-
- 2.5
|
7
|
-
- 2.6
|
8
|
-
- 2.7
|
9
|
-
|
10
|
-
gemfile:
|
11
|
-
- gemfiles/rails_5.0.gemfile
|
12
|
-
- gemfiles/rails_5.1.gemfile
|
13
|
-
- gemfiles/rails_5.2.gemfile
|
14
|
-
- gemfiles/rails_6.0.gemfile
|
15
|
-
|
16
|
-
before_install:
|
17
|
-
- gem update --system
|
18
|
-
|
19
|
-
matrix:
|
20
|
-
fast_finish: true
|
21
|
-
exclude:
|
22
|
-
- gemfile: gemfiles/rails_6.0.gemfile
|
23
|
-
rvm: 2.4
|
File without changes
|
File without changes
|