umbrellio-utils 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +172 -15
- data/lib/umbrellio_utils/misc.rb +8 -7
- data/lib/umbrellio_utils/semantic_logger/tiny_json_formatter.rb +14 -2
- data/lib/umbrellio_utils/version.rb +1 -1
- data/umbrellio_utils.gemspec +2 -0
- metadata +31 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 775bfbed71a46193690194debe62228e56f7e134abafbf08171dbb7fa2130683
|
4
|
+
data.tar.gz: b231a19dc0360444b68efd237b2ebc24016cdaa2d3e4f1082310919a25f67f60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8cf08d855ecbdacc2a6e5843eb358c76bb8101fe50ffb9bd21468782b7d797a2d0a7efa23c082933bb00732c5ecd6bc91e6acc79e1a13f1cd0fc6787eb21e93d
|
7
|
+
data.tar.gz: d51dc93af899f70612ce5d0476d8866327c4b1c14678cb994b08cd33f4d8aee245ffd6b4ff70d62c206a1c99e4e12bca2bfdd8e6c8f63aa6aa0518c74da5767f
|
data/Gemfile.lock
CHANGED
@@ -1,62 +1,189 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
umbrellio-utils (0.
|
4
|
+
umbrellio-utils (0.7.0)
|
5
5
|
memery (~> 1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
+
actioncable (7.0.4.2)
|
11
|
+
actionpack (= 7.0.4.2)
|
12
|
+
activesupport (= 7.0.4.2)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
actionmailbox (7.0.4.2)
|
16
|
+
actionpack (= 7.0.4.2)
|
17
|
+
activejob (= 7.0.4.2)
|
18
|
+
activerecord (= 7.0.4.2)
|
19
|
+
activestorage (= 7.0.4.2)
|
20
|
+
activesupport (= 7.0.4.2)
|
21
|
+
mail (>= 2.7.1)
|
22
|
+
net-imap
|
23
|
+
net-pop
|
24
|
+
net-smtp
|
25
|
+
actionmailer (7.0.4.2)
|
26
|
+
actionpack (= 7.0.4.2)
|
27
|
+
actionview (= 7.0.4.2)
|
28
|
+
activejob (= 7.0.4.2)
|
29
|
+
activesupport (= 7.0.4.2)
|
30
|
+
mail (~> 2.5, >= 2.5.4)
|
31
|
+
net-imap
|
32
|
+
net-pop
|
33
|
+
net-smtp
|
34
|
+
rails-dom-testing (~> 2.0)
|
35
|
+
actionpack (7.0.4.2)
|
36
|
+
actionview (= 7.0.4.2)
|
37
|
+
activesupport (= 7.0.4.2)
|
38
|
+
rack (~> 2.0, >= 2.2.0)
|
39
|
+
rack-test (>= 0.6.3)
|
40
|
+
rails-dom-testing (~> 2.0)
|
41
|
+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
42
|
+
actiontext (7.0.4.2)
|
43
|
+
actionpack (= 7.0.4.2)
|
44
|
+
activerecord (= 7.0.4.2)
|
45
|
+
activestorage (= 7.0.4.2)
|
46
|
+
activesupport (= 7.0.4.2)
|
47
|
+
globalid (>= 0.6.0)
|
48
|
+
nokogiri (>= 1.8.5)
|
49
|
+
actionview (7.0.4.2)
|
50
|
+
activesupport (= 7.0.4.2)
|
51
|
+
builder (~> 3.1)
|
52
|
+
erubi (~> 1.4)
|
53
|
+
rails-dom-testing (~> 2.0)
|
54
|
+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
55
|
+
activejob (7.0.4.2)
|
56
|
+
activesupport (= 7.0.4.2)
|
57
|
+
globalid (>= 0.3.6)
|
58
|
+
activemodel (7.0.4.2)
|
59
|
+
activesupport (= 7.0.4.2)
|
60
|
+
activerecord (7.0.4.2)
|
61
|
+
activemodel (= 7.0.4.2)
|
62
|
+
activesupport (= 7.0.4.2)
|
63
|
+
activestorage (7.0.4.2)
|
64
|
+
actionpack (= 7.0.4.2)
|
65
|
+
activejob (= 7.0.4.2)
|
66
|
+
activerecord (= 7.0.4.2)
|
67
|
+
activesupport (= 7.0.4.2)
|
68
|
+
marcel (~> 1.0)
|
69
|
+
mini_mime (>= 1.1.0)
|
10
70
|
activesupport (7.0.4.2)
|
11
71
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
72
|
i18n (>= 1.6, < 2)
|
13
73
|
minitest (>= 5.1)
|
14
74
|
tzinfo (~> 2.0)
|
15
75
|
amazing_print (1.4.0)
|
76
|
+
amq-protocol (2.3.2)
|
16
77
|
ast (2.4.2)
|
78
|
+
builder (3.2.4)
|
17
79
|
bundler-audit (0.9.1)
|
18
80
|
bundler (>= 1.2.0, < 3)
|
19
81
|
thor (~> 1.0)
|
82
|
+
bunny (2.20.3)
|
83
|
+
amq-protocol (~> 2.3, >= 2.3.1)
|
84
|
+
sorted_set (~> 1, >= 1.0.2)
|
20
85
|
ci-helper (0.5.0)
|
21
86
|
colorize (~> 0.8)
|
22
87
|
dry-inflector (~> 0.2)
|
23
88
|
umbrellio-sequel-plugins (~> 0.4)
|
24
89
|
coderay (1.1.3)
|
25
90
|
colorize (0.8.1)
|
26
|
-
concurrent-ruby (1.2.
|
91
|
+
concurrent-ruby (1.2.2)
|
92
|
+
crass (1.0.6)
|
93
|
+
date (3.3.3)
|
27
94
|
diff-lcs (1.5.0)
|
28
95
|
docile (1.4.0)
|
29
96
|
dry-inflector (0.3.0)
|
97
|
+
erubi (1.12.0)
|
98
|
+
globalid (1.1.0)
|
99
|
+
activesupport (>= 5.0)
|
30
100
|
i18n (1.12.0)
|
31
101
|
concurrent-ruby (~> 1.0)
|
32
102
|
json (2.6.3)
|
103
|
+
lamian (1.7.0)
|
104
|
+
rails (>= 4.2)
|
105
|
+
loofah (2.19.1)
|
106
|
+
crass (~> 1.0.2)
|
107
|
+
nokogiri (>= 1.5.9)
|
108
|
+
mail (2.8.1)
|
109
|
+
mini_mime (>= 0.1.1)
|
110
|
+
net-imap
|
111
|
+
net-pop
|
112
|
+
net-smtp
|
113
|
+
marcel (1.0.2)
|
33
114
|
memery (1.4.1)
|
34
115
|
ruby2_keywords (~> 0.0.2)
|
35
116
|
method_source (1.0.0)
|
117
|
+
mini_mime (1.1.2)
|
36
118
|
mini_portile2 (2.8.1)
|
37
|
-
minitest (5.
|
38
|
-
|
119
|
+
minitest (5.18.0)
|
120
|
+
net-imap (0.3.4)
|
121
|
+
date
|
122
|
+
net-protocol
|
123
|
+
net-pop (0.1.2)
|
124
|
+
net-protocol
|
125
|
+
net-protocol (0.2.1)
|
126
|
+
timeout
|
127
|
+
net-smtp (0.3.3)
|
128
|
+
net-protocol
|
129
|
+
nio4r (2.5.8)
|
130
|
+
nokogiri (1.14.2)
|
39
131
|
mini_portile2 (~> 2.8.0)
|
40
132
|
racc (~> 1.4)
|
41
|
-
nokogiri (1.14.
|
133
|
+
nokogiri (1.14.2-arm64-darwin)
|
42
134
|
racc (~> 1.4)
|
43
|
-
nokogiri (1.14.
|
135
|
+
nokogiri (1.14.2-x86_64-darwin)
|
44
136
|
racc (~> 1.4)
|
45
|
-
nokogiri (1.14.
|
137
|
+
nokogiri (1.14.2-x86_64-linux)
|
46
138
|
racc (~> 1.4)
|
47
139
|
nori (2.6.0)
|
48
140
|
parallel (1.22.1)
|
49
|
-
parser (3.2.
|
141
|
+
parser (3.2.1.1)
|
50
142
|
ast (~> 2.4.1)
|
51
|
-
pg (1.4.
|
143
|
+
pg (1.4.6)
|
52
144
|
pry (0.14.2)
|
53
145
|
coderay (~> 1.1)
|
54
146
|
method_source (~> 1.0)
|
147
|
+
rabbit_messaging (0.13.0)
|
148
|
+
bunny (~> 2.0)
|
149
|
+
lamian
|
150
|
+
rails (>= 5.2)
|
151
|
+
sneakers (~> 2.0)
|
152
|
+
tainbox
|
55
153
|
racc (1.6.2)
|
56
|
-
rack (
|
154
|
+
rack (2.2.6.3)
|
155
|
+
rack-test (2.0.2)
|
156
|
+
rack (>= 1.3)
|
157
|
+
rails (7.0.4.2)
|
158
|
+
actioncable (= 7.0.4.2)
|
159
|
+
actionmailbox (= 7.0.4.2)
|
160
|
+
actionmailer (= 7.0.4.2)
|
161
|
+
actionpack (= 7.0.4.2)
|
162
|
+
actiontext (= 7.0.4.2)
|
163
|
+
actionview (= 7.0.4.2)
|
164
|
+
activejob (= 7.0.4.2)
|
165
|
+
activemodel (= 7.0.4.2)
|
166
|
+
activerecord (= 7.0.4.2)
|
167
|
+
activestorage (= 7.0.4.2)
|
168
|
+
activesupport (= 7.0.4.2)
|
169
|
+
bundler (>= 1.15.0)
|
170
|
+
railties (= 7.0.4.2)
|
171
|
+
rails-dom-testing (2.0.3)
|
172
|
+
activesupport (>= 4.2.0)
|
173
|
+
nokogiri (>= 1.6)
|
174
|
+
rails-html-sanitizer (1.5.0)
|
175
|
+
loofah (~> 2.19, >= 2.19.1)
|
176
|
+
railties (7.0.4.2)
|
177
|
+
actionpack (= 7.0.4.2)
|
178
|
+
activesupport (= 7.0.4.2)
|
179
|
+
method_source
|
180
|
+
rake (>= 12.2)
|
181
|
+
thor (~> 1.0)
|
182
|
+
zeitwerk (~> 2.5)
|
57
183
|
rainbow (3.1.1)
|
58
184
|
rake (13.0.6)
|
59
|
-
|
185
|
+
rbtree (0.4.6)
|
186
|
+
regexp_parser (2.7.0)
|
60
187
|
rexml (3.2.5)
|
61
188
|
rspec (3.12.0)
|
62
189
|
rspec-core (~> 3.12.0)
|
@@ -84,8 +211,8 @@ GEM
|
|
84
211
|
rubocop-ast (>= 1.24.1, < 2.0)
|
85
212
|
ruby-progressbar (~> 1.7)
|
86
213
|
unicode-display_width (>= 2.4.0, < 3.0)
|
87
|
-
rubocop-ast (1.
|
88
|
-
parser (>= 3.
|
214
|
+
rubocop-ast (1.27.0)
|
215
|
+
parser (>= 3.2.1.0)
|
89
216
|
rubocop-config-umbrellio (1.43.0.81)
|
90
217
|
rubocop (~> 1.43.0)
|
91
218
|
rubocop-performance (~> 1.15.0)
|
@@ -106,11 +233,18 @@ GEM
|
|
106
233
|
rubocop (~> 1.33)
|
107
234
|
rubocop-sequel (0.3.4)
|
108
235
|
rubocop (~> 1.0)
|
109
|
-
ruby-progressbar (1.
|
236
|
+
ruby-progressbar (1.13.0)
|
110
237
|
ruby2_keywords (0.0.5)
|
238
|
+
self_data (1.3.0)
|
111
239
|
semantic_logger (4.12.0)
|
112
240
|
concurrent-ruby (~> 1.0)
|
113
|
-
sequel (5.
|
241
|
+
sequel (5.66.0)
|
242
|
+
sequel-batches (2.0.2)
|
243
|
+
sequel
|
244
|
+
serverengine (2.0.7)
|
245
|
+
sigdump (~> 0.2.2)
|
246
|
+
set (1.0.3)
|
247
|
+
sigdump (0.2.4)
|
114
248
|
simplecov (0.22.0)
|
115
249
|
docile (~> 1.1)
|
116
250
|
simplecov-html (~> 0.11)
|
@@ -118,9 +252,26 @@ GEM
|
|
118
252
|
simplecov-html (0.12.3)
|
119
253
|
simplecov-lcov (0.8.0)
|
120
254
|
simplecov_json_formatter (0.1.4)
|
255
|
+
sneakers (2.11.0)
|
256
|
+
bunny (~> 2.12)
|
257
|
+
concurrent-ruby (~> 1.0)
|
258
|
+
rake
|
259
|
+
serverengine (~> 2.0.5)
|
260
|
+
thor
|
261
|
+
sorted_set (1.0.3)
|
262
|
+
rbtree
|
263
|
+
set (~> 1.0)
|
121
264
|
symbiont-ruby (0.7.0)
|
265
|
+
table_sync (6.1.0)
|
266
|
+
memery
|
267
|
+
rabbit_messaging
|
268
|
+
rails
|
269
|
+
self_data
|
270
|
+
tainbox (2.1.2)
|
271
|
+
activesupport
|
122
272
|
thor (1.2.1)
|
123
273
|
timecop (0.9.6)
|
274
|
+
timeout (0.3.2)
|
124
275
|
tzinfo (2.0.6)
|
125
276
|
concurrent-ruby (~> 1.0)
|
126
277
|
umbrellio-sequel-plugins (0.11.0.143)
|
@@ -128,8 +279,12 @@ GEM
|
|
128
279
|
symbiont-ruby
|
129
280
|
unicode-display_width (2.4.2)
|
130
281
|
webrick (1.7.0)
|
282
|
+
websocket-driver (0.7.5)
|
283
|
+
websocket-extensions (>= 0.1.0)
|
284
|
+
websocket-extensions (0.1.5)
|
131
285
|
yard (0.9.28)
|
132
286
|
webrick (~> 1.7.0)
|
287
|
+
zeitwerk (2.6.7)
|
133
288
|
|
134
289
|
PLATFORMS
|
135
290
|
arm64-darwin-20
|
@@ -153,8 +308,10 @@ DEPENDENCIES
|
|
153
308
|
rubocop-config-umbrellio
|
154
309
|
semantic_logger
|
155
310
|
sequel
|
311
|
+
sequel-batches
|
156
312
|
simplecov
|
157
313
|
simplecov-lcov
|
314
|
+
table_sync
|
158
315
|
timecop
|
159
316
|
umbrellio-utils!
|
160
317
|
yard
|
data/lib/umbrellio_utils/misc.rb
CHANGED
@@ -6,14 +6,15 @@ module UmbrellioUtils
|
|
6
6
|
|
7
7
|
def table_sync(scope, delay: 1, routing_key: nil)
|
8
8
|
scope.in_batches do |batch|
|
9
|
-
batch.
|
10
|
-
|
9
|
+
batch_for_sync = batch.all.reject { |model| model.try(:skip_table_sync?) }
|
10
|
+
next if batch_for_sync.empty?
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
model_class = batch_for_sync.first.class.name
|
13
|
+
TableSync::Publishing::Batch.new(
|
14
|
+
object_class: model_class,
|
15
|
+
original_attributes: batch_for_sync.map(&:values),
|
16
|
+
routing_key: routing_key,
|
17
|
+
).publish_now
|
17
18
|
|
18
19
|
sleep delay
|
19
20
|
end
|
@@ -70,18 +70,30 @@ module UmbrellioUtils
|
|
70
70
|
log.level.upcase,
|
71
71
|
log.name,
|
72
72
|
thread_fingerprint_for(log),
|
73
|
-
log
|
73
|
+
log_to_message(log),
|
74
74
|
log.tags,
|
75
75
|
log.named_tags,
|
76
76
|
log.time.utc.iso8601(9),
|
77
77
|
]
|
78
78
|
end
|
79
79
|
|
80
|
-
# Calculates MD5 fingerprint for the thread
|
80
|
+
# Calculates MD5 fingerprint for the thread in which the log was made.
|
81
81
|
# @return [String] truncated `MD5` hash.
|
82
82
|
def thread_fingerprint_for(log)
|
83
83
|
Digest::MD5.hexdigest("#{log.thread_name}#{Process.pid}")[0...8]
|
84
84
|
end
|
85
|
+
|
86
|
+
# Renders either exception or message of the log.
|
87
|
+
# @return [String]
|
88
|
+
def log_to_message(log)
|
89
|
+
if (e = log.exception)
|
90
|
+
msg = +"#{e.message} (#{e.class})"
|
91
|
+
msg << "\n#{e.backtrace.join("\n")}" if e.backtrace
|
92
|
+
msg
|
93
|
+
else
|
94
|
+
log.message
|
95
|
+
end
|
96
|
+
end
|
85
97
|
end
|
86
98
|
end
|
87
99
|
end
|
data/umbrellio_utils.gemspec
CHANGED
@@ -43,8 +43,10 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_development_dependency "rubocop-config-umbrellio"
|
44
44
|
spec.add_development_dependency "semantic_logger"
|
45
45
|
spec.add_development_dependency "sequel"
|
46
|
+
spec.add_development_dependency "sequel-batches"
|
46
47
|
spec.add_development_dependency "simplecov"
|
47
48
|
spec.add_development_dependency "simplecov-lcov"
|
49
|
+
spec.add_development_dependency "table_sync"
|
48
50
|
spec.add_development_dependency "timecop"
|
49
51
|
spec.add_development_dependency "yard"
|
50
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: umbrellio-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JustAnotherDude
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: memery
|
@@ -220,6 +220,20 @@ dependencies:
|
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '0'
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: sequel-batches
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - ">="
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '0'
|
223
237
|
- !ruby/object:Gem::Dependency
|
224
238
|
name: simplecov
|
225
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,6 +262,20 @@ dependencies:
|
|
248
262
|
- - ">="
|
249
263
|
- !ruby/object:Gem::Version
|
250
264
|
version: '0'
|
265
|
+
- !ruby/object:Gem::Dependency
|
266
|
+
name: table_sync
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
268
|
+
requirements:
|
269
|
+
- - ">="
|
270
|
+
- !ruby/object:Gem::Version
|
271
|
+
version: '0'
|
272
|
+
type: :development
|
273
|
+
prerelease: false
|
274
|
+
version_requirements: !ruby/object:Gem::Requirement
|
275
|
+
requirements:
|
276
|
+
- - ">="
|
277
|
+
- !ruby/object:Gem::Version
|
278
|
+
version: '0'
|
251
279
|
- !ruby/object:Gem::Dependency
|
252
280
|
name: timecop
|
253
281
|
requirement: !ruby/object:Gem::Requirement
|
@@ -338,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
338
366
|
- !ruby/object:Gem::Version
|
339
367
|
version: '0'
|
340
368
|
requirements: []
|
341
|
-
rubygems_version: 3.4.
|
369
|
+
rubygems_version: 3.4.7
|
342
370
|
signing_key:
|
343
371
|
specification_version: 4
|
344
372
|
summary: A set of utilities that speed up development
|