recorder 1.1.1 → 1.2.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
2
  SHA256:
3
- metadata.gz: 1969c4224f9eb16b487f3d4bbf114a451dd880e3a89c09560549b10e7193c0e9
4
- data.tar.gz: 1275d6eb6da67a8994dea52d7570ba57dc17417b7601f5149e154eb934a26ca3
3
+ metadata.gz: ae74d8185637e26e50d8815288959677c403ac1c4879fc0feb866af31165eccf
4
+ data.tar.gz: a9d9595591300a31909329cba1406789796a776030b2a31ae0174bb0c7552947
5
5
  SHA512:
6
- metadata.gz: 99d3b65be9afcd6b395a3ec276368eebee82b1b7acae77e4f2a82ab40bc19144e7cd82499c484cd4daaa2f6225c8bd5b7234b430971e501c3362b6285e91dc94
7
- data.tar.gz: a31d6f4408307434d315b36ef9336b88b814bc75b406acbc25df318cc8b5843c37d9df29eaae94a8af34c20760ffe0d77f4e18941cb7b49ee503ee0041bc7b00
6
+ metadata.gz: 719f87740ae8ca7f76a27c32fd0fa54a2220d87849647657394b90d4cd48fb40ff834c01f7f6c24486aa7182b784ccc75e0b81efea490e59bdd733991dcd08db
7
+ data.tar.gz: 2ed90e0e50ed3cc3eb92acf4416aa4d6aeef61ae7350f17696a2c5894b56cf804504fcb30cbf024fc3bd149c25e4abdd050af4f132b83bc947739081614e968d
data/Rakefile CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
+ require 'rails/dummy/tasks'
5
6
 
6
7
  RSpec::Core::RakeTask.new(:spec)
7
8
 
@@ -5,6 +5,8 @@ module Recorder
5
5
  attr_reader :item, :changes
6
6
 
7
7
  def initialize(item, changes)
8
+ raise ArgumentError unless changes&.respond_to?(:to_h)
9
+
8
10
  @item = item
9
11
  @changes = changes.to_h
10
12
  end
@@ -10,18 +10,7 @@ module Recorder
10
10
  attr_reader :ignore, :async
11
11
 
12
12
  def initialize
13
- # Variables which affect all threads, whose access is synchronized.
14
- @mutex = Mutex.new
15
- @enabled = true
16
-
17
- @sidekiq_options = {
18
- queue: 'recorder',
19
- retry: 10,
20
- backtrace: true
21
- }
22
-
23
- @ignore = []
24
- @async = false
13
+ reset
25
14
  end
26
15
 
27
16
  def ignore=(value)
@@ -40,5 +29,19 @@ module Recorder
40
29
  def enabled=(enable)
41
30
  @mutex.synchronize { @enabled = enable }
42
31
  end
32
+
33
+ def reset
34
+ @mutex = Mutex.new
35
+ @enabled = true
36
+
37
+ @sidekiq_options = {
38
+ queue: 'recorder',
39
+ retry: 10,
40
+ backtrace: true
41
+ }
42
+
43
+ @ignore = []
44
+ @async = false
45
+ end
43
46
  end
44
47
  end
@@ -23,7 +23,7 @@ module Recorder
23
23
 
24
24
  module ClassMethods
25
25
  def recorder(options = {})
26
- define_method 'recorder_options' do
26
+ define_method :recorder_options do
27
27
  options
28
28
  end
29
29
 
@@ -82,11 +82,12 @@ module Recorder
82
82
 
83
83
  klass = "#{klass}Changeset"
84
84
 
85
- klass = begin
86
- klass.constantize
87
- rescue
88
- nil
89
- end
85
+ klass =
86
+ begin
87
+ klass.constantize
88
+ rescue
89
+ nil
90
+ end
90
91
  klass.present? ? klass : Recorder::Changeset
91
92
  end
92
93
  end
@@ -7,7 +7,7 @@ module Recorder
7
7
 
8
8
  sidekiq_options Recorder.config.sidekiq_options
9
9
 
10
- def perform(params)
10
+ def perform(**params)
11
11
  Recorder::Revision.create(params)
12
12
  end
13
13
  end
@@ -31,7 +31,7 @@ module Recorder
31
31
  def record_async(params, options)
32
32
  Recorder::Sidekiq::RevisionsWorker.perform_in(
33
33
  options[:delay] || 2.seconds,
34
- params
34
+ **params
35
35
  )
36
36
  end
37
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Recorder
4
- VERSION = '1.1.1'
4
+ VERSION = '1.2.0'
5
5
  end
data/recorder.gemspec CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
8
8
  spec.name = 'recorder'
9
9
  spec.version = Recorder::VERSION
10
10
  spec.authors = ['Igor Alexandrov']
11
- spec.email = ['igor.alexandrov@jetrockets.ru']
11
+ spec.email = ['igor.alexandrov@jetrockets.com']
12
12
 
13
13
  spec.summary = 'Rails model auditor'
14
14
  spec.description = 'Recorder tracks changes of your Rails models'
@@ -20,17 +20,18 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_dependency 'activerecord', '>= 5.0'
24
- spec.add_dependency 'activesupport', '>= 5.0'
23
+ spec.add_dependency 'activerecord', '~> 6.1'
24
+ spec.add_dependency 'activesupport', '~> 6.1'
25
25
  spec.add_dependency 'pg'
26
26
  spec.add_dependency 'request_store'
27
27
 
28
28
  spec.add_development_dependency 'bundler', '>= 2.0'
29
- spec.add_development_dependency 'database_cleaner'
29
+ # spec.add_development_dependency 'database_cleaner'
30
30
  spec.add_development_dependency 'generator_spec'
31
31
  spec.add_development_dependency 'jetrockets-standard'
32
32
  spec.add_development_dependency 'rake', '~> 13.0'
33
- spec.add_development_dependency 'rspec-rails', '~> 3.5'
34
- spec.add_development_dependency 'timecop', '~> 0.8.1'
35
- spec.add_development_dependency 'yard'
33
+ spec.add_development_dependency 'rspec-rails'
34
+ # spec.add_development_dependency 'timecop', '~> 0.8.1'
35
+ # spec.add_development_dependency 'yard'
36
+ spec.add_development_dependency 'rails-dummy'
36
37
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: recorder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Alexandrov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-13 00:00:00.000000000 Z
11
+ date: 2022-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '5.0'
19
+ version: '6.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '5.0'
26
+ version: '6.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.0'
33
+ version: '6.1'
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: '5.0'
40
+ version: '6.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pg
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.0'
83
- - !ruby/object:Gem::Dependency
84
- name: database_cleaner
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: generator_spec
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -140,32 +126,18 @@ dependencies:
140
126
  name: rspec-rails
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '3.5'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '3.5'
153
- - !ruby/object:Gem::Dependency
154
- name: timecop
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
129
+ - - ">="
158
130
  - !ruby/object:Gem::Version
159
- version: 0.8.1
131
+ version: '0'
160
132
  type: :development
161
133
  prerelease: false
162
134
  version_requirements: !ruby/object:Gem::Requirement
163
135
  requirements:
164
- - - "~>"
136
+ - - ">="
165
137
  - !ruby/object:Gem::Version
166
- version: 0.8.1
138
+ version: '0'
167
139
  - !ruby/object:Gem::Dependency
168
- name: yard
140
+ name: rails-dummy
169
141
  requirement: !ruby/object:Gem::Requirement
170
142
  requirements:
171
143
  - - ">="
@@ -180,7 +152,7 @@ dependencies:
180
152
  version: '0'
181
153
  description: Recorder tracks changes of your Rails models
182
154
  email:
183
- - igor.alexandrov@jetrockets.ru
155
+ - igor.alexandrov@jetrockets.com
184
156
  executables: []
185
157
  extensions: []
186
158
  extra_rdoc_files: []
@@ -234,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
206
  - !ruby/object:Gem::Version
235
207
  version: '0'
236
208
  requirements: []
237
- rubygems_version: 3.2.15
209
+ rubygems_version: 3.3.7
238
210
  signing_key:
239
211
  specification_version: 4
240
212
  summary: Rails model auditor