getaround_utils 0.2.36 → 0.2.38
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 +4 -4
- data/CHANGELOG.md +35 -0
- data/Gemfile.lock +130 -112
- data/README.md +91 -2
- data/getaround_utils.gemspec +6 -2
- data/lib/getaround_utils/railties/ougai.rb +2 -1
- data/lib/getaround_utils/utils/config_url.rb +23 -0
- data/lib/getaround_utils/utils/handle_error.rb +35 -0
- data/lib/getaround_utils/utils.rb +2 -0
- data/lib/getaround_utils/version.rb +1 -1
- metadata +12 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 916e4ff4d5a7e304388761fa589ed6d5cf6607415323db868832e098176898da
|
|
4
|
+
data.tar.gz: 909e21f9dc77e1da802084938478197acf05f4020922873cfe4867d2bcc727e4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9172dc32867f096bebd47bcad9cefaf38a02085917d91af8254d942496ab159a1b9f12aa60692f8e0c84dd370e9f2633a85f3314589d8ef60abc751137a7da9e
|
|
7
|
+
data.tar.gz: a0c67681e628904bf1b36b4f1fe726bd8a33951b595e301d5da55de4a187d02714721d2952775688f4cf94082fa2118b2ac49302b0f63985debfb04fa3a54f53
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
## [0.2.38] 2025-11-19
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- `GetaroundUtils::Utils::HandleError` ([#433](https://github.com/drivy/backend-configs/pull/433))
|
|
6
|
+
```ruby
|
|
7
|
+
module MyApp::Errors
|
|
8
|
+
def self.handle(error, **)
|
|
9
|
+
GetaroundUtils::Utils::HandleError.notify_of(error, **) do |report|
|
|
10
|
+
report.grouping_hash = 'hello-world' # Bugsnag example
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
```
|
|
15
|
+
- `GetaroundUtils::Utils::ConfigUrl` ([#432](https://github.com/drivy/backend-configs/pull/432))
|
|
16
|
+
```ruby
|
|
17
|
+
# FOO_URL="redis://foo@localhost:666/10"
|
|
18
|
+
# FOO_PASSWORD="added-pwd"
|
|
19
|
+
# BAR_URL="whatever://bar:used-pwd@localhost:666/42"
|
|
20
|
+
# BAR_PASSWORD="not-used-pwd"
|
|
21
|
+
# ENV_TEST_NUMBER=1
|
|
22
|
+
|
|
23
|
+
GetaroundUtils::Utils::ConfigUrl
|
|
24
|
+
.from_env('FOO')
|
|
25
|
+
.tap { |uri| uri.path += ENV['ENV_TEST_NUMBER'] }
|
|
26
|
+
# => <URI::Generic redis://foo:added-pwd@localhost:666/101>
|
|
27
|
+
GetaroundUtils::Utils::ConfigUrl.from_env('BAR').to_s
|
|
28
|
+
# => "whatever://bar:used-pwd@localhost:666/42"
|
|
29
|
+
GetaroundUtils::Utils::ConfigUrl.from_env('UNKNOWN')
|
|
30
|
+
# => KeyError: key not found "UNKNOWN_URL"
|
|
31
|
+
GetaroundUtils::Utils::ConfigUrl.from_env('UNKNOWN', 'mysql://localhost/test')
|
|
32
|
+
# => <URI::Generic mysql://localhost/test>
|
|
33
|
+
GetaroundUtils::Utils::ConfigUrl.from_env('UNKNOWN') { GetaroundUtils::Utils::ConfigUrl.from_env('BAZ') }
|
|
34
|
+
# => KeyError: key not found "BAZ_URL"
|
|
35
|
+
```
|
data/Gemfile.lock
CHANGED
|
@@ -1,84 +1,91 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
getaround_utils (0.2.
|
|
4
|
+
getaround_utils (0.2.38)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
|
-
actioncable (7.
|
|
10
|
-
actionpack (= 7.
|
|
11
|
-
activesupport (= 7.
|
|
9
|
+
actioncable (7.2.2.1)
|
|
10
|
+
actionpack (= 7.2.2.1)
|
|
11
|
+
activesupport (= 7.2.2.1)
|
|
12
12
|
nio4r (~> 2.0)
|
|
13
13
|
websocket-driver (>= 0.6.1)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
activesupport (= 7.0.8.7)
|
|
37
|
-
rack (~> 2.0, >= 2.2.4)
|
|
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)
|
|
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)
|
|
27
|
+
mail (>= 2.8.0)
|
|
28
|
+
rails-dom-testing (~> 2.2)
|
|
29
|
+
actionpack (7.2.2.1)
|
|
30
|
+
actionview (= 7.2.2.1)
|
|
31
|
+
activesupport (= 7.2.2.1)
|
|
32
|
+
nokogiri (>= 1.8.5)
|
|
33
|
+
racc
|
|
34
|
+
rack (>= 2.2.4, < 3.2)
|
|
35
|
+
rack-session (>= 1.0.1)
|
|
38
36
|
rack-test (>= 0.6.3)
|
|
39
|
-
rails-dom-testing (~> 2.
|
|
40
|
-
rails-html-sanitizer (~> 1.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
rails-dom-testing (~> 2.2)
|
|
38
|
+
rails-html-sanitizer (~> 1.6)
|
|
39
|
+
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)
|
|
46
45
|
globalid (>= 0.6.0)
|
|
47
46
|
nokogiri (>= 1.8.5)
|
|
48
|
-
actionview (7.
|
|
49
|
-
activesupport (= 7.
|
|
47
|
+
actionview (7.2.2.1)
|
|
48
|
+
activesupport (= 7.2.2.1)
|
|
50
49
|
builder (~> 3.1)
|
|
51
|
-
erubi (~> 1.
|
|
52
|
-
rails-dom-testing (~> 2.
|
|
53
|
-
rails-html-sanitizer (~> 1.
|
|
54
|
-
activejob (7.
|
|
55
|
-
activesupport (= 7.
|
|
50
|
+
erubi (~> 1.11)
|
|
51
|
+
rails-dom-testing (~> 2.2)
|
|
52
|
+
rails-html-sanitizer (~> 1.6)
|
|
53
|
+
activejob (7.2.2.1)
|
|
54
|
+
activesupport (= 7.2.2.1)
|
|
56
55
|
globalid (>= 0.3.6)
|
|
57
|
-
activemodel (7.
|
|
58
|
-
activesupport (= 7.
|
|
59
|
-
activerecord (7.
|
|
60
|
-
activemodel (= 7.
|
|
61
|
-
activesupport (= 7.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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)
|
|
61
|
+
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)
|
|
67
67
|
marcel (~> 1.0)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
activesupport (7.2.2.1)
|
|
69
|
+
base64
|
|
70
|
+
benchmark (>= 0.3)
|
|
71
|
+
bigdecimal
|
|
72
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
73
|
+
connection_pool (>= 2.2.5)
|
|
74
|
+
drb
|
|
71
75
|
i18n (>= 1.6, < 2)
|
|
76
|
+
logger (>= 1.4.2)
|
|
72
77
|
minitest (>= 5.1)
|
|
73
|
-
|
|
78
|
+
securerandom (>= 0.3)
|
|
79
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
74
80
|
addressable (2.8.7)
|
|
75
81
|
public_suffix (>= 2.0.2, < 7.0)
|
|
76
82
|
ast (2.4.3)
|
|
77
|
-
base64 (0.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
base64 (0.3.0)
|
|
84
|
+
benchmark (0.4.1)
|
|
85
|
+
bigdecimal (3.2.2)
|
|
86
|
+
builder (3.3.0)
|
|
87
|
+
concurrent-ruby (1.3.5)
|
|
88
|
+
connection_pool (2.5.3)
|
|
82
89
|
crack (1.0.0)
|
|
83
90
|
bigdecimal
|
|
84
91
|
rexml
|
|
@@ -86,8 +93,9 @@ GEM
|
|
|
86
93
|
date (3.4.1)
|
|
87
94
|
diff-lcs (1.6.2)
|
|
88
95
|
dotenv (3.1.8)
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
drb (2.2.3)
|
|
97
|
+
erb (5.0.2)
|
|
98
|
+
erubi (1.13.1)
|
|
91
99
|
getaround-rubocop (0.2.11)
|
|
92
100
|
relaxed-rubocop (~> 2.5)
|
|
93
101
|
rubocop (~> 1.0)
|
|
@@ -97,22 +105,23 @@ GEM
|
|
|
97
105
|
globalid (1.2.1)
|
|
98
106
|
activesupport (>= 6.1)
|
|
99
107
|
hashdiff (1.2.0)
|
|
100
|
-
i18n (1.14.
|
|
108
|
+
i18n (1.14.7)
|
|
101
109
|
concurrent-ruby (~> 1.0)
|
|
102
|
-
io-console (0.8.
|
|
110
|
+
io-console (0.8.1)
|
|
103
111
|
irb (1.15.2)
|
|
104
112
|
pp (>= 0.6.0)
|
|
105
113
|
rdoc (>= 4.0.0)
|
|
106
114
|
reline (>= 0.4.2)
|
|
107
|
-
json (2.
|
|
115
|
+
json (2.13.1)
|
|
108
116
|
language_server-protocol (3.17.0.5)
|
|
109
117
|
lint_roller (1.1.0)
|
|
118
|
+
logger (1.7.0)
|
|
110
119
|
lograge (0.14.0)
|
|
111
120
|
actionpack (>= 4)
|
|
112
121
|
activesupport (>= 4)
|
|
113
122
|
railties (>= 4)
|
|
114
123
|
request_store (~> 1.0)
|
|
115
|
-
loofah (2.
|
|
124
|
+
loofah (2.24.1)
|
|
116
125
|
crass (~> 1.0.2)
|
|
117
126
|
nokogiri (>= 1.12.0)
|
|
118
127
|
mail (2.8.1)
|
|
@@ -121,10 +130,9 @@ GEM
|
|
|
121
130
|
net-pop
|
|
122
131
|
net-smtp
|
|
123
132
|
marcel (1.0.4)
|
|
124
|
-
method_source (1.0.0)
|
|
125
133
|
mini_mime (1.1.5)
|
|
126
|
-
mini_portile2 (2.8.
|
|
127
|
-
minitest (5.
|
|
134
|
+
mini_portile2 (2.8.9)
|
|
135
|
+
minitest (5.25.5)
|
|
128
136
|
net-imap (0.5.8)
|
|
129
137
|
date
|
|
130
138
|
net-protocol
|
|
@@ -135,14 +143,14 @@ GEM
|
|
|
135
143
|
net-smtp (0.5.1)
|
|
136
144
|
net-protocol
|
|
137
145
|
nio4r (2.7.4)
|
|
138
|
-
nokogiri (1.
|
|
146
|
+
nokogiri (1.18.9)
|
|
139
147
|
mini_portile2 (~> 2.8.2)
|
|
140
148
|
racc (~> 1.4)
|
|
141
149
|
oj (3.11.3)
|
|
142
150
|
ougai (2.0.0)
|
|
143
151
|
oj (~> 3.10)
|
|
144
152
|
parallel (1.27.0)
|
|
145
|
-
parser (3.3.
|
|
153
|
+
parser (3.3.9.0)
|
|
146
154
|
ast (~> 2.4.1)
|
|
147
155
|
racc
|
|
148
156
|
pp (0.6.2)
|
|
@@ -153,48 +161,54 @@ GEM
|
|
|
153
161
|
date
|
|
154
162
|
stringio
|
|
155
163
|
public_suffix (6.0.2)
|
|
156
|
-
racc (1.
|
|
157
|
-
rack (
|
|
158
|
-
rack-
|
|
164
|
+
racc (1.8.1)
|
|
165
|
+
rack (3.1.16)
|
|
166
|
+
rack-session (2.1.1)
|
|
167
|
+
base64 (>= 0.1.0)
|
|
168
|
+
rack (>= 3.0.0)
|
|
169
|
+
rack-test (2.2.0)
|
|
159
170
|
rack (>= 1.3)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
171
|
+
rackup (2.2.1)
|
|
172
|
+
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)
|
|
172
185
|
bundler (>= 1.15.0)
|
|
173
|
-
railties (= 7.
|
|
174
|
-
rails-dom-testing (2.
|
|
186
|
+
railties (= 7.2.2.1)
|
|
187
|
+
rails-dom-testing (2.3.0)
|
|
175
188
|
activesupport (>= 5.0.0)
|
|
176
189
|
minitest
|
|
177
190
|
nokogiri (>= 1.6)
|
|
178
|
-
rails-html-sanitizer (1.6.
|
|
191
|
+
rails-html-sanitizer (1.6.2)
|
|
179
192
|
loofah (~> 2.21)
|
|
180
|
-
nokogiri (
|
|
181
|
-
railties (7.
|
|
182
|
-
actionpack (= 7.
|
|
183
|
-
activesupport (= 7.
|
|
184
|
-
|
|
193
|
+
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
|
+
irb (~> 1.13)
|
|
198
|
+
rackup (>= 1.0.0)
|
|
185
199
|
rake (>= 12.2)
|
|
186
|
-
thor (~> 1.0)
|
|
187
|
-
zeitwerk (~> 2.
|
|
200
|
+
thor (~> 1.0, >= 1.2.2)
|
|
201
|
+
zeitwerk (~> 2.6)
|
|
188
202
|
rainbow (3.1.1)
|
|
189
|
-
rake (13.
|
|
190
|
-
rdoc (6.14.
|
|
203
|
+
rake (13.3.0)
|
|
204
|
+
rdoc (6.14.2)
|
|
191
205
|
erb
|
|
192
206
|
psych (>= 4.0.0)
|
|
193
207
|
redis-client (0.14.1)
|
|
194
208
|
connection_pool
|
|
195
209
|
regexp_parser (2.10.0)
|
|
196
210
|
relaxed-rubocop (2.5)
|
|
197
|
-
reline (0.6.
|
|
211
|
+
reline (0.6.2)
|
|
198
212
|
io-console (~> 0.5)
|
|
199
213
|
request_store (1.7.0)
|
|
200
214
|
rack (>= 1.4)
|
|
@@ -203,7 +217,7 @@ GEM
|
|
|
203
217
|
rspec-core (~> 3.13.0)
|
|
204
218
|
rspec-expectations (~> 3.13.0)
|
|
205
219
|
rspec-mocks (~> 3.13.0)
|
|
206
|
-
rspec-core (3.13.
|
|
220
|
+
rspec-core (3.13.5)
|
|
207
221
|
rspec-support (~> 3.13.0)
|
|
208
222
|
rspec-expectations (3.13.5)
|
|
209
223
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
@@ -211,16 +225,16 @@ GEM
|
|
|
211
225
|
rspec-mocks (3.13.5)
|
|
212
226
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
213
227
|
rspec-support (~> 3.13.0)
|
|
214
|
-
rspec-rails (
|
|
215
|
-
actionpack (>= 7.
|
|
216
|
-
activesupport (>= 7.
|
|
217
|
-
railties (>= 7.
|
|
228
|
+
rspec-rails (8.0.1)
|
|
229
|
+
actionpack (>= 7.2)
|
|
230
|
+
activesupport (>= 7.2)
|
|
231
|
+
railties (>= 7.2)
|
|
218
232
|
rspec-core (~> 3.13)
|
|
219
233
|
rspec-expectations (~> 3.13)
|
|
220
234
|
rspec-mocks (~> 3.13)
|
|
221
235
|
rspec-support (~> 3.13)
|
|
222
236
|
rspec-support (3.13.4)
|
|
223
|
-
rubocop (1.
|
|
237
|
+
rubocop (1.79.0)
|
|
224
238
|
json (~> 2.3)
|
|
225
239
|
language_server-protocol (~> 3.17.0.2)
|
|
226
240
|
lint_roller (~> 1.1.0)
|
|
@@ -228,10 +242,11 @@ GEM
|
|
|
228
242
|
parser (>= 3.3.0.2)
|
|
229
243
|
rainbow (>= 2.2.2, < 4.0)
|
|
230
244
|
regexp_parser (>= 2.9.3, < 3.0)
|
|
231
|
-
rubocop-ast (>= 1.
|
|
245
|
+
rubocop-ast (>= 1.46.0, < 2.0)
|
|
232
246
|
ruby-progressbar (~> 1.7)
|
|
247
|
+
tsort (>= 0.2.0)
|
|
233
248
|
unicode-display_width (>= 2.4.0, < 4.0)
|
|
234
|
-
rubocop-ast (1.
|
|
249
|
+
rubocop-ast (1.46.0)
|
|
235
250
|
parser (>= 3.3.7.2)
|
|
236
251
|
prism (~> 1.4)
|
|
237
252
|
rubocop-performance (1.25.0)
|
|
@@ -248,19 +263,22 @@ GEM
|
|
|
248
263
|
lint_roller (~> 1.1)
|
|
249
264
|
rubocop (~> 1.72, >= 1.72.1)
|
|
250
265
|
ruby-progressbar (1.13.0)
|
|
266
|
+
securerandom (0.4.1)
|
|
251
267
|
sidekiq (7.0.9)
|
|
252
268
|
concurrent-ruby (< 2)
|
|
253
269
|
connection_pool (>= 2.3.0)
|
|
254
270
|
rack (>= 2.2.4)
|
|
255
271
|
redis-client (>= 0.11.0)
|
|
256
272
|
stringio (3.1.7)
|
|
257
|
-
thor (1.
|
|
273
|
+
thor (1.4.0)
|
|
258
274
|
timeout (0.4.3)
|
|
275
|
+
tsort (0.2.0)
|
|
259
276
|
tzinfo (2.0.6)
|
|
260
277
|
concurrent-ruby (~> 1.0)
|
|
261
278
|
unicode-display_width (3.1.4)
|
|
262
279
|
unicode-emoji (~> 4.0, >= 4.0.4)
|
|
263
280
|
unicode-emoji (4.0.4)
|
|
281
|
+
useragent (0.16.11)
|
|
264
282
|
webmock (3.25.1)
|
|
265
283
|
addressable (>= 2.8.0)
|
|
266
284
|
crack (>= 0.3.2)
|
|
@@ -269,7 +287,7 @@ GEM
|
|
|
269
287
|
base64
|
|
270
288
|
websocket-extensions (>= 0.1.0)
|
|
271
289
|
websocket-extensions (0.1.5)
|
|
272
|
-
zeitwerk (2.
|
|
290
|
+
zeitwerk (2.7.3)
|
|
273
291
|
|
|
274
292
|
PLATFORMS
|
|
275
293
|
ruby
|
|
@@ -285,8 +303,8 @@ DEPENDENCIES
|
|
|
285
303
|
rails (~> 7.0)
|
|
286
304
|
rake (~> 13.2)
|
|
287
305
|
rspec (~> 3.13)
|
|
288
|
-
rspec-rails (~>
|
|
289
|
-
rubocop (~> 1.
|
|
306
|
+
rspec-rails (~> 8.0)
|
|
307
|
+
rubocop (~> 1.79.0)
|
|
290
308
|
sidekiq (> 7.0)
|
|
291
309
|
webmock (~> 3.25)
|
|
292
310
|
|
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::
|
|
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/
|
|
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)
|
data/getaround_utils.gemspec
CHANGED
|
@@ -17,13 +17,17 @@ 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
25
|
gem.add_development_dependency 'getaround-rubocop', '= 0.2.11'
|
|
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
|
-
gem.add_development_dependency 'rspec-rails', '~>
|
|
26
|
-
gem.add_development_dependency 'rubocop', '~> 1.
|
|
29
|
+
gem.add_development_dependency 'rspec-rails', '~> 8.0'
|
|
30
|
+
gem.add_development_dependency 'rubocop', '~> 1.79.0'
|
|
27
31
|
gem.add_development_dependency 'webmock', '~> 3.25'
|
|
28
32
|
|
|
29
33
|
# Functional (optional) dependencies
|
|
@@ -93,7 +93,8 @@ class GetaroundUtils::Railties::Ougai < Rails::Railtie
|
|
|
93
93
|
config.logger = Rails.application.config.logger
|
|
94
94
|
|
|
95
95
|
original_handler = config.error_handlers.shift
|
|
96
|
-
config
|
|
96
|
+
# Third argument "config" was introduced in 7.x, enforced in 8.x
|
|
97
|
+
config.error_handlers << lambda do |ex, ctx, _config = nil|
|
|
97
98
|
if Sidekiq.logger.is_a?(Ougai::Logger)
|
|
98
99
|
Sidekiq.logger.warn(ex, job: ctx[:job])
|
|
99
100
|
else
|
|
@@ -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
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: getaround_utils
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.38
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Drivy
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-
|
|
12
|
+
date: 2025-11-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: getaround-rubocop
|
|
@@ -73,28 +73,28 @@ dependencies:
|
|
|
73
73
|
requirements:
|
|
74
74
|
- - "~>"
|
|
75
75
|
- !ruby/object:Gem::Version
|
|
76
|
-
version: '
|
|
76
|
+
version: '8.0'
|
|
77
77
|
type: :development
|
|
78
78
|
prerelease: false
|
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
|
80
80
|
requirements:
|
|
81
81
|
- - "~>"
|
|
82
82
|
- !ruby/object:Gem::Version
|
|
83
|
-
version: '
|
|
83
|
+
version: '8.0'
|
|
84
84
|
- !ruby/object:Gem::Dependency
|
|
85
85
|
name: rubocop
|
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
|
87
87
|
requirements:
|
|
88
88
|
- - "~>"
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
|
-
version: 1.
|
|
90
|
+
version: 1.79.0
|
|
91
91
|
type: :development
|
|
92
92
|
prerelease: false
|
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
|
94
94
|
requirements:
|
|
95
95
|
- - "~>"
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: 1.
|
|
97
|
+
version: 1.79.0
|
|
98
98
|
- !ruby/object:Gem::Dependency
|
|
99
99
|
name: webmock
|
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -202,6 +202,7 @@ extra_rdoc_files: []
|
|
|
202
202
|
files:
|
|
203
203
|
- ".rubocop.yml"
|
|
204
204
|
- ".ruby-version"
|
|
205
|
+
- CHANGELOG.md
|
|
205
206
|
- Gemfile
|
|
206
207
|
- Gemfile.lock
|
|
207
208
|
- README.md
|
|
@@ -218,12 +219,15 @@ files:
|
|
|
218
219
|
- lib/getaround_utils/railties/lograge.rb
|
|
219
220
|
- lib/getaround_utils/railties/ougai.rb
|
|
220
221
|
- lib/getaround_utils/utils.rb
|
|
222
|
+
- lib/getaround_utils/utils/config_url.rb
|
|
221
223
|
- lib/getaround_utils/utils/deep_key_value.rb
|
|
224
|
+
- lib/getaround_utils/utils/handle_error.rb
|
|
222
225
|
- lib/getaround_utils/version.rb
|
|
223
226
|
homepage: https://github.com/drivy
|
|
224
227
|
licenses:
|
|
225
228
|
- MIT
|
|
226
|
-
metadata:
|
|
229
|
+
metadata:
|
|
230
|
+
changelog_uri: https://github.com/drivy/backend-configs/blob/main/getaround_utils/CHANGELOG.md
|
|
227
231
|
post_install_message:
|
|
228
232
|
rdoc_options: []
|
|
229
233
|
require_paths:
|
|
@@ -239,7 +243,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
239
243
|
- !ruby/object:Gem::Version
|
|
240
244
|
version: '0'
|
|
241
245
|
requirements: []
|
|
242
|
-
rubygems_version: 3.5.
|
|
246
|
+
rubygems_version: 3.5.21
|
|
243
247
|
signing_key:
|
|
244
248
|
specification_version: 4
|
|
245
249
|
summary: Backend shared utility classes
|