getaround_utils 0.2.37 → 0.3.1

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: ef85783014358aa9de1a8e177a58dbf5f8df596583f8caeb73d5490638a91f8f
4
- data.tar.gz: f10368811d122f9a54a451e29abcdf527c3d6d86e1c634ded313860dc910c667
3
+ metadata.gz: e8229adb825c1d60f82dbf661e85bf31088640c7d1260d63993b95b674939817
4
+ data.tar.gz: ae12f1034bf7efbf90a8d206fd298e0eb23b2e356f6be713e64068d65bcd69cc
5
5
  SHA512:
6
- metadata.gz: 5ce5ae96d95d0d57a9dd3ba2203e3593d38c7dd37147641af60da821307ad0fb6f3e52c0982f72f593d8f574c36d9ec34705a3444c78432874b6c233065793ff
7
- data.tar.gz: b59465dbc69f32174b784d6e3c29e643b52a5376c642bfb291c0a304677007d802fb36c256925a238f5f29092a3fc397ce4923acfdada529029d20464c21b474
6
+ metadata.gz: '09415cfd824c79234e662ce02ca9195ef330a6ed52e64035d0d596856ffb3d76d84dcb8d27ac8670ac2c03be87bdff7f946f6d34703ea6ddafbd7b64fbf89e94'
7
+ data.tar.gz: d343fe8e41a279794644f5cf386380691af2ad3ab6c0e9d48056726ee96dacf3103c9c865d1a9fbb14c955fd721bcffd721cfc930cb15b8c2e66f215612a567c
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-3.3.5
1
+ ruby-4.0.1
data/CHANGELOG.md ADDED
@@ -0,0 +1,42 @@
1
+ ## [0.3.1] 2026-02-18
2
+ - In `GetaroundUtils::Engines::Health` ignore Heroku, add ArgoCD
3
+
4
+ ## [0.3.0] 2026-01-22
5
+ - Update Ruby to 4.0.1
6
+ - Update dependencies
7
+
8
+ ## [0.2.38] 2025-11-19
9
+
10
+ ### Added
11
+
12
+ - `GetaroundUtils::Utils::HandleError` ([#433](https://github.com/drivy/backend-configs/pull/433))
13
+ ```ruby
14
+ module MyApp::Errors
15
+ def self.handle(error, **)
16
+ GetaroundUtils::Utils::HandleError.notify_of(error, **) do |report|
17
+ report.grouping_hash = 'hello-world' # Bugsnag example
18
+ end
19
+ end
20
+ end
21
+ ```
22
+ - `GetaroundUtils::Utils::ConfigUrl` ([#432](https://github.com/drivy/backend-configs/pull/432))
23
+ ```ruby
24
+ # FOO_URL="redis://foo@localhost:666/10"
25
+ # FOO_PASSWORD="added-pwd"
26
+ # BAR_URL="whatever://bar:used-pwd@localhost:666/42"
27
+ # BAR_PASSWORD="not-used-pwd"
28
+ # ENV_TEST_NUMBER=1
29
+
30
+ GetaroundUtils::Utils::ConfigUrl
31
+ .from_env('FOO')
32
+ .tap { |uri| uri.path += ENV['ENV_TEST_NUMBER'] }
33
+ # => <URI::Generic redis://foo:added-pwd@localhost:666/101>
34
+ GetaroundUtils::Utils::ConfigUrl.from_env('BAR').to_s
35
+ # => "whatever://bar:used-pwd@localhost:666/42"
36
+ GetaroundUtils::Utils::ConfigUrl.from_env('UNKNOWN')
37
+ # => KeyError: key not found "UNKNOWN_URL"
38
+ GetaroundUtils::Utils::ConfigUrl.from_env('UNKNOWN', 'mysql://localhost/test')
39
+ # => <URI::Generic mysql://localhost/test>
40
+ GetaroundUtils::Utils::ConfigUrl.from_env('UNKNOWN') { GetaroundUtils::Utils::ConfigUrl.from_env('BAZ') }
41
+ # => KeyError: key not found "BAZ_URL"
42
+ ```
data/Gemfile.lock CHANGED
@@ -1,71 +1,73 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- getaround_utils (0.2.37)
4
+ getaround_utils (0.3.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- actioncable (7.2.2.1)
10
- actionpack (= 7.2.2.1)
11
- activesupport (= 7.2.2.1)
9
+ actioncable (7.2.3)
10
+ actionpack (= 7.2.3)
11
+ activesupport (= 7.2.3)
12
12
  nio4r (~> 2.0)
13
13
  websocket-driver (>= 0.6.1)
14
14
  zeitwerk (~> 2.6)
15
- actionmailbox (7.2.2.1)
16
- actionpack (= 7.2.2.1)
17
- activejob (= 7.2.2.1)
18
- activerecord (= 7.2.2.1)
19
- activestorage (= 7.2.2.1)
20
- activesupport (= 7.2.2.1)
15
+ actionmailbox (7.2.3)
16
+ actionpack (= 7.2.3)
17
+ activejob (= 7.2.3)
18
+ activerecord (= 7.2.3)
19
+ activestorage (= 7.2.3)
20
+ activesupport (= 7.2.3)
21
21
  mail (>= 2.8.0)
22
- actionmailer (7.2.2.1)
23
- actionpack (= 7.2.2.1)
24
- actionview (= 7.2.2.1)
25
- activejob (= 7.2.2.1)
26
- activesupport (= 7.2.2.1)
22
+ actionmailer (7.2.3)
23
+ actionpack (= 7.2.3)
24
+ actionview (= 7.2.3)
25
+ activejob (= 7.2.3)
26
+ activesupport (= 7.2.3)
27
27
  mail (>= 2.8.0)
28
28
  rails-dom-testing (~> 2.2)
29
- actionpack (7.2.2.1)
30
- actionview (= 7.2.2.1)
31
- activesupport (= 7.2.2.1)
29
+ actionpack (7.2.3)
30
+ actionview (= 7.2.3)
31
+ activesupport (= 7.2.3)
32
+ cgi
32
33
  nokogiri (>= 1.8.5)
33
34
  racc
34
- rack (>= 2.2.4, < 3.2)
35
+ rack (>= 2.2.4, < 3.3)
35
36
  rack-session (>= 1.0.1)
36
37
  rack-test (>= 0.6.3)
37
38
  rails-dom-testing (~> 2.2)
38
39
  rails-html-sanitizer (~> 1.6)
39
40
  useragent (~> 0.16)
40
- actiontext (7.2.2.1)
41
- actionpack (= 7.2.2.1)
42
- activerecord (= 7.2.2.1)
43
- activestorage (= 7.2.2.1)
44
- activesupport (= 7.2.2.1)
41
+ actiontext (7.2.3)
42
+ actionpack (= 7.2.3)
43
+ activerecord (= 7.2.3)
44
+ activestorage (= 7.2.3)
45
+ activesupport (= 7.2.3)
45
46
  globalid (>= 0.6.0)
46
47
  nokogiri (>= 1.8.5)
47
- actionview (7.2.2.1)
48
- activesupport (= 7.2.2.1)
48
+ actionview (7.2.3)
49
+ activesupport (= 7.2.3)
49
50
  builder (~> 3.1)
51
+ cgi
50
52
  erubi (~> 1.11)
51
53
  rails-dom-testing (~> 2.2)
52
54
  rails-html-sanitizer (~> 1.6)
53
- activejob (7.2.2.1)
54
- activesupport (= 7.2.2.1)
55
+ activejob (7.2.3)
56
+ activesupport (= 7.2.3)
55
57
  globalid (>= 0.3.6)
56
- activemodel (7.2.2.1)
57
- activesupport (= 7.2.2.1)
58
- activerecord (7.2.2.1)
59
- activemodel (= 7.2.2.1)
60
- activesupport (= 7.2.2.1)
58
+ activemodel (7.2.3)
59
+ activesupport (= 7.2.3)
60
+ activerecord (7.2.3)
61
+ activemodel (= 7.2.3)
62
+ activesupport (= 7.2.3)
61
63
  timeout (>= 0.4.0)
62
- activestorage (7.2.2.1)
63
- actionpack (= 7.2.2.1)
64
- activejob (= 7.2.2.1)
65
- activerecord (= 7.2.2.1)
66
- activesupport (= 7.2.2.1)
64
+ activestorage (7.2.3)
65
+ actionpack (= 7.2.3)
66
+ activejob (= 7.2.3)
67
+ activerecord (= 7.2.3)
68
+ activesupport (= 7.2.3)
67
69
  marcel (~> 1.0)
68
- activesupport (7.2.2.1)
70
+ activesupport (7.2.3)
69
71
  base64
70
72
  benchmark (>= 0.3)
71
73
  bigdecimal
@@ -77,26 +79,27 @@ GEM
77
79
  minitest (>= 5.1)
78
80
  securerandom (>= 0.3)
79
81
  tzinfo (~> 2.0, >= 2.0.5)
80
- addressable (2.8.7)
81
- public_suffix (>= 2.0.2, < 7.0)
82
+ addressable (2.8.8)
83
+ public_suffix (>= 2.0.2, < 8.0)
82
84
  ast (2.4.3)
83
85
  base64 (0.3.0)
84
86
  benchmark (0.4.1)
85
- bigdecimal (3.2.2)
87
+ bigdecimal (4.0.1)
86
88
  builder (3.3.0)
87
- concurrent-ruby (1.3.5)
88
- connection_pool (2.5.3)
89
- crack (1.0.0)
89
+ cgi (0.5.1)
90
+ concurrent-ruby (1.3.6)
91
+ connection_pool (3.0.2)
92
+ crack (1.0.1)
90
93
  bigdecimal
91
94
  rexml
92
95
  crass (1.0.6)
93
- date (3.4.1)
96
+ date (3.5.1)
94
97
  diff-lcs (1.6.2)
95
- dotenv (3.1.8)
98
+ dotenv (3.2.0)
96
99
  drb (2.2.3)
97
- erb (5.0.2)
100
+ erb (6.0.1)
98
101
  erubi (1.13.1)
99
- getaround-rubocop (0.2.11)
102
+ getaround-rubocop (0.3.1)
100
103
  relaxed-rubocop (~> 2.5)
101
104
  rubocop (~> 1.0)
102
105
  rubocop-performance (~> 1.0)
@@ -104,15 +107,15 @@ GEM
104
107
  rubocop-rspec (~> 3.0)
105
108
  globalid (1.2.1)
106
109
  activesupport (>= 6.1)
107
- hashdiff (1.2.0)
110
+ hashdiff (1.2.1)
108
111
  i18n (1.14.7)
109
112
  concurrent-ruby (~> 1.0)
110
- io-console (0.8.1)
111
- irb (1.15.2)
113
+ io-console (0.8.2)
114
+ irb (1.16.0)
112
115
  pp (>= 0.6.0)
113
116
  rdoc (>= 4.0.0)
114
117
  reline (>= 0.4.2)
115
- json (2.13.1)
118
+ json (2.18.0)
116
119
  language_server-protocol (3.17.0.5)
117
120
  lint_roller (1.1.0)
118
121
  logger (1.7.0)
@@ -132,7 +135,7 @@ GEM
132
135
  marcel (1.0.4)
133
136
  mini_mime (1.1.5)
134
137
  mini_portile2 (2.8.9)
135
- minitest (5.25.5)
138
+ minitest (5.27.0)
136
139
  net-imap (0.5.8)
137
140
  date
138
141
  net-protocol
@@ -150,19 +153,19 @@ GEM
150
153
  ougai (2.0.0)
151
154
  oj (~> 3.10)
152
155
  parallel (1.27.0)
153
- parser (3.3.9.0)
156
+ parser (3.3.10.1)
154
157
  ast (~> 2.4.1)
155
158
  racc
156
- pp (0.6.2)
159
+ pp (0.6.3)
157
160
  prettyprint
158
161
  prettyprint (0.2.0)
159
- prism (1.4.0)
160
- psych (5.2.6)
162
+ prism (1.8.0)
163
+ psych (5.3.1)
161
164
  date
162
165
  stringio
163
- public_suffix (6.0.2)
166
+ public_suffix (7.0.2)
164
167
  racc (1.8.1)
165
- rack (3.1.16)
168
+ rack (3.2.4)
166
169
  rack-session (2.1.1)
167
170
  base64 (>= 0.1.0)
168
171
  rack (>= 3.0.0)
@@ -170,20 +173,20 @@ GEM
170
173
  rack (>= 1.3)
171
174
  rackup (2.2.1)
172
175
  rack (>= 3)
173
- rails (7.2.2.1)
174
- actioncable (= 7.2.2.1)
175
- actionmailbox (= 7.2.2.1)
176
- actionmailer (= 7.2.2.1)
177
- actionpack (= 7.2.2.1)
178
- actiontext (= 7.2.2.1)
179
- actionview (= 7.2.2.1)
180
- activejob (= 7.2.2.1)
181
- activemodel (= 7.2.2.1)
182
- activerecord (= 7.2.2.1)
183
- activestorage (= 7.2.2.1)
184
- activesupport (= 7.2.2.1)
176
+ rails (7.2.3)
177
+ actioncable (= 7.2.3)
178
+ actionmailbox (= 7.2.3)
179
+ actionmailer (= 7.2.3)
180
+ actionpack (= 7.2.3)
181
+ actiontext (= 7.2.3)
182
+ actionview (= 7.2.3)
183
+ activejob (= 7.2.3)
184
+ activemodel (= 7.2.3)
185
+ activerecord (= 7.2.3)
186
+ activestorage (= 7.2.3)
187
+ activesupport (= 7.2.3)
185
188
  bundler (>= 1.15.0)
186
- railties (= 7.2.2.1)
189
+ railties (= 7.2.3)
187
190
  rails-dom-testing (2.3.0)
188
191
  activesupport (>= 5.0.0)
189
192
  minitest
@@ -191,41 +194,44 @@ GEM
191
194
  rails-html-sanitizer (1.6.2)
192
195
  loofah (~> 2.21)
193
196
  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)
194
- railties (7.2.2.1)
195
- actionpack (= 7.2.2.1)
196
- activesupport (= 7.2.2.1)
197
+ railties (7.2.3)
198
+ actionpack (= 7.2.3)
199
+ activesupport (= 7.2.3)
200
+ cgi
197
201
  irb (~> 1.13)
198
202
  rackup (>= 1.0.0)
199
203
  rake (>= 12.2)
200
204
  thor (~> 1.0, >= 1.2.2)
205
+ tsort (>= 0.2)
201
206
  zeitwerk (~> 2.6)
202
207
  rainbow (3.1.1)
203
- rake (13.3.0)
204
- rdoc (6.14.2)
208
+ rake (13.3.1)
209
+ rdoc (7.1.0)
205
210
  erb
206
211
  psych (>= 4.0.0)
207
- redis-client (0.14.1)
212
+ tsort
213
+ redis-client (0.26.3)
208
214
  connection_pool
209
- regexp_parser (2.10.0)
215
+ regexp_parser (2.11.3)
210
216
  relaxed-rubocop (2.5)
211
- reline (0.6.2)
217
+ reline (0.6.3)
212
218
  io-console (~> 0.5)
213
219
  request_store (1.7.0)
214
220
  rack (>= 1.4)
215
- rexml (3.4.1)
216
- rspec (3.13.1)
221
+ rexml (3.4.4)
222
+ rspec (3.13.2)
217
223
  rspec-core (~> 3.13.0)
218
224
  rspec-expectations (~> 3.13.0)
219
225
  rspec-mocks (~> 3.13.0)
220
- rspec-core (3.13.5)
226
+ rspec-core (3.13.6)
221
227
  rspec-support (~> 3.13.0)
222
228
  rspec-expectations (3.13.5)
223
229
  diff-lcs (>= 1.2.0, < 2.0)
224
230
  rspec-support (~> 3.13.0)
225
- rspec-mocks (3.13.5)
231
+ rspec-mocks (3.13.7)
226
232
  diff-lcs (>= 1.2.0, < 2.0)
227
233
  rspec-support (~> 3.13.0)
228
- rspec-rails (8.0.1)
234
+ rspec-rails (8.0.2)
229
235
  actionpack (>= 7.2)
230
236
  activesupport (>= 7.2)
231
237
  railties (>= 7.2)
@@ -233,8 +239,8 @@ GEM
233
239
  rspec-expectations (~> 3.13)
234
240
  rspec-mocks (~> 3.13)
235
241
  rspec-support (~> 3.13)
236
- rspec-support (3.13.4)
237
- rubocop (1.79.0)
242
+ rspec-support (3.13.6)
243
+ rubocop (1.82.1)
238
244
  json (~> 2.3)
239
245
  language_server-protocol (~> 3.17.0.2)
240
246
  lint_roller (~> 1.1.0)
@@ -242,13 +248,12 @@ GEM
242
248
  parser (>= 3.3.0.2)
243
249
  rainbow (>= 2.2.2, < 4.0)
244
250
  regexp_parser (>= 2.9.3, < 3.0)
245
- rubocop-ast (>= 1.46.0, < 2.0)
251
+ rubocop-ast (>= 1.48.0, < 2.0)
246
252
  ruby-progressbar (~> 1.7)
247
- tsort (>= 0.2.0)
248
253
  unicode-display_width (>= 2.4.0, < 4.0)
249
- rubocop-ast (1.46.0)
254
+ rubocop-ast (1.49.0)
250
255
  parser (>= 3.3.7.2)
251
- prism (~> 1.4)
256
+ prism (~> 1.7)
252
257
  rubocop-performance (1.25.0)
253
258
  lint_roller (~> 1.1)
254
259
  rubocop (>= 1.75.0, < 2.0)
@@ -264,22 +269,23 @@ GEM
264
269
  rubocop (~> 1.72, >= 1.72.1)
265
270
  ruby-progressbar (1.13.0)
266
271
  securerandom (0.4.1)
267
- sidekiq (7.0.9)
268
- concurrent-ruby (< 2)
269
- connection_pool (>= 2.3.0)
270
- rack (>= 2.2.4)
271
- redis-client (>= 0.11.0)
272
- stringio (3.1.7)
272
+ sidekiq (8.1.0)
273
+ connection_pool (>= 3.0.0)
274
+ json (>= 2.16.0)
275
+ logger (>= 1.7.0)
276
+ rack (>= 3.2.0)
277
+ redis-client (>= 0.26.0)
278
+ stringio (3.2.0)
273
279
  thor (1.4.0)
274
280
  timeout (0.4.3)
275
281
  tsort (0.2.0)
276
282
  tzinfo (2.0.6)
277
283
  concurrent-ruby (~> 1.0)
278
- unicode-display_width (3.1.4)
279
- unicode-emoji (~> 4.0, >= 4.0.4)
280
- unicode-emoji (4.0.4)
284
+ unicode-display_width (3.2.0)
285
+ unicode-emoji (~> 4.1)
286
+ unicode-emoji (4.2.0)
281
287
  useragent (0.16.11)
282
- webmock (3.25.1)
288
+ webmock (3.26.1)
283
289
  addressable (>= 2.8.0)
284
290
  crack (>= 0.3.2)
285
291
  hashdiff (>= 0.4.0, < 2.0.0)
@@ -293,8 +299,8 @@ PLATFORMS
293
299
  ruby
294
300
 
295
301
  DEPENDENCIES
296
- dotenv (~> 3.1.8)
297
- getaround-rubocop (= 0.2.11)
302
+ dotenv (~> 3.2.0)
303
+ getaround-rubocop (= 0.3.1)
298
304
  getaround_utils!
299
305
  irb (~> 1.15)
300
306
  lograge (~> 0.14.0)
@@ -304,9 +310,9 @@ DEPENDENCIES
304
310
  rake (~> 13.2)
305
311
  rspec (~> 3.13)
306
312
  rspec-rails (~> 8.0)
307
- rubocop (~> 1.79.0)
313
+ rubocop (~> 1.82.1)
308
314
  sidekiq (> 7.0)
309
315
  webmock (~> 3.25)
310
316
 
311
317
  BUNDLED WITH
312
- 2.4.22
318
+ 4.0.4
data/README.md CHANGED
@@ -49,6 +49,44 @@ require 'getaround_utils/railties/ougai'
49
49
 
50
50
  For more details, [read the spec](spec/getaround_utils/railties/ougai_spec.rb)
51
51
 
52
+ ## Engines
53
+
54
+ ### GetaroundUtils::Engine::Health
55
+
56
+ - Exposes the currently deployed release version:
57
+ - `GetaroundUtils::Engine::Health.release_version`
58
+ - Exposes the currently deployed commit SHA1:
59
+ - `GetaroundUtils::Engine::Health.commit_sha1`
60
+ - Provides a `Rack` application to expose "health" endpoints (used by Shipit)
61
+ - `GET /release_version`
62
+ - `GET /commit_sha1`
63
+ - `GET /migration_status`
64
+
65
+ The engine can be mounted in a Rails application:
66
+ ```ruby
67
+ # config/routes.rb
68
+ require 'getaround_utils/engines/health'
69
+
70
+ Rails.application.routes.draw do
71
+ mount GetaroundUtils::Engines::Health.engine, at: '/health'
72
+ # ...
73
+ end
74
+ ```
75
+
76
+ Or in a simple `Rack` application:
77
+ ```ruby
78
+ # config.ru
79
+ require 'getaround_utils/engines/health'
80
+
81
+ run Rack::Builder.new {
82
+ map '/health' do
83
+ run GetaroundUtils::Engines::Health.engine
84
+ end
85
+ # ...
86
+ }
87
+ ```
88
+ *This will generates `/health/release_version`, `/health/commit_sha1` and `/health/migration_status` endpoints*
89
+
52
90
  ## Mixins
53
91
 
54
92
  ### GetaroundUtils::Mixins::Loggable
@@ -100,11 +138,62 @@ For more details, [read the spec](spec/getaround_utils/mixins/loggable_spec.rb#L
100
138
 
101
139
  ## Misc
102
140
 
103
- ### GetaroundUtils::LogFormatters::DeepKeyValue
141
+ ### GetaroundUtils::Utils::DeepKeyValue
104
142
 
105
143
  This log formatter will serialize an object of any depth into a key-value string.
106
144
  It supports basic scalars (ie: `Hash`,`Array`,`Numeric`,`String`) and will call "#inspect" for any other type.
107
145
 
108
- For more details, [read the spec](spec/getaround_utils/log_formatters/deep_key_value_spec.rb)
146
+ For more details, [read the spec](spec/getaround_utils/utils/deep_key_value_spec.rb)
147
+
148
+ ### GetaroundUtils::Utils::ConfigUrl
149
+
150
+ This helper allows to manage configuration urls with password extracted in a dedicated variable.
109
151
 
152
+ It uses `*_URL` variable and tries to compute `*_PASSWORD` inside the parsed url.
153
+
154
+ ```ruby
155
+ # FOO_URL="redis://foo@localhost:666/10"
156
+ # FOO_PASSWORD="added-pwd"
157
+ # BAR_URL="whatever://bar:used-pwd@localhost:666/42"
158
+ # BAR_PASSWORD="not-used-pwd"
159
+ # ENV_TEST_NUMBER=1
160
+
161
+ GetaroundUtils::Utils::ConfigUrl
162
+ .from_env('FOO')
163
+ .tap { |uri| uri.path += ENV['ENV_TEST_NUMBER'] }
164
+ # => <URI::Generic redis://foo:added-pwd@localhost:666/101>
165
+ GetaroundUtils::Utils::ConfigUrl.from_env('BAR').to_s
166
+ # => "whatever://bar:used-pwd@localhost:666/42"
167
+ GetaroundUtils::Utils::ConfigUrl.from_env('UNKNOWN')
168
+ # => KeyError: key not found "UNKNOWN_URL"
169
+ GetaroundUtils::Utils::ConfigUrl.from_env('UNKNOWN', 'mysql://localhost/test')
170
+ # => <URI::Generic mysql://localhost/test>
171
+ GetaroundUtils::Utils::ConfigUrl.from_env('UNKNOWN') { GetaroundUtils::Utils::ConfigUrl.from_env('BAZ') }
172
+ # => KeyError: key not found "BAZ_URL"
173
+ ```
174
+
175
+ For more details, [read the spec](spec/getaround_utils/utils/config_url_spec.rb)
176
+
177
+ ### GetaroundUtils::Utils::HandleError
178
+
179
+ Allows to easily notify our error provider by providing context metadata as keyword arguments.
180
+
181
+ *If there is no error provider defined, a `debug` message will be logged using `GetaroundUtils::Mixins::Loggable`*
182
+
183
+ ```ruby
184
+ module MyApp::Errors
185
+ def self.handle(error, **)
186
+ GetaroundUtils::Utils::HandleError.notify_of(error, **) do |event|
187
+ event.grouping_hash = 'hello-world' # Bugsnag example
188
+ end
189
+ end
190
+ end
191
+
192
+ begin
193
+ raise 'woopsie'
194
+ rescue StandardError => e
195
+ MyApp::Errors.handle(e, foo: 'bar', baz: 42)
196
+ end
197
+ ```
110
198
 
199
+ For more details, [read the spec](spec/getaround_utils/utils/handle_error_spec.rb)
@@ -17,17 +17,21 @@ Gem::Specification.new do |gem|
17
17
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
18
18
  end
19
19
 
20
+ gem.metadata = {
21
+ "changelog_uri" => "https://github.com/drivy/backend-configs/blob/main/getaround_utils/CHANGELOG.md",
22
+ }
23
+
20
24
  # Development dependencies
21
- gem.add_development_dependency 'getaround-rubocop', '= 0.2.11'
25
+ gem.add_development_dependency 'getaround-rubocop', '= 0.3.1'
22
26
  gem.add_development_dependency 'irb', '~> 1.15'
23
27
  gem.add_development_dependency 'rake', '~> 13.2'
24
28
  gem.add_development_dependency 'rspec', '~> 3.13'
25
29
  gem.add_development_dependency 'rspec-rails', '~> 8.0'
26
- gem.add_development_dependency 'rubocop', '~> 1.79.0'
30
+ gem.add_development_dependency 'rubocop', '~> 1.82.1'
27
31
  gem.add_development_dependency 'webmock', '~> 3.25'
28
32
 
29
33
  # Functional (optional) dependencies
30
- gem.add_development_dependency 'dotenv', '~> 3.1.8'
34
+ gem.add_development_dependency 'dotenv', '~> 3.2.0'
31
35
  gem.add_development_dependency 'lograge', '~> 0.14.0'
32
36
  gem.add_development_dependency 'ougai', '~> 2.0'
33
37
  gem.add_development_dependency 'rack', '> 2.2'
@@ -14,11 +14,11 @@ module GetaroundUtils::Engines::Health
14
14
  UNDEFINED = 'N/A'
15
15
 
16
16
  def self.release_version
17
- ENV['HEROKU_RELEASE_VERSION'] || ENV['PORTER_STACK_REVISION'] || ENV['PORTER_POD_REVISION']
17
+ ENV['PORTER_STACK_REVISION'] || ENV['PORTER_POD_REVISION'] || ENV['ARGOCD_APP_REVISION']
18
18
  end
19
19
 
20
20
  def self.commit_sha1
21
- ENV['HEROKU_SLUG_COMMIT'] || ENV['COMMIT_SHA1']
21
+ ENV['COMMIT_SHA1']
22
22
  end
23
23
 
24
24
  def self.needs_migration?
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'uri'
4
+
5
+ module GetaroundUtils; end
6
+
7
+ module GetaroundUtils::Utils; end
8
+
9
+ module GetaroundUtils::Utils::ConfigUrl
10
+ def self.from_env(config_name, ...)
11
+ env_url = ENV.fetch("#{config_name}_URL", ...)
12
+ env_pwd = ENV.fetch("#{config_name}_PASSWORD", nil)
13
+ return if env_url.nil?
14
+
15
+ ::URI.parse(env_url).tap do |uri|
16
+ if env_pwd && !uri.userinfo
17
+ uri.userinfo = ":#{env_pwd}"
18
+ elsif env_pwd
19
+ uri.password ||= env_pwd
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'getaround_utils/mixins/loggable'
4
+
5
+ module GetaroundUtils; end
6
+
7
+ module GetaroundUtils::Utils; end
8
+
9
+ module GetaroundUtils::Utils::HandleError
10
+ extend GetaroundUtils::Mixins::Loggable
11
+
12
+ # @see https://docs.bugsnag.com/platforms/ruby/rails/reporting-handled-errors/#sending-custom-diagnostics
13
+ def self.notify_of(error, **metadata, &)
14
+ if defined?(::Bugsnag)
15
+ ::Bugsnag.notify(error) do |event|
16
+ metadata.each do |name, value|
17
+ if value.is_a?(Hash)
18
+ event.add_metadata(name, value)
19
+ else
20
+ event.add_metadata('custom', name, value)
21
+ end
22
+ end
23
+ yield event if block_given?
24
+ end
25
+ else
26
+ loggable_log(
27
+ :debug,
28
+ 'handled_error',
29
+ error_class: error.class.name,
30
+ error_message: error.to_s,
31
+ **metadata
32
+ )
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'getaround_utils/utils/config_url'
3
4
  require 'getaround_utils/utils/deep_key_value'
5
+ require 'getaround_utils/utils/handle_error'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GetaroundUtils
4
- VERSION = '0.2.37'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getaround_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.37
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drivy
8
8
  - Laurent Humez
9
- autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2025-08-26 00:00:00.000000000 Z
11
+ date: 1980-01-02 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: getaround-rubocop
@@ -17,14 +16,14 @@ dependencies:
17
16
  requirements:
18
17
  - - '='
19
18
  - !ruby/object:Gem::Version
20
- version: 0.2.11
19
+ version: 0.3.1
21
20
  type: :development
22
21
  prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
24
  - - '='
26
25
  - !ruby/object:Gem::Version
27
- version: 0.2.11
26
+ version: 0.3.1
28
27
  - !ruby/object:Gem::Dependency
29
28
  name: irb
30
29
  requirement: !ruby/object:Gem::Requirement
@@ -87,14 +86,14 @@ dependencies:
87
86
  requirements:
88
87
  - - "~>"
89
88
  - !ruby/object:Gem::Version
90
- version: 1.79.0
89
+ version: 1.82.1
91
90
  type: :development
92
91
  prerelease: false
93
92
  version_requirements: !ruby/object:Gem::Requirement
94
93
  requirements:
95
94
  - - "~>"
96
95
  - !ruby/object:Gem::Version
97
- version: 1.79.0
96
+ version: 1.82.1
98
97
  - !ruby/object:Gem::Dependency
99
98
  name: webmock
100
99
  requirement: !ruby/object:Gem::Requirement
@@ -115,14 +114,14 @@ dependencies:
115
114
  requirements:
116
115
  - - "~>"
117
116
  - !ruby/object:Gem::Version
118
- version: 3.1.8
117
+ version: 3.2.0
119
118
  type: :development
120
119
  prerelease: false
121
120
  version_requirements: !ruby/object:Gem::Requirement
122
121
  requirements:
123
122
  - - "~>"
124
123
  - !ruby/object:Gem::Version
125
- version: 3.1.8
124
+ version: 3.2.0
126
125
  - !ruby/object:Gem::Dependency
127
126
  name: lograge
128
127
  requirement: !ruby/object:Gem::Requirement
@@ -202,6 +201,7 @@ extra_rdoc_files: []
202
201
  files:
203
202
  - ".rubocop.yml"
204
203
  - ".ruby-version"
204
+ - CHANGELOG.md
205
205
  - Gemfile
206
206
  - Gemfile.lock
207
207
  - README.md
@@ -218,13 +218,15 @@ files:
218
218
  - lib/getaround_utils/railties/lograge.rb
219
219
  - lib/getaround_utils/railties/ougai.rb
220
220
  - lib/getaround_utils/utils.rb
221
+ - lib/getaround_utils/utils/config_url.rb
221
222
  - lib/getaround_utils/utils/deep_key_value.rb
223
+ - lib/getaround_utils/utils/handle_error.rb
222
224
  - lib/getaround_utils/version.rb
223
225
  homepage: https://github.com/drivy
224
226
  licenses:
225
227
  - MIT
226
- metadata: {}
227
- post_install_message:
228
+ metadata:
229
+ changelog_uri: https://github.com/drivy/backend-configs/blob/main/getaround_utils/CHANGELOG.md
228
230
  rdoc_options: []
229
231
  require_paths:
230
232
  - lib
@@ -239,8 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
241
  - !ruby/object:Gem::Version
240
242
  version: '0'
241
243
  requirements: []
242
- rubygems_version: 3.5.16
243
- signing_key:
244
+ rubygems_version: 4.0.3
244
245
  specification_version: 4
245
246
  summary: Backend shared utility classes
246
247
  test_files: []