state_machines-audit_trail 2.0.1 → 2.1.0

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
- SHA1:
3
- metadata.gz: 910c5966818f43a7d324e6a5eac81b25b210f839
4
- data.tar.gz: e483e8e528177cb4e83594866ea9d0420121f49e
2
+ SHA256:
3
+ metadata.gz: 661c7c543a31ede30e81d2a4eb7429899706a3462dccf8ae9ebb84f9d928aa5a
4
+ data.tar.gz: f1cad3fd778fbe4ad2009eede151ed65b26d00e2c4289e783052530f0ddbb1fd
5
5
  SHA512:
6
- metadata.gz: 4a41c3d8e214d72c68e944b0cb644d7ea94d9056251ee5271ad42d8df0554830d94bd3f810c04fdcb2d45fec1a86257f5043217d284c51798c094fea950458dc
7
- data.tar.gz: 3172241850a389b30c8e529bb74d77605cd09d907cdb081530326f2d25dcf5cadc0f4369ecc2810a45d751a86d523c266f86982c47e637017ed4a50130ef3563
6
+ metadata.gz: 25af57e9c8fe164681b99a81a41c1d93c81088e38af6b3f8a1761160ee46e9c3c3da75739511382541c084765e194ba20f5ff4132d47700eafbdf3a8909561e5
7
+ data.tar.gz: d3db2da4ffbed9fdf5cc870602245e2c80039f2a193b46ceb30d3460518c0e4fa7fe23b506a44ada42d784eb50fb5a9caab73984140242c6900a25b9b791756a
data/README.md CHANGED
@@ -1,5 +1,4 @@
1
- [![Build Status](https://travis-ci.org/state-machines/state_machines-audit_trail.svg?branch=master)](https://travis-ci.org/state-machines/state_machines-audit_trail)
2
- [![Code Climate](https://codeclimate.com/github/state-machines/state_machines-audit_trail.png)](https://codeclimate.com/github/state-machines/state_machines-audit_trail)
1
+ [![Code Climate](https://codeclimate.com/github/state-machines/state_machines-audit_trail.svg)](https://codeclimate.com/github/state-machines/state_machines-audit_trail)
3
2
 
4
3
  # state_machines-audit_trail
5
4
  Log transitions on a [state_machines gem](https://github.com/state-machines/state_machines) to support auditing and business process analytics.
@@ -12,7 +11,7 @@ for any state machine. Having an audit trail gives you a complete history of the
12
11
  to investigate incidents or perform analytics, like: _"How long does it take on average to go from state a to state b?"_,
13
12
  or _"What percentage of cases goes from state a to b via state c?"_
14
13
 
15
- For more information read [Why developers should be force-fed state machines](http://www.shopify.com/technology/3383012-why-developers-should-be-force-fed-state-machines).
14
+ For more information read [Why developers should be force-fed state machines](https://engineering.shopify.com/blogs/engineering/17488160-why-developers-should-be-force-fed-state-machines).
16
15
 
17
16
  ## ORM support
18
17
 
data/Rakefile CHANGED
@@ -6,10 +6,4 @@ RSpec::Core::RakeTask.new(:spec) do |task|
6
6
  task.rspec_opts = ['--color']
7
7
  end
8
8
 
9
- if ENV['APPRAISAL_INITIALIZED'] || ENV['TRAVIS']
10
- task :default => :spec
11
- else
12
- require 'appraisal'
13
- Appraisal::Task.new
14
- task :default => :appraisal
15
- end
9
+ task :default => :spec
@@ -5,7 +5,7 @@ class StateMachines::AuditTrail::Backend::ActiveRecord < StateMachines::AuditTra
5
5
  super
6
6
  @association = transition_class.to_s.tableize.split('/').last.to_sym
7
7
  assoc_options = {class_name: transition_class.to_s}.merge(options.slice(:as))
8
- owner_class.has_many(@association, assoc_options) unless owner_class.reflect_on_association(@association)
8
+ owner_class.has_many(@association, **assoc_options) unless owner_class.reflect_on_association(@association)
9
9
  end
10
10
 
11
11
  def persist(object, fields)
@@ -1,4 +1,3 @@
1
- require 'ostruct'
2
1
  #
3
2
  # This module inserts hooks into the state machine.
4
3
  # The transition_class is the class (optionally specified with the :class option) for the model which
@@ -7,6 +6,30 @@ require 'ostruct'
7
6
  # Multiple `SubscriptionStateTransition`s compose the 'audit_trail'.
8
7
  #
9
8
  module StateMachines::AuditTrail::TransitionAuditing
9
+ class InitialTransition
10
+ attr_reader :namespace, :to
11
+
12
+ def initialize(namespace:, to:)
13
+ @namespace = namespace
14
+ @to = to
15
+ end
16
+
17
+ def from
18
+ nil
19
+ end
20
+
21
+ def event
22
+ nil
23
+ end
24
+
25
+ def machine
26
+ nil
27
+ end
28
+
29
+ def args
30
+ nil
31
+ end
32
+ end
10
33
 
11
34
  # Hook for audit_trail inside a a state_machine declaration.
12
35
  #
@@ -35,7 +58,7 @@ module StateMachines::AuditTrail::TransitionAuditing
35
58
  if state_machine.backend.new_record? object
36
59
  current_state = object.send(state_machine.attribute)
37
60
  if !current_state.nil?
38
- state_machine.backend.log(object, OpenStruct.new(namespace: state_machine.namespace, to: current_state))
61
+ state_machine.backend.log(object, InitialTransition.new(namespace: state_machine.namespace, to: current_state))
39
62
  end
40
63
  end
41
64
  end
@@ -1,5 +1,5 @@
1
1
  module StateMachines
2
2
  module AuditTrail
3
- VERSION = '2.0.1'
3
+ VERSION = '2.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: state_machines-audit_trail
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Ross
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-11-06 00:00:00.000000000 Z
13
+ date: 2024-01-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: state_machines
@@ -40,20 +40,6 @@ dependencies:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
42
  version: '0'
43
- - !ruby/object:Gem::Dependency
44
- name: state_machines-mongoid
45
- requirement: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: '0'
50
- type: :development
51
- prerelease: false
52
- version_requirements: !ruby/object:Gem::Requirement
53
- requirements:
54
- - - ">="
55
- - !ruby/object:Gem::Version
56
- version: '0'
57
43
  - !ruby/object:Gem::Dependency
58
44
  name: rake
59
45
  requirement: !ruby/object:Gem::Requirement
@@ -83,49 +69,7 @@ dependencies:
83
69
  - !ruby/object:Gem::Version
84
70
  version: 3.0.0
85
71
  - !ruby/object:Gem::Dependency
86
- name: activerecord
87
- requirement: !ruby/object:Gem::Requirement
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- version: 5.0.0
92
- type: :development
93
- prerelease: false
94
- version_requirements: !ruby/object:Gem::Requirement
95
- requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- version: 5.0.0
99
- - !ruby/object:Gem::Dependency
100
- name: sqlite3
101
- requirement: !ruby/object:Gem::Requirement
102
- requirements:
103
- - - ">="
104
- - !ruby/object:Gem::Version
105
- version: '0'
106
- type: :development
107
- prerelease: false
108
- version_requirements: !ruby/object:Gem::Requirement
109
- requirements:
110
- - - ">="
111
- - !ruby/object:Gem::Version
112
- version: '0'
113
- - !ruby/object:Gem::Dependency
114
- name: mongoid
115
- requirement: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- version: 6.0.0.beta
120
- type: :development
121
- prerelease: false
122
- version_requirements: !ruby/object:Gem::Requirement
123
- requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: 6.0.0.beta
127
- - !ruby/object:Gem::Dependency
128
- name: bson_ext
72
+ name: generator_spec
129
73
  requirement: !ruby/object:Gem::Requirement
130
74
  requirements:
131
75
  - - ">="
@@ -139,7 +83,7 @@ dependencies:
139
83
  - !ruby/object:Gem::Version
140
84
  version: '0'
141
85
  - !ruby/object:Gem::Dependency
142
- name: generator_spec
86
+ name: appraisal
143
87
  requirement: !ruby/object:Gem::Requirement
144
88
  requirements:
145
89
  - - ">="
@@ -152,34 +96,6 @@ dependencies:
152
96
  - - ">="
153
97
  - !ruby/object:Gem::Version
154
98
  version: '0'
155
- - !ruby/object:Gem::Dependency
156
- name: rails
157
- requirement: !ruby/object:Gem::Requirement
158
- requirements:
159
- - - ">="
160
- - !ruby/object:Gem::Version
161
- version: 5.0.0
162
- type: :development
163
- prerelease: false
164
- version_requirements: !ruby/object:Gem::Requirement
165
- requirements:
166
- - - ">="
167
- - !ruby/object:Gem::Version
168
- version: 5.0.0
169
- - !ruby/object:Gem::Dependency
170
- name: appraisal
171
- requirement: !ruby/object:Gem::Requirement
172
- requirements:
173
- - - "~>"
174
- - !ruby/object:Gem::Version
175
- version: 2.2.0
176
- type: :development
177
- prerelease: false
178
- version_requirements: !ruby/object:Gem::Requirement
179
- requirements:
180
- - - "~>"
181
- - !ruby/object:Gem::Version
182
- version: 2.2.0
183
99
  description: Log transitions on a state_machines to support auditing and business
184
100
  process analytics.
185
101
  email:
@@ -190,19 +106,9 @@ executables: []
190
106
  extensions: []
191
107
  extra_rdoc_files: []
192
108
  files:
193
- - ".gitignore"
194
- - ".rspec"
195
- - ".ruby-gemset"
196
- - ".ruby-version"
197
- - ".travis.yml"
198
- - Appraisals
199
- - Gemfile
200
109
  - LICENSE
201
110
  - README.md
202
111
  - Rakefile
203
- - gemfiles/rails_5.0.gemfile
204
- - gemfiles/rails_5.1.gemfile
205
- - gemfiles/rails_edge.gemfile
206
112
  - lib/state_machines-audit_trail.rb
207
113
  - lib/state_machines/audit_trail.rb
208
114
  - lib/state_machines/audit_trail/backend.rb
@@ -220,7 +126,6 @@ files:
220
126
  - spec/lib/state_machines/audit_trail_generator_spec.rb
221
127
  - spec/lib/state_machines/audit_trail_spec.rb
222
128
  - spec/spec_helper.rb
223
- - state_machines-audit_trail.gemspec
224
129
  homepage: https://github.com/state-machines/state_machines-audit_trail
225
130
  licenses:
226
131
  - MIT
@@ -240,8 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
145
  - !ruby/object:Gem::Version
241
146
  version: '0'
242
147
  requirements: []
243
- rubyforge_project:
244
- rubygems_version: 2.6.7
148
+ rubygems_version: 3.4.10
245
149
  signing_key:
246
150
  specification_version: 4
247
151
  summary: Log transitions on a state_machines to support auditing and business process
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- *.gemfile.lock
5
- pkg/*
6
- .DS_Store
7
- *.rbc
8
- /doc
9
- .yardoc
10
- .idea
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
data/.ruby-gemset DELETED
@@ -1 +0,0 @@
1
- state_machines-audit_trail
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.3.1
data/.travis.yml DELETED
@@ -1,20 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- cache: bundler
4
-
5
- script: "bundle exec rake"
6
-
7
- services: mongodb
8
- rvm:
9
- - 2.2.2
10
- - 2.3.1
11
- - jruby
12
- - rbx-2
13
- gemfile:
14
- - gemfiles/rails_5.0.gemfile
15
- - gemfiles/rails_5.1.gemfile
16
- - gemfiles/rails_edge.gemfile
17
- matrix:
18
- allow_failures:
19
- - rvm: rbx-2
20
- - rvm: jruby
data/Appraisals DELETED
@@ -1,15 +0,0 @@
1
- appraise 'rails_5.0' do
2
- gem 'activerecord', '~> 5.0'
3
- gem 'activemodel', '~> 5.0'
4
- end
5
-
6
- appraise 'rails_5.1' do
7
- gem 'activerecord', '~> 5.1'
8
- gem 'activemodel', '~> 5.1'
9
- end
10
-
11
- appraise 'rails_edge' do
12
- gem 'activerecord', github: 'rails/rails', branch: 'master'
13
- gem 'activemodel', github: 'rails/rails', branch: 'master'
14
- gem 'arel', github: 'rails/arel', branch: 'master'
15
- end
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 5.0"
6
- gem "activemodel", "~> 5.0"
7
-
8
- gemspec path: "../"
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", "~> 5.1"
6
- gem "activemodel", "~> 5.1"
7
-
8
- gemspec path: "../"
@@ -1,9 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "activerecord", github: "rails/rails", branch: "master"
6
- gem "activemodel", github: "rails/rails", branch: "master"
7
- gem "arel", github: "rails/arel", branch: "master"
8
-
9
- gemspec path: "../"
@@ -1,37 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
-
3
- lib = File.expand_path('../lib', __FILE__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'state_machines/audit_trail/version'
6
-
7
- Gem::Specification.new do |s|
8
- s.name = 'state_machines-audit_trail'
9
- s.version = StateMachines::AuditTrail::VERSION
10
- s.platform = Gem::Platform::RUBY
11
- s.authors = ['Kevin Ross', 'Willem van Bergen', 'Jesse Storimer']
12
- s.email = ['kevin.ross@alienfast.com', 'willem@shopify.com', 'jesse@shopify.com']
13
-
14
- s.homepage = 'https://github.com/state-machines/state_machines-audit_trail'
15
- s.summary = %q{Log transitions on a state_machines to support auditing and business process analytics.}
16
- s.description = %q{Log transitions on a state_machines to support auditing and business process analytics.}
17
- s.license = 'MIT'
18
-
19
- s.add_runtime_dependency('state_machines')
20
-
21
- s.add_development_dependency('state_machines-activerecord')
22
- s.add_development_dependency('state_machines-mongoid')
23
- s.add_development_dependency('rake')
24
- s.add_development_dependency('rspec', '>= 3.0.0')
25
- s.add_development_dependency('activerecord', '>= 5.0.0')
26
- s.add_development_dependency('sqlite3')
27
- s.add_development_dependency('mongoid', '>= 6.0.0.beta')
28
- s.add_development_dependency('bson_ext')
29
- s.add_development_dependency('generator_spec')
30
- s.add_development_dependency('rails', '>= 5.0.0')
31
- s.add_development_dependency('appraisal', '~> 2.2.0')
32
-
33
- s.files = `git ls-files`.split($/).reject { |f| f =~ /^samples\// }
34
- s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
35
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
36
- s.require_paths = ['lib']
37
- end