state_machines-audit_trail 2.1.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/state_machines/audit_trail/version.rb +1 -1
- data/spec/helpers/active_record.rb +32 -28
- metadata +33 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9763326e11e39a7a8876a9fa2235cb93a5bb9d8abc8dbdce4cee04fa7d47437e
|
4
|
+
data.tar.gz: 78a8f897991391f2e590858315c9970aa2e3d8de1c5a5a6af3772911611cf2a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95b780a557c38b332fe4050773474cca8534b4d37b4e89bba7066a7296d3a224f269617eba253a96412d34617dc99b9d9a2f0089b38a95638ee61b8e74d6dfd7
|
7
|
+
data.tar.gz: 692efbe5208fb4437d4c18c290b2c7082551b967f799cc7384f1771280d576bd4ac1853e86508cc845484660cd0dc482b7a2b3c2fbd2a87bb1a6a337b19e8c7d
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+

|
2
2
|
|
3
3
|
# state_machines-audit_trail
|
4
4
|
Log transitions on a [state_machines gem](https://github.com/state-machines/state_machines) to support auditing and business process analytics.
|
@@ -11,7 +11,7 @@ for any state machine. Having an audit trail gives you a complete history of the
|
|
11
11
|
to investigate incidents or perform analytics, like: _"How long does it take on average to go from state a to state b?"_,
|
12
12
|
or _"What percentage of cases goes from state a to b via state c?"_
|
13
13
|
|
14
|
-
For more information read [Why developers should be force-fed state machines](https://engineering.shopify.com/
|
14
|
+
For more information read [Why developers should be force-fed state machines](https://engineering.shopify.com/17488160-why-developers-should-be-force-fed-state-machines).
|
15
15
|
|
16
16
|
## ORM support
|
17
17
|
|
@@ -3,39 +3,43 @@ require 'active_record'
|
|
3
3
|
### Setup test database
|
4
4
|
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ':memory:')
|
5
5
|
|
6
|
-
class
|
7
|
-
|
6
|
+
class ApplicationRecord < ActiveRecord::Base
|
7
|
+
self.abstract_class = true
|
8
8
|
end
|
9
9
|
|
10
|
-
class
|
11
|
-
belongs_to :
|
10
|
+
class ARModelStateTransition < ApplicationRecord
|
11
|
+
belongs_to :ar_model, class_name: 'ARModel'
|
12
12
|
end
|
13
13
|
|
14
|
-
class
|
15
|
-
belongs_to :
|
14
|
+
class ARModelWithNamespaceFooStateTransition < ApplicationRecord
|
15
|
+
belongs_to :ar_model_with_namespace, class_name: 'ARModelWithNamespace'
|
16
16
|
end
|
17
17
|
|
18
|
-
class
|
19
|
-
belongs_to :
|
18
|
+
class ARModelNoInitialStateTransition < ApplicationRecord
|
19
|
+
belongs_to :ar_model_no_initial, class_name: 'ARModelNoInitial'
|
20
20
|
end
|
21
21
|
|
22
|
-
class
|
23
|
-
belongs_to :
|
22
|
+
class ARModelWithContextStateTransition < ApplicationRecord
|
23
|
+
belongs_to :ar_model_with_context, class_name: 'ARModelWithContext'
|
24
24
|
end
|
25
25
|
|
26
|
-
class
|
27
|
-
belongs_to :
|
26
|
+
class ARModelWithMultipleContextStateTransition < ApplicationRecord
|
27
|
+
belongs_to :ar_model_with_multiple_context, class_name: 'ARModelWithMultipleContext'
|
28
28
|
end
|
29
29
|
|
30
|
-
class
|
31
|
-
belongs_to :ar_model_with_multiple_state_machines
|
30
|
+
class ARModelWithMultipleStateMachinesFirstTransition < ApplicationRecord
|
31
|
+
belongs_to :ar_model_with_multiple_state_machines, class_name: 'ARModelWithMultipleStateMachines'
|
32
32
|
end
|
33
33
|
|
34
|
-
class
|
35
|
-
belongs_to :ar_model_with_multiple_state_machines
|
34
|
+
class ARModelWithMultipleStateMachinesSecondTransition < ApplicationRecord
|
35
|
+
belongs_to :ar_model_with_multiple_state_machines, class_name: 'ARModelWithMultipleStateMachines'
|
36
36
|
end
|
37
37
|
|
38
|
-
class
|
38
|
+
class ARModelWithMultipleStateMachinesThirdTransition < ApplicationRecord
|
39
|
+
belongs_to :ar_model_with_multiple_state_machines, class_name: 'ARModelWithMultipleStateMachines'
|
40
|
+
end
|
41
|
+
|
42
|
+
class ARModel < ApplicationRecord
|
39
43
|
|
40
44
|
state_machine :state, initial: :waiting do
|
41
45
|
audit_trail
|
@@ -50,7 +54,7 @@ class ARModel < ActiveRecord::Base
|
|
50
54
|
end
|
51
55
|
end
|
52
56
|
|
53
|
-
class ARModelNoInitial <
|
57
|
+
class ARModelNoInitial < ApplicationRecord
|
54
58
|
|
55
59
|
state_machine :state, initial: :waiting do
|
56
60
|
audit_trail initial: false
|
@@ -65,7 +69,7 @@ class ARModelNoInitial < ActiveRecord::Base
|
|
65
69
|
end
|
66
70
|
end
|
67
71
|
|
68
|
-
class ARModelWithNamespace <
|
72
|
+
class ARModelWithNamespace < ApplicationRecord
|
69
73
|
|
70
74
|
state_machine :foo_state, initial: :waiting, namespace: :foo do
|
71
75
|
audit_trail
|
@@ -81,7 +85,7 @@ class ARModelWithNamespace < ActiveRecord::Base
|
|
81
85
|
end
|
82
86
|
|
83
87
|
#
|
84
|
-
class ARModelWithContext <
|
88
|
+
class ARModelWithContext < ApplicationRecord
|
85
89
|
state_machine :state, initial: :waiting do
|
86
90
|
audit_trail context: :context
|
87
91
|
|
@@ -99,7 +103,7 @@ class ARModelWithContext < ActiveRecord::Base
|
|
99
103
|
end
|
100
104
|
end
|
101
105
|
|
102
|
-
class ARModelWithMultipleContext <
|
106
|
+
class ARModelWithMultipleContext < ApplicationRecord
|
103
107
|
state_machine :state, initial: :waiting do
|
104
108
|
audit_trail context: [:context, :second_context, :context_with_args]
|
105
109
|
|
@@ -140,7 +144,7 @@ class ARModelDescendantWithOwnStateMachines < ARModel
|
|
140
144
|
end
|
141
145
|
end
|
142
146
|
|
143
|
-
class ARModelWithMultipleStateMachines <
|
147
|
+
class ARModelWithMultipleStateMachines < ApplicationRecord
|
144
148
|
|
145
149
|
state_machine :first, :initial => :beginning do
|
146
150
|
audit_trail
|
@@ -171,11 +175,11 @@ class ARModelWithMultipleStateMachines < ActiveRecord::Base
|
|
171
175
|
end
|
172
176
|
end
|
173
177
|
|
174
|
-
class ARResourceStateTransition <
|
178
|
+
class ARResourceStateTransition < ApplicationRecord
|
175
179
|
belongs_to :resource, polymorphic: true
|
176
180
|
end
|
177
181
|
|
178
|
-
class ARFirstModelWithPolymorphicStateTransition <
|
182
|
+
class ARFirstModelWithPolymorphicStateTransition < ApplicationRecord
|
179
183
|
state_machine :state, :initial => :pending do
|
180
184
|
audit_trail class: ARResourceStateTransition, as: :ar_resource
|
181
185
|
|
@@ -189,7 +193,7 @@ class ARFirstModelWithPolymorphicStateTransition < ActiveRecord::Base
|
|
189
193
|
end
|
190
194
|
end
|
191
195
|
|
192
|
-
class ARSecondModelWithPolymorphicStateTransition <
|
196
|
+
class ARSecondModelWithPolymorphicStateTransition < ApplicationRecord
|
193
197
|
state_machine :state, :initial => :pending do
|
194
198
|
audit_trail class: ARResourceStateTransition, as: :ar_resource
|
195
199
|
|
@@ -204,11 +208,11 @@ class ARSecondModelWithPolymorphicStateTransition < ActiveRecord::Base
|
|
204
208
|
end
|
205
209
|
|
206
210
|
module SomeModule
|
207
|
-
class ARModelStateTransition <
|
208
|
-
belongs_to :ar_model
|
211
|
+
class ARModelStateTransition < ApplicationRecord
|
212
|
+
belongs_to :ar_model, class_name: 'SomeModule::ARModel'
|
209
213
|
end
|
210
214
|
|
211
|
-
class ARModel <
|
215
|
+
class ARModel < ApplicationRecord
|
212
216
|
|
213
217
|
state_machine :state, initial: :waiting do
|
214
218
|
audit_trail
|
metadata
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: state_machines-audit_trail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Ross
|
8
8
|
- Willem van Bergen
|
9
9
|
- Jesse Storimer
|
10
|
-
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: state_machines
|
@@ -18,14 +17,14 @@ dependencies:
|
|
18
17
|
requirements:
|
19
18
|
- - ">="
|
20
19
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
20
|
+
version: 0.10.0
|
22
21
|
type: :runtime
|
23
22
|
prerelease: false
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
25
24
|
requirements:
|
26
25
|
- - ">="
|
27
26
|
- !ruby/object:Gem::Version
|
28
|
-
version:
|
27
|
+
version: 0.10.0
|
29
28
|
- !ruby/object:Gem::Dependency
|
30
29
|
name: state_machines-activerecord
|
31
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,6 +95,34 @@ dependencies:
|
|
96
95
|
- - ">="
|
97
96
|
- !ruby/object:Gem::Version
|
98
97
|
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: sqlite3
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '1.7'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '1.7'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: activerecord
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '7.1'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '7.1'
|
99
126
|
description: Log transitions on a state_machines to support auditing and business
|
100
127
|
process analytics.
|
101
128
|
email:
|
@@ -130,7 +157,6 @@ homepage: https://github.com/state-machines/state_machines-audit_trail
|
|
130
157
|
licenses:
|
131
158
|
- MIT
|
132
159
|
metadata: {}
|
133
|
-
post_install_message:
|
134
160
|
rdoc_options: []
|
135
161
|
require_paths:
|
136
162
|
- lib
|
@@ -145,8 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
171
|
- !ruby/object:Gem::Version
|
146
172
|
version: '0'
|
147
173
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
149
|
-
signing_key:
|
174
|
+
rubygems_version: 3.6.7
|
150
175
|
specification_version: 4
|
151
176
|
summary: Log transitions on a state_machines to support auditing and business process
|
152
177
|
analytics.
|