bellman 0.1.1 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3fbd1ee19a3727dfb7efd00bafd2de608cc08c7cecffbaa311a2f0ad71c51d9
4
- data.tar.gz: 853afcf30bffdbbf08d6b81192725543650ddad687e6ed8645fa70082887f645
3
+ metadata.gz: 683543d3e170858c7c4a43efa40860b918b5209b40cd87548a2bd65cfe86537b
4
+ data.tar.gz: a237d75de02a6763ed73a213057db2dbceb34d055f44f6b1f27392e59e38468a
5
5
  SHA512:
6
- metadata.gz: caf2124a78105f6eae4e0bb82599febb623411405bb4c87ec15e001ceeb57b400655e42330c657020f29031992be1327b17995b6aea484e75251e46a08621542
7
- data.tar.gz: 770d99680d228da731033197bc7108b905904b3a56865c5f4ce5c514be950c71b8c235393e444dbce09590cad60b014b3bf4a3203ecedc7f2cdb86195cf6d5a6
6
+ metadata.gz: f022acd6210e89d2a4f279eb76d15d4960aa484cef3a8cfcfd6dc246d02a06765208c4dc5a2493a563119cf69090a8c1b83ffa38681c23f1fb5e3145c459d8c5
7
+ data.tar.gz: 50f55c23a71b54e8bc882998ef8070ccca4df9af19219aa470c2fe013d8054f6071d35b22eb2b887e12262e8465a1c3434f48d05c06ce3132292e15c1bdcddc2
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.2.2
1
+ ruby-3.3.6
data/Gemfile CHANGED
@@ -23,11 +23,11 @@ gem 'ruby_audit', '>= 0'
23
23
  ##
24
24
 
25
25
  # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
26
- gem 'rails', '~> 7.1.0'
26
+ gem 'rails', '~> 8.0.0'
27
27
 
28
- # The original asset pipeline for Rails
29
- # [https://github.com/rails/sprockets-rails]
30
- gem 'sprockets-rails'
28
+ # The modern asset pipeline for Rails
29
+ # https://github.com/rails/propshaft
30
+ gem 'propshaft'
31
31
 
32
32
  # Use the Puma web server
33
33
  # [https://github.com/puma/puma]
@@ -51,6 +51,10 @@ gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
51
51
  # Reduces boot times through caching; required in config/boot.rb
52
52
  gem 'bootsnap', require: false
53
53
 
54
+ # Bundle and process CSS
55
+ # https://github.com/rails/cssbundling-rails
56
+ gem 'cssbundling-rails'
57
+
54
58
  # Use Sass to process CSS
55
59
  # gem "sassc-rails"
56
60
 
data/Gemfile.lock CHANGED
@@ -1,128 +1,128 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bellman (0.1.1)
4
+ bellman (0.2.0)
5
5
  activerecord (> 4.2.0)
6
6
  activesupport (> 4.2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (7.1.2)
12
- actionpack (= 7.1.2)
13
- activesupport (= 7.1.2)
11
+ actioncable (8.0.0)
12
+ actionpack (= 8.0.0)
13
+ activesupport (= 8.0.0)
14
14
  nio4r (~> 2.0)
15
15
  websocket-driver (>= 0.6.1)
16
16
  zeitwerk (~> 2.6)
17
- actionmailbox (7.1.2)
18
- actionpack (= 7.1.2)
19
- activejob (= 7.1.2)
20
- activerecord (= 7.1.2)
21
- activestorage (= 7.1.2)
22
- activesupport (= 7.1.2)
23
- mail (>= 2.7.1)
24
- net-imap
25
- net-pop
26
- net-smtp
27
- actionmailer (7.1.2)
28
- actionpack (= 7.1.2)
29
- actionview (= 7.1.2)
30
- activejob (= 7.1.2)
31
- activesupport (= 7.1.2)
32
- mail (~> 2.5, >= 2.5.4)
33
- net-imap
34
- net-pop
35
- net-smtp
17
+ actionmailbox (8.0.0)
18
+ actionpack (= 8.0.0)
19
+ activejob (= 8.0.0)
20
+ activerecord (= 8.0.0)
21
+ activestorage (= 8.0.0)
22
+ activesupport (= 8.0.0)
23
+ mail (>= 2.8.0)
24
+ actionmailer (8.0.0)
25
+ actionpack (= 8.0.0)
26
+ actionview (= 8.0.0)
27
+ activejob (= 8.0.0)
28
+ activesupport (= 8.0.0)
29
+ mail (>= 2.8.0)
36
30
  rails-dom-testing (~> 2.2)
37
- actionpack (7.1.2)
38
- actionview (= 7.1.2)
39
- activesupport (= 7.1.2)
31
+ actionpack (8.0.0)
32
+ actionview (= 8.0.0)
33
+ activesupport (= 8.0.0)
40
34
  nokogiri (>= 1.8.5)
41
- racc
42
35
  rack (>= 2.2.4)
43
36
  rack-session (>= 1.0.1)
44
37
  rack-test (>= 0.6.3)
45
38
  rails-dom-testing (~> 2.2)
46
39
  rails-html-sanitizer (~> 1.6)
47
- actiontext (7.1.2)
48
- actionpack (= 7.1.2)
49
- activerecord (= 7.1.2)
50
- activestorage (= 7.1.2)
51
- activesupport (= 7.1.2)
40
+ useragent (~> 0.16)
41
+ actiontext (8.0.0)
42
+ actionpack (= 8.0.0)
43
+ activerecord (= 8.0.0)
44
+ activestorage (= 8.0.0)
45
+ activesupport (= 8.0.0)
52
46
  globalid (>= 0.6.0)
53
47
  nokogiri (>= 1.8.5)
54
- actionview (7.1.2)
55
- activesupport (= 7.1.2)
48
+ actionview (8.0.0)
49
+ activesupport (= 8.0.0)
56
50
  builder (~> 3.1)
57
51
  erubi (~> 1.11)
58
52
  rails-dom-testing (~> 2.2)
59
53
  rails-html-sanitizer (~> 1.6)
60
- activejob (7.1.2)
61
- activesupport (= 7.1.2)
54
+ activejob (8.0.0)
55
+ activesupport (= 8.0.0)
62
56
  globalid (>= 0.3.6)
63
- activemodel (7.1.2)
64
- activesupport (= 7.1.2)
65
- activerecord (7.1.2)
66
- activemodel (= 7.1.2)
67
- activesupport (= 7.1.2)
57
+ activemodel (8.0.0)
58
+ activesupport (= 8.0.0)
59
+ activerecord (8.0.0)
60
+ activemodel (= 8.0.0)
61
+ activesupport (= 8.0.0)
68
62
  timeout (>= 0.4.0)
69
- activestorage (7.1.2)
70
- actionpack (= 7.1.2)
71
- activejob (= 7.1.2)
72
- activerecord (= 7.1.2)
73
- activesupport (= 7.1.2)
63
+ activestorage (8.0.0)
64
+ actionpack (= 8.0.0)
65
+ activejob (= 8.0.0)
66
+ activerecord (= 8.0.0)
67
+ activesupport (= 8.0.0)
74
68
  marcel (~> 1.0)
75
- activesupport (7.1.2)
69
+ activesupport (8.0.0)
76
70
  base64
71
+ benchmark (>= 0.3)
77
72
  bigdecimal
78
- concurrent-ruby (~> 1.0, >= 1.0.2)
73
+ concurrent-ruby (~> 1.0, >= 1.3.1)
79
74
  connection_pool (>= 2.2.5)
80
75
  drb
81
76
  i18n (>= 1.6, < 2)
77
+ logger (>= 1.4.2)
82
78
  minitest (>= 5.1)
83
- mutex_m
84
- tzinfo (~> 2.0)
85
- addressable (2.8.5)
86
- public_suffix (>= 2.0.2, < 6.0)
79
+ securerandom (>= 0.3)
80
+ tzinfo (~> 2.0, >= 2.0.5)
81
+ uri (>= 0.13.1)
82
+ addressable (2.8.7)
83
+ public_suffix (>= 2.0.2, < 7.0)
87
84
  ast (2.4.2)
88
85
  base64 (0.2.0)
89
- bigdecimal (3.1.4)
90
- bootsnap (1.17.0)
86
+ benchmark (0.4.0)
87
+ bigdecimal (3.1.8)
88
+ bootsnap (1.18.4)
91
89
  msgpack (~> 1.2)
92
- builder (3.2.4)
93
- bundler-audit (0.9.1)
90
+ builder (3.3.0)
91
+ bundler-audit (0.9.2)
94
92
  bundler (>= 1.2.0, < 3)
95
93
  thor (~> 1.0)
96
- capybara (3.39.2)
94
+ capybara (3.40.0)
97
95
  addressable
98
96
  matrix
99
97
  mini_mime (>= 0.1.3)
100
- nokogiri (~> 1.8)
98
+ nokogiri (~> 1.11)
101
99
  rack (>= 1.6.0)
102
100
  rack-test (>= 0.6.3)
103
101
  regexp_parser (>= 1.5, < 3.0)
104
102
  xpath (~> 3.2)
105
- concurrent-ruby (1.2.2)
103
+ concurrent-ruby (1.3.4)
106
104
  connection_pool (2.4.1)
107
105
  crass (1.0.6)
108
- date (3.3.4)
109
- debug (1.8.0)
110
- irb (>= 1.5.0)
111
- reline (>= 0.3.1)
112
- drb (2.2.0)
113
- ruby2_keywords
114
- erubi (1.12.0)
106
+ cssbundling-rails (1.4.1)
107
+ railties (>= 6.0.0)
108
+ date (3.4.1)
109
+ debug (1.9.2)
110
+ irb (~> 1.10)
111
+ reline (>= 0.3.8)
112
+ drb (2.2.1)
113
+ erubi (1.13.0)
115
114
  globalid (1.2.1)
116
115
  activesupport (>= 6.1)
117
- i18n (1.14.1)
116
+ i18n (1.14.6)
118
117
  concurrent-ruby (~> 1.0)
119
- io-console (0.6.0)
120
- irb (1.9.1)
121
- rdoc
122
- reline (>= 0.3.8)
123
- json (2.6.3)
118
+ io-console (0.8.0)
119
+ irb (1.14.1)
120
+ rdoc (>= 4.0.0)
121
+ reline (>= 0.4.2)
122
+ json (2.9.0)
124
123
  language_server-protocol (3.17.0.3)
125
- loofah (2.22.0)
124
+ logger (1.6.2)
125
+ loofah (2.23.1)
126
126
  crass (~> 1.0.2)
127
127
  nokogiri (>= 1.12.0)
128
128
  mail (2.8.1)
@@ -130,158 +130,161 @@ GEM
130
130
  net-imap
131
131
  net-pop
132
132
  net-smtp
133
- marcel (1.0.2)
133
+ marcel (1.0.4)
134
134
  matrix (0.4.2)
135
135
  mini_mime (1.1.5)
136
- minitest (5.20.0)
137
- msgpack (1.7.2)
138
- mutex_m (0.2.0)
139
- net-imap (0.4.7)
136
+ minitest (5.25.4)
137
+ msgpack (1.7.5)
138
+ net-imap (0.5.1)
140
139
  date
141
140
  net-protocol
142
141
  net-pop (0.1.2)
143
142
  net-protocol
144
143
  net-protocol (0.2.2)
145
144
  timeout
146
- net-smtp (0.4.0)
145
+ net-smtp (0.5.0)
147
146
  net-protocol
148
- nio4r (2.6.1)
149
- nokogiri (1.15.5-x86_64-darwin)
147
+ nio4r (2.7.4)
148
+ nokogiri (1.16.8-x86_64-darwin)
150
149
  racc (~> 1.4)
151
- nokogiri (1.15.5-x86_64-linux)
150
+ nokogiri (1.16.8-x86_64-linux)
152
151
  racc (~> 1.4)
153
- parallel (1.23.0)
154
- parser (3.2.2.4)
152
+ parallel (1.26.3)
153
+ parser (3.3.6.0)
155
154
  ast (~> 2.4.1)
156
155
  racc
157
- psych (5.1.1.1)
156
+ propshaft (1.1.0)
157
+ actionpack (>= 7.0.0)
158
+ activesupport (>= 7.0.0)
159
+ rack
160
+ railties (>= 7.0.0)
161
+ psych (5.2.1)
162
+ date
158
163
  stringio
159
- public_suffix (5.0.4)
160
- puma (6.4.0)
164
+ public_suffix (6.0.1)
165
+ puma (6.5.0)
161
166
  nio4r (~> 2.0)
162
- racc (1.7.3)
163
- rack (3.0.8)
167
+ racc (1.8.1)
168
+ rack (3.1.8)
164
169
  rack-session (2.0.0)
165
170
  rack (>= 3.0.0)
166
171
  rack-test (2.1.0)
167
172
  rack (>= 1.3)
168
- rackup (2.1.0)
173
+ rackup (2.2.1)
169
174
  rack (>= 3)
170
- webrick (~> 1.8)
171
- rails (7.1.2)
172
- actioncable (= 7.1.2)
173
- actionmailbox (= 7.1.2)
174
- actionmailer (= 7.1.2)
175
- actionpack (= 7.1.2)
176
- actiontext (= 7.1.2)
177
- actionview (= 7.1.2)
178
- activejob (= 7.1.2)
179
- activemodel (= 7.1.2)
180
- activerecord (= 7.1.2)
181
- activestorage (= 7.1.2)
182
- activesupport (= 7.1.2)
175
+ rails (8.0.0)
176
+ actioncable (= 8.0.0)
177
+ actionmailbox (= 8.0.0)
178
+ actionmailer (= 8.0.0)
179
+ actionpack (= 8.0.0)
180
+ actiontext (= 8.0.0)
181
+ actionview (= 8.0.0)
182
+ activejob (= 8.0.0)
183
+ activemodel (= 8.0.0)
184
+ activerecord (= 8.0.0)
185
+ activestorage (= 8.0.0)
186
+ activesupport (= 8.0.0)
183
187
  bundler (>= 1.15.0)
184
- railties (= 7.1.2)
188
+ railties (= 8.0.0)
185
189
  rails-dom-testing (2.2.0)
186
190
  activesupport (>= 5.0.0)
187
191
  minitest
188
192
  nokogiri (>= 1.6)
189
- rails-html-sanitizer (1.6.0)
193
+ rails-html-sanitizer (1.6.1)
190
194
  loofah (~> 2.21)
191
- nokogiri (~> 1.14)
192
- railties (7.1.2)
193
- actionpack (= 7.1.2)
194
- activesupport (= 7.1.2)
195
- irb
195
+ nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
196
+ railties (8.0.0)
197
+ actionpack (= 8.0.0)
198
+ activesupport (= 8.0.0)
199
+ irb (~> 1.13)
196
200
  rackup (>= 1.0.0)
197
201
  rake (>= 12.2)
198
202
  thor (~> 1.0, >= 1.2.2)
199
203
  zeitwerk (~> 2.6)
200
204
  rainbow (3.1.1)
201
- rake (13.1.0)
202
- rdoc (6.6.0)
205
+ rake (13.2.1)
206
+ rdoc (6.8.1)
203
207
  psych (>= 4.0.0)
204
- redis-client (0.18.0)
208
+ redis-client (0.22.2)
205
209
  connection_pool
206
- regexp_parser (2.8.2)
207
- reline (0.4.1)
210
+ regexp_parser (2.9.3)
211
+ reline (0.5.12)
208
212
  io-console (~> 0.5)
209
- rexml (3.2.6)
210
- rubocop (1.57.2)
213
+ rexml (3.3.9)
214
+ rubocop (1.69.1)
211
215
  json (~> 2.3)
212
216
  language_server-protocol (>= 3.17.0)
213
217
  parallel (~> 1.10)
214
- parser (>= 3.2.2.4)
218
+ parser (>= 3.3.0.2)
215
219
  rainbow (>= 2.2.2, < 4.0)
216
- regexp_parser (>= 1.8, < 3.0)
217
- rexml (>= 3.2.5, < 4.0)
218
- rubocop-ast (>= 1.28.1, < 2.0)
220
+ regexp_parser (>= 2.9.3, < 3.0)
221
+ rubocop-ast (>= 1.36.2, < 2.0)
219
222
  ruby-progressbar (~> 1.7)
220
- unicode-display_width (>= 2.4.0, < 3.0)
221
- rubocop-ast (1.30.0)
222
- parser (>= 3.2.1.0)
223
- rubocop-minitest (0.33.0)
224
- rubocop (>= 1.39, < 2.0)
225
- rubocop-performance (1.19.1)
226
- rubocop (>= 1.7.0, < 2.0)
227
- rubocop-ast (>= 0.4.0)
228
- rubocop-rails (2.22.2)
223
+ unicode-display_width (>= 2.4.0, < 4.0)
224
+ rubocop-ast (1.36.2)
225
+ parser (>= 3.3.1.0)
226
+ rubocop-minitest (0.36.0)
227
+ rubocop (>= 1.61, < 2.0)
228
+ rubocop-ast (>= 1.31.1, < 2.0)
229
+ rubocop-performance (1.23.0)
230
+ rubocop (>= 1.48.1, < 2.0)
231
+ rubocop-ast (>= 1.31.1, < 2.0)
232
+ rubocop-rails (2.27.0)
229
233
  activesupport (>= 4.2.0)
230
234
  rack (>= 1.1)
231
- rubocop (>= 1.33.0, < 2.0)
232
- rubocop-ast (>= 1.30.0, < 2.0)
235
+ rubocop (>= 1.52.0, < 2.0)
236
+ rubocop-ast (>= 1.31.1, < 2.0)
233
237
  rubocop-rake (0.6.0)
234
238
  rubocop (~> 1.0)
235
239
  ruby-progressbar (1.13.0)
236
- ruby2_keywords (0.0.5)
237
- ruby_audit (2.2.0)
240
+ ruby_audit (2.3.1)
238
241
  bundler-audit (~> 0.9.0)
239
242
  rubyzip (2.3.2)
243
+ securerandom (0.4.0)
240
244
  selenium-webdriver (4.10.0)
241
245
  rexml (~> 3.2, >= 3.2.5)
242
246
  rubyzip (>= 1.2.2, < 3.0)
243
247
  websocket (~> 1.0)
244
- sentry-rails (5.14.0)
248
+ sentry-rails (5.22.0)
245
249
  railties (>= 5.0)
246
- sentry-ruby (~> 5.14.0)
247
- sentry-ruby (5.14.0)
250
+ sentry-ruby (~> 5.22.0)
251
+ sentry-ruby (5.22.0)
252
+ bigdecimal
248
253
  concurrent-ruby (~> 1.0, >= 1.0.2)
249
- sentry-sidekiq (5.14.0)
250
- sentry-ruby (~> 5.14.0)
254
+ sentry-sidekiq (5.22.0)
255
+ sentry-ruby (~> 5.22.0)
251
256
  sidekiq (>= 3.0)
252
- sidekiq (7.2.0)
253
- concurrent-ruby (< 2)
257
+ sidekiq (7.3.6)
254
258
  connection_pool (>= 2.3.0)
259
+ logger
255
260
  rack (>= 2.2.4)
256
- redis-client (>= 0.14.0)
257
- sprockets (4.2.1)
258
- concurrent-ruby (~> 1.0)
259
- rack (>= 2.2.4, < 4)
260
- sprockets-rails (3.4.2)
261
- actionpack (>= 5.2)
262
- activesupport (>= 5.2)
263
- sprockets (>= 3.0.0)
264
- stringio (3.1.0)
265
- thor (1.3.0)
266
- timeout (0.4.1)
261
+ redis-client (>= 0.22.2)
262
+ stringio (3.1.2)
263
+ thor (1.3.2)
264
+ timeout (0.4.2)
267
265
  tzinfo (2.0.6)
268
266
  concurrent-ruby (~> 1.0)
269
- unicode-display_width (2.5.0)
267
+ unicode-display_width (3.1.2)
268
+ unicode-emoji (~> 4.0, >= 4.0.4)
269
+ unicode-emoji (4.0.4)
270
+ uri (1.0.2)
271
+ useragent (0.16.11)
270
272
  webdrivers (5.3.1)
271
273
  nokogiri (~> 1.6)
272
274
  rubyzip (>= 1.3.0)
273
275
  selenium-webdriver (~> 4.0, < 4.11)
274
- webrick (1.8.1)
275
- websocket (1.2.10)
276
+ websocket (1.2.11)
276
277
  websocket-driver (0.7.6)
277
278
  websocket-extensions (>= 0.1.0)
278
279
  websocket-extensions (0.1.5)
279
280
  xpath (3.2.0)
280
281
  nokogiri (~> 1.8)
281
- zeitwerk (2.6.12)
282
+ zeitwerk (2.7.1)
282
283
 
283
284
  PLATFORMS
284
285
  x86_64-darwin-22
286
+ x86_64-darwin-23
287
+ x86_64-darwin-24
285
288
  x86_64-linux
286
289
 
287
290
  DEPENDENCIES
@@ -290,10 +293,12 @@ DEPENDENCIES
290
293
  bundler (~> 2.3)
291
294
  bundler-audit
292
295
  capybara
296
+ cssbundling-rails
293
297
  debug
294
298
  minitest (~> 5.0)
299
+ propshaft
295
300
  puma (~> 6.0)
296
- rails (~> 7.1.0)
301
+ rails (~> 8.0.0)
297
302
  rake (~> 13.0)
298
303
  rubocop (~> 1.21)
299
304
  rubocop-minitest
@@ -306,9 +311,8 @@ DEPENDENCIES
306
311
  sentry-ruby
307
312
  sentry-sidekiq
308
313
  sidekiq
309
- sprockets-rails
310
314
  tzinfo-data
311
315
  webdrivers
312
316
 
313
317
  BUNDLED WITH
314
- 2.4.10
318
+ 2.5.23
data/README.md CHANGED
@@ -81,6 +81,12 @@ For example, here is a common configuration for when an application uses the Rai
81
81
  ```ruby
82
82
  Bellman.configure do |config|
83
83
  config.default_severity = :error
84
+
85
+ # Anything other than :raise will set the severity level to the default
86
+ # severity if an unkown one is past. By default Bellman will raise an error
87
+ # so that you can catch your mistakes in development
88
+ config.on_unknown_severity = :raise
89
+
84
90
  config.handlers = [
85
91
  {
86
92
  id: :log,
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ Rake::TestTask.new(:test) do |t|
14
14
  # to the dummy Rails app so that we can test the Rails specific handlers
15
15
  # in the context of a Rails app. See the `generate_dummy_rails_app` for
16
16
  # more details
17
- t.test_files = \
17
+ t.test_files =
18
18
  FileList['test/**/*_test.rb'].exclude('test/rails/**/*_test.rb')
19
19
  end
20
20
 
@@ -19,6 +19,7 @@ module Bellman
19
19
  # Set the defaults
20
20
  config.severities = %i[debug info warn error fatal].freeze
21
21
  config.default_severity = :error
22
+ config.on_unknown_severity = :raise
22
23
  config.handlers = [
23
24
  {
24
25
  id: :log,
@@ -38,12 +39,12 @@ module Bellman
38
39
  @handler = Handlers::Handler.new
39
40
  end
40
41
 
41
- def self.handler
42
- @handler
43
- end
44
-
45
- def self.error_handler(id:)
46
- @handler.handlers.find { |hndlr| hndlr[:id] == id.to_sym }
42
+ def self.handler(id: nil)
43
+ if id.nil?
44
+ @handler
45
+ else
46
+ @handler.handlers.find { |hndlr| hndlr[:id] == id.to_sym }
47
+ end
47
48
  end
48
49
 
49
50
  # rubocop:disable Metrics/ParameterLists
@@ -14,10 +14,7 @@ module Bellman
14
14
  # rubocop:disable Metrics/ParameterLists
15
15
  def handle(error, severity: :error, trace_id: nil, objects: nil,
16
16
  data: nil, include_backtrace: false, handlers: nil)
17
- unless Bellman.config.severities.include?(severity)
18
- severity = Bellman.config.default_severity
19
- end
20
-
17
+ severity = handle_severity(severity)
21
18
  handlers = if handlers.present?
22
19
  process_handlers_config(handlers)
23
20
  else
@@ -43,6 +40,16 @@ module Bellman
43
40
 
44
41
  private
45
42
 
43
+ def handle_severity(severity)
44
+ return severity if Bellman.config.severities.include?(severity)
45
+ if Bellman.config.on_unknown_severity != :raise
46
+ return Bellman.config.default_severity
47
+ end
48
+
49
+ raise "Unknown severity level #{severity}. " \
50
+ "Must be one of #{Bellman.config.severities}"
51
+ end
52
+
46
53
  def process_handlers_config(configs)
47
54
  configs.map { |config| process_handler_config(config) }
48
55
  end
@@ -68,7 +75,7 @@ module Bellman
68
75
  config[:class].new(**config[:params])
69
76
  end
70
77
  elsif config[:id]
71
- config = Bellman.error_handler(config[:id])
78
+ config = Bellman.handler(config[:id])
72
79
  config[:handler] = if config[:params].blank?
73
80
  config[:class].new
74
81
  else
@@ -88,12 +95,12 @@ module Bellman
88
95
 
89
96
  case config
90
97
  when Symbol
91
- handler = Bellman.error_handler(id: config)
98
+ handler = Bellman.handler(id: config)
92
99
  return handler if handler
93
100
  when String
94
101
  # If the string matches the ID of a handler defined in the Bellman
95
102
  # default config, return that.
96
- handler = Bellman.error_handler(id: config.to_sym)
103
+ handler = Bellman.handler(id: config.to_sym)
97
104
  return handler if handler
98
105
 
99
106
  # rubocop:disable Lint/SuppressedException
@@ -47,9 +47,21 @@ module Bellman
47
47
  private
48
48
 
49
49
  def set_sentry_context(scope, objects)
50
+ # We are organizing the objects by class so that we can send the data
51
+ # on a per class basis. Note, we cannot just loop over the objects
52
+ # if we are using the class name as the key since this would mean that
53
+ # any time there are multiple objects of the same type, we'd only send
54
+ # the data for the last one as it would overwrite the data.
55
+ h = {}
50
56
  objects.each do |object|
57
+ key = object.class.name
58
+ h[key] = [] unless h.key?(key)
59
+ h[key] << object
60
+ end
61
+
62
+ h.each do |key, obj_array|
51
63
  scope.set_context(
52
- object.class.name, { id: object.id }
64
+ key, { ids: obj_array.map(&:id) }
53
65
  )
54
66
  end
55
67
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bellman
4
- VERSION = '0.1.1'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bellman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick R. Schmid
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-30 00:00:00.000000000 Z
11
+ date: 2024-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -54,7 +54,6 @@ files:
54
54
  - LICENSE.txt
55
55
  - README.md
56
56
  - Rakefile
57
- - bellman.gemspec
58
57
  - lib/bellman.rb
59
58
  - lib/bellman/bellman.rb
60
59
  - lib/bellman/handlers/base_handler.rb
@@ -78,14 +77,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
77
  requirements:
79
78
  - - ">="
80
79
  - !ruby/object:Gem::Version
81
- version: '3.2'
80
+ version: '3.3'
82
81
  required_rubygems_version: !ruby/object:Gem::Requirement
83
82
  requirements:
84
83
  - - ">="
85
84
  - !ruby/object:Gem::Version
86
85
  version: '0'
87
86
  requirements: []
88
- rubygems_version: 3.4.10
87
+ rubygems_version: 3.5.22
89
88
  signing_key:
90
89
  specification_version: 4
91
90
  summary: Unified way to take all of the log messages and direct them to the right
data/bellman.gemspec DELETED
@@ -1,46 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'bellman/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = 'bellman'
9
- spec.version = Bellman::VERSION
10
- spec.authors = ['Patrick R. Schmid']
11
- spec.email = ['prschmid@gmail.com']
12
-
13
- spec.summary = 'Unified way to take all of the log messages and direct them to the right place.'
14
- spec.description = 'Unified way to take all of the log messages and direct them to the right place.'
15
- spec.homepage = 'https://github.com/prschmid/bellman'
16
- spec.license = 'MIT'
17
-
18
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the
19
- # 'allowed_push_host' to allow pushing to a single host or delete this
20
- # section to allow pushing to any host.
21
- if spec.respond_to?(:metadata)
22
- spec.metadata['homepage_uri'] = spec.homepage
23
- spec.metadata['source_code_uri'] = 'https://github.com/prschmid/bellman'
24
- spec.metadata['changelog_uri'] = 'https://github.com/prschmid/bellman'
25
- else
26
- raise 'RubyGems 2.0 or newer is required to protect against ' \
27
- 'public gem pushes.'
28
- end
29
-
30
- # Specify which files should be added to the gem when it is released.
31
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
- spec.files = Dir.chdir(__dir__) do
33
- `git ls-files -z`.split("\x0").reject do |f|
34
- (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
35
- end
36
- end
37
- spec.bindir = 'exe'
38
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
39
- spec.require_paths = ['lib']
40
-
41
- spec.required_ruby_version = '>= 3.2'
42
-
43
- spec.add_runtime_dependency('activerecord', '> 4.2.0')
44
- spec.add_runtime_dependency('activesupport', '> 4.2.0')
45
- spec.metadata['rubygems_mfa_required'] = 'true'
46
- end