audited_async 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +0 -4
- data/Gemfile.lock +19 -11
- data/README.md +4 -5
- data/audited_async.gemspec +3 -3
- data/lib/audited_async.rb +5 -5
- data/lib/audited_async/version.rb +1 -1
- metadata +22 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f8307e9bfce863233facf4aabc4539856c03999674de0978235358eb367bca1
|
4
|
+
data.tar.gz: e8029355e6bd26a1c65ddc837e015bd86ad3425cc9f39586af07803e9989e1fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb31f59454e3abf36a8fd162953f793d311ae1f97afec754205e611db260863a8ce72d933a8a115579fcff3b94e6328ecf85f7c76f2183a6f4592aed36e67e6c
|
7
|
+
data.tar.gz: 5cb902af47c3ffbb9d5b9a45af4b778f4d284b9a7acccab7bb461c595d1c29ad525547e5be42bf1e9da01b16881285a8b97dae93ab3d673f3ce1f4ae7a976391
|
data/.circleci/config.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,38 +1,39 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
audited_async (0.2.
|
4
|
+
audited_async (0.2.2)
|
5
5
|
activejob
|
6
6
|
audited (>= 4.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activejob (
|
12
|
-
activesupport (=
|
11
|
+
activejob (6.0.0)
|
12
|
+
activesupport (= 6.0.0)
|
13
13
|
globalid (>= 0.3.6)
|
14
|
-
activemodel (
|
15
|
-
activesupport (=
|
16
|
-
activerecord (
|
17
|
-
activemodel (=
|
18
|
-
activesupport (=
|
19
|
-
|
20
|
-
activesupport (5.2.3)
|
14
|
+
activemodel (6.0.0)
|
15
|
+
activesupport (= 6.0.0)
|
16
|
+
activerecord (6.0.0)
|
17
|
+
activemodel (= 6.0.0)
|
18
|
+
activesupport (= 6.0.0)
|
19
|
+
activesupport (6.0.0)
|
21
20
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
22
21
|
i18n (>= 0.7, < 2)
|
23
22
|
minitest (~> 5.1)
|
24
23
|
tzinfo (~> 1.1)
|
25
|
-
|
24
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
26
25
|
ast (2.4.0)
|
27
26
|
audited (4.9.0)
|
28
27
|
activerecord (>= 4.2, < 6.1)
|
29
28
|
concurrent-ruby (1.1.5)
|
30
29
|
diff-lcs (1.3)
|
30
|
+
docile (1.3.2)
|
31
31
|
globalid (0.4.2)
|
32
32
|
activesupport (>= 4.2.0)
|
33
33
|
i18n (1.6.0)
|
34
34
|
concurrent-ruby (~> 1.0)
|
35
35
|
jaro_winkler (1.5.3)
|
36
|
+
json (2.2.0)
|
36
37
|
minitest (5.11.3)
|
37
38
|
parallel (1.17.0)
|
38
39
|
parser (2.6.3.0)
|
@@ -68,6 +69,11 @@ GEM
|
|
68
69
|
rubocop-rspec (1.35.0)
|
69
70
|
rubocop (>= 0.60.0)
|
70
71
|
ruby-progressbar (1.10.1)
|
72
|
+
simplecov (0.17.1)
|
73
|
+
docile (~> 1.1)
|
74
|
+
json (>= 1.8, < 3)
|
75
|
+
simplecov-html (~> 0.10.0)
|
76
|
+
simplecov-html (0.10.2)
|
71
77
|
thread_safe (0.3.6)
|
72
78
|
tzinfo (1.2.5)
|
73
79
|
thread_safe (~> 0.1)
|
@@ -77,6 +83,7 @@ GEM
|
|
77
83
|
rubocop-performance
|
78
84
|
rubocop-rails
|
79
85
|
rubocop-rspec
|
86
|
+
zeitwerk (2.1.9)
|
80
87
|
|
81
88
|
PLATFORMS
|
82
89
|
ruby
|
@@ -86,6 +93,7 @@ DEPENDENCIES
|
|
86
93
|
bundler
|
87
94
|
rake
|
88
95
|
rspec
|
96
|
+
simplecov
|
89
97
|
wonder-ruby-style
|
90
98
|
|
91
99
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# AuditedAsync
|
2
2
|
|
3
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/2d4899ab63fcea8a9144/maintainability)](https://codeclimate.com/github/leonardofalk/audited_async/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/2d4899ab63fcea8a9144/test_coverage)](https://codeclimate.com/github/leonardofalk/audited_async/test_coverage)
|
4
3
|
[![CircleCI](https://circleci.com/gh/leonardofalk/audited_async.svg?style=svg)](https://circleci.com/gh/leonardofalk/audited_async)
|
5
4
|
|
6
|
-
AuditedAsync is
|
5
|
+
AuditedAsync is a plugin for the [audited](https://github.com/collectiveidea/audited) gem which allows to create audits asynchronously using ActiveJob.
|
7
6
|
|
8
|
-
It works by
|
7
|
+
It works by injecting the `async` option into audited model option using functional programming. If enabled, it'll move audit creation logic into an ActiveJob instance, then it's sent to the queue to be executed later.
|
9
8
|
|
10
9
|
## Installation
|
11
10
|
|
@@ -105,11 +104,11 @@ https://github.com/leonardofalk/audited_async_sample.git
|
|
105
104
|
|
106
105
|
## Development
|
107
106
|
|
108
|
-
|
107
|
+
Checkout the repository, execute `bundle install` and you're good to go.
|
109
108
|
|
110
109
|
## Testing
|
111
110
|
|
112
|
-
There are some unit tests now but integration tests are missing. You can
|
111
|
+
There are some unit tests now but integration tests are missing. You can run the suite by executing `rspec`.
|
113
112
|
|
114
113
|
## Contributing
|
115
114
|
|
data/audited_async.gemspec
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'audited_async/version'
|
5
4
|
|
@@ -22,11 +21,12 @@ Gem::Specification.new do |spec|
|
|
22
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
22
|
spec.require_paths = %w[lib]
|
24
23
|
|
25
|
-
spec.add_dependency 'audited', '>= 4.0'
|
26
24
|
spec.add_dependency 'activejob'
|
25
|
+
spec.add_dependency 'audited', '>= 4.0'
|
27
26
|
|
28
27
|
spec.add_development_dependency 'bundler'
|
29
28
|
spec.add_development_dependency 'rake'
|
30
29
|
spec.add_development_dependency 'rspec'
|
30
|
+
spec.add_development_dependency 'simplecov'
|
31
31
|
spec.add_development_dependency 'wonder-ruby-style'
|
32
32
|
end
|
data/lib/audited_async.rb
CHANGED
@@ -41,7 +41,7 @@ module Audited::Auditor::ClassMethods
|
|
41
41
|
define_method :audited do |options = {}|
|
42
42
|
@audited_async_enabled = options.fetch(:async, false) && AuditedAsync.config.enabled?
|
43
43
|
|
44
|
-
_audited.bind(self).(options)
|
44
|
+
_audited.bind(self).call(options)
|
45
45
|
end
|
46
46
|
|
47
47
|
alias audited_async_enabled? audited_async_enabled
|
@@ -53,17 +53,17 @@ module Audited::Auditor::AuditedInstanceMethods
|
|
53
53
|
_audit_destroy = instance_method :audit_destroy
|
54
54
|
|
55
55
|
def audited_async_enabled?
|
56
|
-
self.class.audited_async_enabled?
|
56
|
+
self.class.auditing_enabled && self.class.audited_async_enabled?
|
57
57
|
end
|
58
58
|
|
59
59
|
define_method :audit_create do
|
60
|
-
return _audit_create.bind(self).
|
60
|
+
return _audit_create.bind(self).call unless audited_async_enabled?
|
61
61
|
|
62
62
|
perform_async_audit 'create'
|
63
63
|
end
|
64
64
|
|
65
65
|
define_method :audit_update do
|
66
|
-
return _audit_update.bind(self).
|
66
|
+
return _audit_update.bind(self).call unless audited_async_enabled?
|
67
67
|
|
68
68
|
unless (changes = audited_changes).empty? && (audit_comment.blank? || audited_options[:update_with_comment_only] == false)
|
69
69
|
perform_async_audit('update', changes)
|
@@ -71,7 +71,7 @@ module Audited::Auditor::AuditedInstanceMethods
|
|
71
71
|
end
|
72
72
|
|
73
73
|
define_method :audit_destroy do
|
74
|
-
return _audit_destroy.bind(self).
|
74
|
+
return _audit_destroy.bind(self).call unless audited_async_enabled?
|
75
75
|
|
76
76
|
perform_async_audit 'destroy' unless new_record?
|
77
77
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: audited_async
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonardo Falk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activejob
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: audited
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -25,13 +39,13 @@ dependencies:
|
|
25
39
|
- !ruby/object:Gem::Version
|
26
40
|
version: '4.0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
42
|
+
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - ">="
|
32
46
|
- !ruby/object:Gem::Version
|
33
47
|
version: '0'
|
34
|
-
type: :
|
48
|
+
type: :development
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
@@ -39,7 +53,7 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
@@ -53,7 +67,7 @@ dependencies:
|
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ">="
|
@@ -67,7 +81,7 @@ dependencies:
|
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: simplecov
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
@@ -137,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
151
|
- !ruby/object:Gem::Version
|
138
152
|
version: '0'
|
139
153
|
requirements: []
|
140
|
-
rubygems_version: 3.0.
|
154
|
+
rubygems_version: 3.0.6
|
141
155
|
signing_key:
|
142
156
|
specification_version: 4
|
143
157
|
summary: Execute audited asynchronously with ActiveJob.
|