gitlab-mail_room 0.0.23 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +10 -0
- data/.github/workflows/ci.yml +54 -0
- data/.gitlab-ci.yml +2 -3
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +68 -65
- data/.ruby-version +1 -1
- data/.tool-versions +1 -0
- data/CHANGELOG.md +8 -0
- data/README.md +6 -16
- data/lib/mail_room/arbitration/redis.rb +13 -2
- data/lib/mail_room/delivery/postback.rb +31 -7
- data/lib/mail_room/delivery/sidekiq.rb +13 -2
- data/lib/mail_room/version.rb +1 -1
- data/mail_room.gemspec +4 -4
- data/spec/lib/arbitration/redis_spec.rb +31 -6
- data/spec/lib/delivery/sidekiq_spec.rb +37 -11
- data/spec/lib/health_check_spec.rb +3 -1
- metadata +43 -35
- data/.travis.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b38092bd49b7554fc1f14f45b250737db77a58ce851e78ac9c3eb89c17424881
|
4
|
+
data.tar.gz: 04a4a167905034fcab7ee3c095991103b2bb5f92ff414c0cb6ca360017ae6f3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d09917cbc928d36ea820d06957ad9bc3d47726017abdb307dc734e2b6ef4203dc95866e0821821b461bc86384c7670ad187b3cae0d31e2294501a762d4a9ea9
|
7
|
+
data.tar.gz: acea6980fe10c44333325ffd57cd78007302abf5d58e8a11c12e70a0b0aaf61bcea627b14b31bc24dcfe68f938d50a15ba91e60130aeeafbe7fb079b38dddfad
|
@@ -0,0 +1,54 @@
|
|
1
|
+
name: CI
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
test:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
services:
|
10
|
+
# Label used to access the service container
|
11
|
+
redis:
|
12
|
+
# Docker Hub image
|
13
|
+
image: redis
|
14
|
+
# Set health checks to wait until redis has started
|
15
|
+
options: >-
|
16
|
+
--health-cmd "redis-cli ping"
|
17
|
+
--health-interval 10s
|
18
|
+
--health-timeout 5s
|
19
|
+
--health-retries 5
|
20
|
+
ports:
|
21
|
+
# Maps port 6379 on service container to the host
|
22
|
+
- 6379:6379
|
23
|
+
|
24
|
+
strategy:
|
25
|
+
fail-fast: false
|
26
|
+
matrix:
|
27
|
+
ruby-version:
|
28
|
+
- head
|
29
|
+
- '3.2'
|
30
|
+
- '3.1'
|
31
|
+
- '3.0'
|
32
|
+
- '2.7'
|
33
|
+
steps:
|
34
|
+
- uses: actions/checkout@v4
|
35
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
36
|
+
uses: ruby/setup-ruby@v1
|
37
|
+
with:
|
38
|
+
ruby-version: ${{ matrix.ruby-version }}
|
39
|
+
bundler-cache: true # 'bundle install' and cache
|
40
|
+
- name: Run tests
|
41
|
+
run: bundle exec rspec
|
42
|
+
|
43
|
+
rubocop:
|
44
|
+
runs-on: ubuntu-latest
|
45
|
+
steps:
|
46
|
+
- uses: actions/checkout@v4
|
47
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
48
|
+
uses: ruby/setup-ruby@v1
|
49
|
+
with:
|
50
|
+
ruby-version: ${{ matrix.ruby-version }}
|
51
|
+
bundler-cache: true # 'bundle install' and cache
|
52
|
+
- name: Run Rubocop
|
53
|
+
run: bundle exec rubocop
|
54
|
+
|
data/.gitlab-ci.yml
CHANGED
@@ -14,7 +14,6 @@ services:
|
|
14
14
|
before_script:
|
15
15
|
- apt update && apt install -y libicu-dev
|
16
16
|
- ruby -v # Print out ruby version for debugging
|
17
|
-
- gem install bundler --no-document # Bundler is not installed with the image
|
18
17
|
- bundle config set --local path 'vendor'
|
19
18
|
- bundle install -j $(nproc)
|
20
19
|
script:
|
@@ -23,8 +22,8 @@ services:
|
|
23
22
|
rspec:
|
24
23
|
parallel:
|
25
24
|
matrix:
|
26
|
-
- RUBY_VERSION: [ "
|
25
|
+
- RUBY_VERSION: [ "3.0", "3.1", "3.2" ]
|
27
26
|
<<: *test
|
28
27
|
|
29
28
|
include:
|
30
|
-
- template: Security/Dependency-Scanning.gitlab-ci.yml
|
29
|
+
- template: Security/Dependency-Scanning.gitlab-ci.yml
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2023-03-15 01:41:21 UTC using RuboCop version 1.48.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
9
|
# Offense count: 5
|
10
|
-
# This cop supports safe
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
11
11
|
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
12
12
|
# Include: **/*.gemspec
|
13
13
|
Gemspec/OrderedDependencies:
|
@@ -15,21 +15,21 @@ Gemspec/OrderedDependencies:
|
|
15
15
|
- 'mail_room.gemspec'
|
16
16
|
|
17
17
|
# Offense count: 1
|
18
|
-
# Configuration parameters: Include.
|
18
|
+
# Configuration parameters: Severity, Include.
|
19
19
|
# Include: **/*.gemspec
|
20
20
|
Gemspec/RequiredRubyVersion:
|
21
21
|
Exclude:
|
22
22
|
- 'mail_room.gemspec'
|
23
23
|
|
24
24
|
# Offense count: 5
|
25
|
-
# This cop supports safe
|
25
|
+
# This cop supports safe autocorrection (--autocorrect).
|
26
26
|
Layout/BlockEndNewline:
|
27
27
|
Exclude:
|
28
28
|
- 'spec/lib/delivery/postback_spec.rb'
|
29
29
|
- 'spec/lib/delivery/que_spec.rb'
|
30
30
|
|
31
31
|
# Offense count: 5
|
32
|
-
# This cop supports safe
|
32
|
+
# This cop supports safe autocorrection (--autocorrect).
|
33
33
|
# Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
|
34
34
|
# SupportedStyles: case, end
|
35
35
|
Layout/CaseIndentation:
|
@@ -37,13 +37,13 @@ Layout/CaseIndentation:
|
|
37
37
|
- 'lib/mail_room/mailbox.rb'
|
38
38
|
|
39
39
|
# Offense count: 1
|
40
|
-
# This cop supports safe
|
40
|
+
# This cop supports safe autocorrection (--autocorrect).
|
41
41
|
Layout/EmptyLineAfterMagicComment:
|
42
42
|
Exclude:
|
43
43
|
- 'mail_room.gemspec'
|
44
44
|
|
45
45
|
# Offense count: 2
|
46
|
-
# This cop supports safe
|
46
|
+
# This cop supports safe autocorrection (--autocorrect).
|
47
47
|
# Configuration parameters: EnforcedStyle.
|
48
48
|
# SupportedStyles: around, only_before
|
49
49
|
Layout/EmptyLinesAroundAccessModifier:
|
@@ -52,7 +52,7 @@ Layout/EmptyLinesAroundAccessModifier:
|
|
52
52
|
- 'lib/mail_room/delivery/que.rb'
|
53
53
|
|
54
54
|
# Offense count: 4
|
55
|
-
# This cop supports safe
|
55
|
+
# This cop supports safe autocorrection (--autocorrect).
|
56
56
|
# Configuration parameters: EnforcedStyle.
|
57
57
|
# SupportedStyles: empty_lines, no_empty_lines
|
58
58
|
Layout/EmptyLinesAroundBlockBody:
|
@@ -62,7 +62,7 @@ Layout/EmptyLinesAroundBlockBody:
|
|
62
62
|
- 'spec/lib/logger/structured_spec.rb'
|
63
63
|
|
64
64
|
# Offense count: 1
|
65
|
-
# This cop supports safe
|
65
|
+
# This cop supports safe autocorrection (--autocorrect).
|
66
66
|
# Configuration parameters: EnforcedStyle.
|
67
67
|
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
68
68
|
Layout/EmptyLinesAroundClassBody:
|
@@ -70,7 +70,7 @@ Layout/EmptyLinesAroundClassBody:
|
|
70
70
|
- 'lib/mail_room/logger/structured.rb'
|
71
71
|
|
72
72
|
# Offense count: 15
|
73
|
-
# This cop supports safe
|
73
|
+
# This cop supports safe autocorrection (--autocorrect).
|
74
74
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
75
75
|
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
76
76
|
Layout/FirstHashElementIndentation:
|
@@ -80,7 +80,7 @@ Layout/FirstHashElementIndentation:
|
|
80
80
|
- 'spec/lib/logger/structured_spec.rb'
|
81
81
|
|
82
82
|
# Offense count: 5
|
83
|
-
# This cop supports safe
|
83
|
+
# This cop supports safe autocorrection (--autocorrect).
|
84
84
|
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
85
85
|
# SupportedHashRocketStyles: key, separator, table
|
86
86
|
# SupportedColonStyles: key, separator, table
|
@@ -90,7 +90,7 @@ Layout/HashAlignment:
|
|
90
90
|
- 'lib/mail_room/delivery/sidekiq.rb'
|
91
91
|
|
92
92
|
# Offense count: 2
|
93
|
-
# This cop supports safe
|
93
|
+
# This cop supports safe autocorrection (--autocorrect).
|
94
94
|
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
|
95
95
|
Layout/LeadingCommentSpace:
|
96
96
|
Exclude:
|
@@ -98,14 +98,14 @@ Layout/LeadingCommentSpace:
|
|
98
98
|
- 'spec/lib/arbitration/redis_spec.rb'
|
99
99
|
|
100
100
|
# Offense count: 5
|
101
|
-
# This cop supports safe
|
101
|
+
# This cop supports safe autocorrection (--autocorrect).
|
102
102
|
Layout/MultilineBlockLayout:
|
103
103
|
Exclude:
|
104
104
|
- 'spec/lib/delivery/postback_spec.rb'
|
105
105
|
- 'spec/lib/delivery/que_spec.rb'
|
106
106
|
|
107
107
|
# Offense count: 3
|
108
|
-
# This cop supports safe
|
108
|
+
# This cop supports safe autocorrection (--autocorrect).
|
109
109
|
# Configuration parameters: EnforcedStyle.
|
110
110
|
# SupportedStyles: space, no_space
|
111
111
|
Layout/SpaceAroundEqualsInParameterDefault:
|
@@ -115,14 +115,14 @@ Layout/SpaceAroundEqualsInParameterDefault:
|
|
115
115
|
- 'lib/mail_room/mailbox.rb'
|
116
116
|
|
117
117
|
# Offense count: 2
|
118
|
-
# This cop supports safe
|
118
|
+
# This cop supports safe autocorrection (--autocorrect).
|
119
119
|
Layout/SpaceAroundKeyword:
|
120
120
|
Exclude:
|
121
121
|
- 'lib/mail_room/coordinator.rb'
|
122
122
|
- 'lib/mail_room/mailbox_watcher.rb'
|
123
123
|
|
124
124
|
# Offense count: 2
|
125
|
-
# This cop supports safe
|
125
|
+
# This cop supports safe autocorrection (--autocorrect).
|
126
126
|
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
127
127
|
# SupportedStylesForExponentOperator: space, no_space
|
128
128
|
Layout/SpaceAroundOperators:
|
@@ -131,7 +131,7 @@ Layout/SpaceAroundOperators:
|
|
131
131
|
- 'spec/lib/arbitration/redis_spec.rb'
|
132
132
|
|
133
133
|
# Offense count: 7
|
134
|
-
# This cop supports safe
|
134
|
+
# This cop supports safe autocorrection (--autocorrect).
|
135
135
|
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
136
136
|
# SupportedStyles: space, no_space
|
137
137
|
# SupportedStylesForEmptyBraces: space, no_space
|
@@ -142,7 +142,7 @@ Layout/SpaceBeforeBlockBraces:
|
|
142
142
|
- 'spec/lib/mailbox_spec.rb'
|
143
143
|
|
144
144
|
# Offense count: 51
|
145
|
-
# This cop supports safe
|
145
|
+
# This cop supports safe autocorrection (--autocorrect).
|
146
146
|
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
147
147
|
# SupportedStyles: space, no_space
|
148
148
|
# SupportedStylesForEmptyBraces: space, no_space
|
@@ -159,7 +159,7 @@ Layout/SpaceInsideBlockBraces:
|
|
159
159
|
- 'spec/lib/mailbox_watcher_spec.rb'
|
160
160
|
|
161
161
|
# Offense count: 32
|
162
|
-
# This cop supports safe
|
162
|
+
# This cop supports safe autocorrection (--autocorrect).
|
163
163
|
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
164
164
|
# SupportedStyles: space, no_space, compact
|
165
165
|
# SupportedStylesForEmptyBraces: space, no_space
|
@@ -170,7 +170,7 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
170
170
|
- 'spec/lib/mailbox_spec.rb'
|
171
171
|
|
172
172
|
# Offense count: 1
|
173
|
-
# This cop supports safe
|
173
|
+
# This cop supports safe autocorrection (--autocorrect).
|
174
174
|
# Configuration parameters: EnforcedStyle.
|
175
175
|
# SupportedStyles: space, compact, no_space
|
176
176
|
Layout/SpaceInsideParens:
|
@@ -178,7 +178,7 @@ Layout/SpaceInsideParens:
|
|
178
178
|
- 'spec/lib/logger/structured_spec.rb'
|
179
179
|
|
180
180
|
# Offense count: 1
|
181
|
-
# This cop supports safe
|
181
|
+
# This cop supports safe autocorrection (--autocorrect).
|
182
182
|
# Configuration parameters: EnforcedStyle.
|
183
183
|
# SupportedStyles: final_newline, final_blank_line
|
184
184
|
Layout/TrailingEmptyLines:
|
@@ -186,7 +186,7 @@ Layout/TrailingEmptyLines:
|
|
186
186
|
- 'spec/lib/delivery/letter_opener_spec.rb'
|
187
187
|
|
188
188
|
# Offense count: 4
|
189
|
-
# This cop supports safe
|
189
|
+
# This cop supports safe autocorrection (--autocorrect).
|
190
190
|
# Configuration parameters: AllowInHeredoc.
|
191
191
|
Layout/TrailingWhitespace:
|
192
192
|
Exclude:
|
@@ -207,20 +207,20 @@ Lint/RescueException:
|
|
207
207
|
- 'lib/mail_room/cli.rb'
|
208
208
|
|
209
209
|
# Offense count: 1
|
210
|
-
# This cop supports safe
|
210
|
+
# This cop supports safe autocorrection (--autocorrect).
|
211
211
|
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
212
212
|
Lint/UnusedMethodArgument:
|
213
213
|
Exclude:
|
214
214
|
- 'lib/mail_room/logger/structured.rb'
|
215
215
|
|
216
216
|
# Offense count: 5
|
217
|
-
# Configuration parameters:
|
217
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
218
218
|
Metrics/AbcSize:
|
219
219
|
Max: 27
|
220
220
|
|
221
221
|
# Offense count: 32
|
222
|
-
# Configuration parameters: CountComments, CountAsOne,
|
223
|
-
#
|
222
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
223
|
+
# AllowedMethods: refine
|
224
224
|
Metrics/BlockLength:
|
225
225
|
Max: 198
|
226
226
|
|
@@ -230,12 +230,12 @@ Metrics/ClassLength:
|
|
230
230
|
Max: 169
|
231
231
|
|
232
232
|
# Offense count: 1
|
233
|
-
# Configuration parameters:
|
233
|
+
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
234
234
|
Metrics/CyclomaticComplexity:
|
235
235
|
Max: 8
|
236
236
|
|
237
237
|
# Offense count: 13
|
238
|
-
# Configuration parameters: CountComments, CountAsOne,
|
238
|
+
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
239
239
|
Metrics/MethodLength:
|
240
240
|
Max: 22
|
241
241
|
|
@@ -250,13 +250,13 @@ Naming/AccessorMethodName:
|
|
250
250
|
- 'lib/mail_room/configuration.rb'
|
251
251
|
|
252
252
|
# Offense count: 1
|
253
|
-
# This cop supports
|
253
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
254
254
|
Security/YAMLLoad:
|
255
255
|
Exclude:
|
256
256
|
- 'lib/mail_room/configuration.rb'
|
257
257
|
|
258
258
|
# Offense count: 1
|
259
|
-
# This cop supports safe
|
259
|
+
# This cop supports safe autocorrection (--autocorrect).
|
260
260
|
# Configuration parameters: EnforcedStyle.
|
261
261
|
# SupportedStyles: prefer_alias, prefer_alias_method
|
262
262
|
Style/Alias:
|
@@ -264,12 +264,12 @@ Style/Alias:
|
|
264
264
|
- 'lib/mail_room/coordinator.rb'
|
265
265
|
|
266
266
|
# Offense count: 16
|
267
|
-
# This cop supports safe
|
268
|
-
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods,
|
267
|
+
# This cop supports safe autocorrection (--autocorrect).
|
268
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
269
269
|
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
270
270
|
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
271
271
|
# FunctionalMethods: let, let!, subject, watch
|
272
|
-
#
|
272
|
+
# AllowedMethods: lambda, proc, it
|
273
273
|
Style/BlockDelimiters:
|
274
274
|
Exclude:
|
275
275
|
- 'spec/lib/arbitration/redis_spec.rb'
|
@@ -277,7 +277,7 @@ Style/BlockDelimiters:
|
|
277
277
|
- 'spec/lib/delivery/que_spec.rb'
|
278
278
|
- 'spec/lib/delivery/sidekiq_spec.rb'
|
279
279
|
|
280
|
-
# Offense count:
|
280
|
+
# Offense count: 14
|
281
281
|
# Configuration parameters: AllowedConstants.
|
282
282
|
Style/Documentation:
|
283
283
|
Exclude:
|
@@ -290,14 +290,16 @@ Style/Documentation:
|
|
290
290
|
- 'lib/mail_room/connection.rb'
|
291
291
|
- 'lib/mail_room/crash_handler.rb'
|
292
292
|
- 'lib/mail_room/delivery.rb'
|
293
|
+
- 'lib/mail_room/imap.rb'
|
293
294
|
- 'lib/mail_room/imap/connection.rb'
|
294
295
|
- 'lib/mail_room/imap/message.rb'
|
295
296
|
- 'lib/mail_room/logger/structured.rb'
|
296
297
|
- 'lib/mail_room/message.rb'
|
298
|
+
- 'lib/mail_room/microsoft_graph.rb'
|
297
299
|
- 'lib/mail_room/microsoft_graph/connection.rb'
|
298
300
|
|
299
301
|
# Offense count: 2
|
300
|
-
# This cop supports safe
|
302
|
+
# This cop supports safe autocorrection (--autocorrect).
|
301
303
|
# Configuration parameters: EnforcedStyle.
|
302
304
|
# SupportedStyles: compact, expanded
|
303
305
|
Style/EmptyMethod:
|
@@ -306,27 +308,27 @@ Style/EmptyMethod:
|
|
306
308
|
- 'lib/mail_room/delivery/noop.rb'
|
307
309
|
|
308
310
|
# Offense count: 1
|
309
|
-
# This cop supports safe
|
311
|
+
# This cop supports safe autocorrection (--autocorrect).
|
310
312
|
Style/Encoding:
|
311
313
|
Exclude:
|
312
314
|
- 'mail_room.gemspec'
|
313
315
|
|
314
316
|
# Offense count: 2
|
315
|
-
# This cop supports safe
|
317
|
+
# This cop supports safe autocorrection (--autocorrect).
|
316
318
|
Style/ExpandPathArguments:
|
317
319
|
Exclude:
|
318
320
|
- 'mail_room.gemspec'
|
319
321
|
- 'spec/spec_helper.rb'
|
320
322
|
|
321
323
|
# Offense count: 39
|
322
|
-
# This cop supports
|
324
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
323
325
|
# Configuration parameters: EnforcedStyle.
|
324
326
|
# SupportedStyles: always, always_true, never
|
325
327
|
Style/FrozenStringLiteralComment:
|
326
328
|
Enabled: false
|
327
329
|
|
328
330
|
# Offense count: 5
|
329
|
-
# This cop supports
|
331
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
330
332
|
Style/GlobalStdStream:
|
331
333
|
Exclude:
|
332
334
|
- 'lib/mail_room/crash_handler.rb'
|
@@ -335,7 +337,8 @@ Style/GlobalStdStream:
|
|
335
337
|
- 'spec/lib/delivery/logger_spec.rb'
|
336
338
|
|
337
339
|
# Offense count: 3
|
338
|
-
#
|
340
|
+
# This cop supports safe autocorrection (--autocorrect).
|
341
|
+
# Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
|
339
342
|
Style/GuardClause:
|
340
343
|
Exclude:
|
341
344
|
- 'lib/mail_room/configuration.rb'
|
@@ -343,22 +346,22 @@ Style/GuardClause:
|
|
343
346
|
- 'lib/mail_room/mailbox_watcher.rb'
|
344
347
|
|
345
348
|
# Offense count: 1
|
346
|
-
# This cop supports safe
|
349
|
+
# This cop supports safe autocorrection (--autocorrect).
|
347
350
|
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
348
351
|
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
349
|
-
# SupportedShorthandSyntax: always, never, either
|
352
|
+
# SupportedShorthandSyntax: always, never, either, consistent
|
350
353
|
Style/HashSyntax:
|
351
354
|
Exclude:
|
352
355
|
- 'spec/lib/microsoft_graph/connection_spec.rb'
|
353
356
|
|
354
357
|
# Offense count: 1
|
355
|
-
# This cop supports safe
|
358
|
+
# This cop supports safe autocorrection (--autocorrect).
|
356
359
|
Style/IfUnlessModifier:
|
357
360
|
Exclude:
|
358
361
|
- 'lib/mail_room/mailbox_watcher.rb'
|
359
362
|
|
360
363
|
# Offense count: 5
|
361
|
-
# This cop supports
|
364
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
362
365
|
# Configuration parameters: EnforcedStyle.
|
363
366
|
# SupportedStyles: literals, strict
|
364
367
|
Style/MutableConstant:
|
@@ -369,8 +372,8 @@ Style/MutableConstant:
|
|
369
372
|
- 'spec/spec_helper.rb'
|
370
373
|
|
371
374
|
# Offense count: 1
|
372
|
-
# This cop supports unsafe
|
373
|
-
# Configuration parameters: EnforcedStyle,
|
375
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
376
|
+
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
374
377
|
# SupportedStyles: predicate, comparison
|
375
378
|
Style/NumericPredicate:
|
376
379
|
Exclude:
|
@@ -378,7 +381,7 @@ Style/NumericPredicate:
|
|
378
381
|
- 'lib/mail_room/imap/connection.rb'
|
379
382
|
|
380
383
|
# Offense count: 2
|
381
|
-
# This cop supports unsafe
|
384
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
382
385
|
# Configuration parameters: EnforcedStyle.
|
383
386
|
# SupportedStyles: short, verbose
|
384
387
|
Style/PreferredHashMethods:
|
@@ -387,7 +390,7 @@ Style/PreferredHashMethods:
|
|
387
390
|
- 'lib/mail_room/mailbox.rb'
|
388
391
|
|
389
392
|
# Offense count: 1
|
390
|
-
# This cop supports safe
|
393
|
+
# This cop supports safe autocorrection (--autocorrect).
|
391
394
|
# Configuration parameters: EnforcedStyle, AllowedCompactTypes.
|
392
395
|
# SupportedStyles: compact, exploded
|
393
396
|
Style/RaiseArgs:
|
@@ -395,13 +398,13 @@ Style/RaiseArgs:
|
|
395
398
|
- 'lib/mail_room/logger/structured.rb'
|
396
399
|
|
397
400
|
# Offense count: 2
|
398
|
-
# This cop supports safe
|
401
|
+
# This cop supports safe autocorrection (--autocorrect).
|
399
402
|
Style/RedundantPercentQ:
|
400
403
|
Exclude:
|
401
404
|
- 'mail_room.gemspec'
|
402
405
|
|
403
406
|
# Offense count: 7
|
404
|
-
# This cop supports safe
|
407
|
+
# This cop supports safe autocorrection (--autocorrect).
|
405
408
|
Style/RedundantSelf:
|
406
409
|
Exclude:
|
407
410
|
- 'lib/mail_room/configuration.rb'
|
@@ -410,7 +413,7 @@ Style/RedundantSelf:
|
|
410
413
|
- 'lib/mail_room/mailbox_watcher.rb'
|
411
414
|
|
412
415
|
# Offense count: 1
|
413
|
-
# This cop supports safe
|
416
|
+
# This cop supports safe autocorrection (--autocorrect).
|
414
417
|
# Configuration parameters: EnforcedStyle.
|
415
418
|
# SupportedStyles: implicit, explicit
|
416
419
|
Style/RescueStandardError:
|
@@ -418,37 +421,37 @@ Style/RescueStandardError:
|
|
418
421
|
- 'lib/mail_room/configuration.rb'
|
419
422
|
|
420
423
|
# Offense count: 1
|
421
|
-
# This cop supports
|
422
|
-
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
|
424
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
425
|
+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
|
423
426
|
# AllowedMethods: present?, blank?, presence, try, try!
|
424
427
|
Style/SafeNavigation:
|
425
428
|
Exclude:
|
426
429
|
- 'lib/mail_room/mailbox_watcher.rb'
|
427
430
|
|
428
431
|
# Offense count: 1
|
429
|
-
# This cop supports
|
432
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
430
433
|
# Configuration parameters: RequireEnglish, EnforcedStyle.
|
431
|
-
# SupportedStyles: use_perl_names, use_english_names
|
434
|
+
# SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names
|
432
435
|
Style/SpecialGlobalVars:
|
433
436
|
Exclude:
|
434
437
|
- 'mail_room.gemspec'
|
435
438
|
|
436
439
|
# Offense count: 1
|
437
|
-
# This cop supports unsafe
|
440
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
438
441
|
# Configuration parameters: Mode.
|
439
442
|
Style/StringConcatenation:
|
440
443
|
Exclude:
|
441
444
|
- 'lib/mail_room/logger/structured.rb'
|
442
445
|
|
443
|
-
# Offense count:
|
444
|
-
# This cop supports safe
|
446
|
+
# Offense count: 142
|
447
|
+
# This cop supports safe autocorrection (--autocorrect).
|
445
448
|
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
446
449
|
# SupportedStyles: single_quotes, double_quotes
|
447
450
|
Style/StringLiterals:
|
448
451
|
Enabled: false
|
449
452
|
|
450
453
|
# Offense count: 4
|
451
|
-
# This cop supports safe
|
454
|
+
# This cop supports safe autocorrection (--autocorrect).
|
452
455
|
# Configuration parameters: EnforcedStyle, MinSize.
|
453
456
|
# SupportedStyles: percent, brackets
|
454
457
|
Style/SymbolArray:
|
@@ -457,7 +460,7 @@ Style/SymbolArray:
|
|
457
460
|
- 'spec/lib/logger/structured_spec.rb'
|
458
461
|
|
459
462
|
# Offense count: 2
|
460
|
-
# This cop supports safe
|
463
|
+
# This cop supports safe autocorrection (--autocorrect).
|
461
464
|
# Configuration parameters: EnforcedStyleForMultiline.
|
462
465
|
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
463
466
|
Style/TrailingCommaInHashLiteral:
|
@@ -466,20 +469,20 @@ Style/TrailingCommaInHashLiteral:
|
|
466
469
|
- 'spec/spec_helper.rb'
|
467
470
|
|
468
471
|
# Offense count: 1
|
469
|
-
# This cop supports safe
|
472
|
+
# This cop supports safe autocorrection (--autocorrect).
|
470
473
|
Style/WhileUntilDo:
|
471
474
|
Exclude:
|
472
475
|
- 'lib/mail_room/mailbox_watcher.rb'
|
473
476
|
|
474
477
|
# Offense count: 2
|
475
|
-
# This cop supports safe
|
478
|
+
# This cop supports safe autocorrection (--autocorrect).
|
476
479
|
Style/WhileUntilModifier:
|
477
480
|
Exclude:
|
478
481
|
- 'lib/mail_room/coordinator.rb'
|
479
482
|
- 'lib/mail_room/mailbox_watcher.rb'
|
480
483
|
|
481
484
|
# Offense count: 3
|
482
|
-
# This cop supports safe
|
485
|
+
# This cop supports safe autocorrection (--autocorrect).
|
483
486
|
# Configuration parameters: WordRegex.
|
484
487
|
# SupportedStyles: percent, brackets
|
485
488
|
Style/WordArray:
|
@@ -487,8 +490,8 @@ Style/WordArray:
|
|
487
490
|
MinSize: 3
|
488
491
|
|
489
492
|
# Offense count: 7
|
490
|
-
# This cop supports safe
|
491
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives,
|
493
|
+
# This cop supports safe autocorrection (--autocorrect).
|
494
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
492
495
|
# URISchemes: http, https
|
493
496
|
Layout/LineLength:
|
494
497
|
Max: 177
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2
|
1
|
+
3.2
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 3.2.2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## mail_room 0.11.1 ##
|
2
|
+
|
3
|
+
https://github.com/tpitale/mail_room/compare/v0.11.0...v0.11.1
|
4
|
+
|
5
|
+
## mail_room 0.11.0 ##
|
6
|
+
|
7
|
+
https://github.com/tpitale/mail_room/compare/v0.10.1...v0.11.0
|
8
|
+
|
1
9
|
## mail_room 0.10.1 ##
|
2
10
|
|
3
11
|
* Fix db attribute on redis URL PR#130 - @jarkaK
|
data/README.md
CHANGED
@@ -183,11 +183,11 @@ If you're seeing the error `Please log in via your web browser: https://support.
|
|
183
183
|
### Microsoft Graph configuration
|
184
184
|
|
185
185
|
To use the Microsoft Graph API instead of IMAP to read e-mail, you will
|
186
|
-
need to create an application in
|
187
|
-
[Microsoft instructions](https://
|
186
|
+
need to create an application in Microsoft Entra ID (formerly known as Azure Active Directory). See the
|
187
|
+
[Microsoft instructions](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app) for more details:
|
188
188
|
|
189
189
|
1. Sign in to the [Azure portal](https://portal.azure.com).
|
190
|
-
1. Search for and select `
|
190
|
+
1. Search for and select `Microsoft Entra ID`.
|
191
191
|
1. Under `Manage`, select `App registrations` > `New registration`.
|
192
192
|
1. Enter a `Name` for your application, such as `MailRoom`. Users of your app might see this name, and you can change it later.
|
193
193
|
1. If `Supported account types` is listed, select the appropriate option.
|
@@ -282,7 +282,7 @@ Delivery options:
|
|
282
282
|
Required, defaults to `redis://localhost:6379`.
|
283
283
|
- **sentinels**: A list of sentinels servers used to provide HA to Redis. (see [Sentinel Support](#sentinel-support))
|
284
284
|
Optional.
|
285
|
-
- **namespace**: The Redis namespace Sidekiq works under. Use the same Redis namespace that's used to configure Sidekiq.
|
285
|
+
- **namespace**: [DEPRECATED] The Redis namespace Sidekiq works under. Use the same Redis namespace that's used to configure Sidekiq.
|
286
286
|
Optional.
|
287
287
|
- **queue**: The Sidekiq queue the job is pushed onto. Make sure Sidekiq actually reads off this queue.
|
288
288
|
Required, defaults to `default`.
|
@@ -426,7 +426,7 @@ When running multiple instances of MailRoom against a single mailbox, to try to
|
|
426
426
|
:arbitration_options:
|
427
427
|
# The Redis server to connect with. Defaults to redis://localhost:6379.
|
428
428
|
:redis_url: redis://redis.example.com:6379
|
429
|
-
# The Redis namespace to house the Redis keys under. Optional.
|
429
|
+
# [DEPRECATED] The Redis namespace to house the Redis keys under. Optional.
|
430
430
|
:namespace: mail_room
|
431
431
|
-
|
432
432
|
:email: "user2@gmail.com"
|
@@ -446,7 +446,7 @@ When running multiple instances of MailRoom against a single mailbox, to try to
|
|
446
446
|
-
|
447
447
|
:host: 127.0.0.1
|
448
448
|
:port: 26379
|
449
|
-
# The Redis namespace to house the Redis keys under. Optional.
|
449
|
+
# [DEPRECATED] The Redis namespace to house the Redis keys under. Optional.
|
450
450
|
:namespace: mail_room
|
451
451
|
```
|
452
452
|
|
@@ -489,13 +489,3 @@ respectively and MailRoom will log there.
|
|
489
489
|
4. Push to the branch (`git push origin my-new-feature`)
|
490
490
|
5. Create new Pull Request
|
491
491
|
6. If accepted, ask for commit rights
|
492
|
-
|
493
|
-
## TODO ##
|
494
|
-
|
495
|
-
1. specs, this is just a (working) proof of concept √
|
496
|
-
2. finish code for POSTing to callback with auth √
|
497
|
-
3. accept mailbox configuration for one account directly on the commandline; or ask for it
|
498
|
-
4. add example rails endpoint, with auth examples
|
499
|
-
5. add example configs for upstart/init.d √
|
500
|
-
6. log to stdout √
|
501
|
-
7. add a development mode that opens in letter_opener by ryanb √
|
@@ -3,13 +3,22 @@ require "redis"
|
|
3
3
|
module MailRoom
|
4
4
|
module Arbitration
|
5
5
|
class Redis
|
6
|
-
Options = Struct.new(:redis_url, :namespace, :sentinels) do
|
6
|
+
Options = Struct.new(:redis_url, :namespace, :sentinels, :sentinel_username, :sentinel_password) do
|
7
7
|
def initialize(mailbox)
|
8
8
|
redis_url = mailbox.arbitration_options[:redis_url] || "redis://localhost:6379"
|
9
9
|
namespace = mailbox.arbitration_options[:namespace]
|
10
10
|
sentinels = mailbox.arbitration_options[:sentinels]
|
11
|
+
sentinel_username = mailbox.arbitration_options[:sentinel_username]
|
12
|
+
sentinel_password = mailbox.arbitration_options[:sentinel_password]
|
11
13
|
|
12
|
-
|
14
|
+
if namespace
|
15
|
+
warn <<~MSG
|
16
|
+
Redis namespaces are deprecated. This option will be ignored in future versions.
|
17
|
+
See https://github.com/sidekiq/sidekiq/issues/2586 for more details."
|
18
|
+
MSG
|
19
|
+
end
|
20
|
+
|
21
|
+
super(redis_url, namespace, sentinels, sentinel_username, sentinel_password)
|
13
22
|
end
|
14
23
|
end
|
15
24
|
|
@@ -41,6 +50,8 @@ module MailRoom
|
|
41
50
|
sentinels = options.sentinels
|
42
51
|
redis_options = { url: options.redis_url }
|
43
52
|
redis_options[:sentinels] = sentinels if sentinels
|
53
|
+
redis_options[:sentinel_username] = options.sentinel_username if options.sentinel_username
|
54
|
+
redis_options[:sentinel_password] = options.sentinel_password if options.sentinel_password
|
44
55
|
|
45
56
|
redis = ::Redis.new(redis_options)
|
46
57
|
|
@@ -20,10 +20,10 @@ module MailRoom
|
|
20
20
|
|
21
21
|
jwt = initialize_jwt(mailbox.delivery_options)
|
22
22
|
|
23
|
-
username =
|
23
|
+
username =
|
24
24
|
mailbox.delivery_options[:username] ||
|
25
25
|
mailbox.delivery_options[:delivery_username]
|
26
|
-
password =
|
26
|
+
password =
|
27
27
|
mailbox.delivery_options[:password] ||
|
28
28
|
mailbox.delivery_options[:delivery_password]
|
29
29
|
|
@@ -71,12 +71,9 @@ module MailRoom
|
|
71
71
|
connection = Faraday.new
|
72
72
|
|
73
73
|
if @delivery_options.token_auth?
|
74
|
-
connection
|
74
|
+
config_token_auth(connection)
|
75
75
|
elsif @delivery_options.basic_auth?
|
76
|
-
connection
|
77
|
-
@delivery_options.username,
|
78
|
-
@delivery_options.password
|
79
|
-
)
|
76
|
+
config_basic_auth(connection)
|
80
77
|
end
|
81
78
|
|
82
79
|
connection.post do |request|
|
@@ -103,6 +100,33 @@ module MailRoom
|
|
103
100
|
|
104
101
|
request.headers[@delivery_options.jwt.header] = @delivery_options.jwt.token
|
105
102
|
end
|
103
|
+
|
104
|
+
def config_token_auth(connection)
|
105
|
+
# connection.token_auth was removed in Faraday v2 in favor of connection.request(:authorization, 'Token', token)
|
106
|
+
if defined?(connection.token_auth)
|
107
|
+
connection.token_auth @delivery_options.token
|
108
|
+
else
|
109
|
+
connection.request(
|
110
|
+
:authorization, 'Token',
|
111
|
+
@delivery_options.token
|
112
|
+
)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
def config_basic_auth(connection)
|
117
|
+
if defined?(connection.basic_auth)
|
118
|
+
connection.basic_auth(
|
119
|
+
@delivery_options.username,
|
120
|
+
@delivery_options.password
|
121
|
+
)
|
122
|
+
else
|
123
|
+
connection.request(
|
124
|
+
:authorization, :basic,
|
125
|
+
@delivery_options.username,
|
126
|
+
@delivery_options.password
|
127
|
+
)
|
128
|
+
end
|
129
|
+
end
|
106
130
|
end
|
107
131
|
end
|
108
132
|
end
|
@@ -8,17 +8,26 @@ module MailRoom
|
|
8
8
|
# Sidekiq Delivery method
|
9
9
|
# @author Douwe Maan
|
10
10
|
class Sidekiq
|
11
|
-
Options = Struct.new(:redis_url, :namespace, :sentinels, :queue, :worker, :logger, :redis_db) do
|
11
|
+
Options = Struct.new(:redis_url, :namespace, :sentinels, :queue, :worker, :logger, :redis_db, :sentinel_username, :sentinel_password) do
|
12
12
|
def initialize(mailbox)
|
13
13
|
redis_url = mailbox.delivery_options[:redis_url] || "redis://localhost:6379"
|
14
14
|
redis_db = mailbox.delivery_options[:redis_db] || 0
|
15
15
|
namespace = mailbox.delivery_options[:namespace]
|
16
16
|
sentinels = mailbox.delivery_options[:sentinels]
|
17
|
+
sentinel_username = mailbox.delivery_options[:sentinel_username]
|
18
|
+
sentinel_password = mailbox.delivery_options[:sentinel_password]
|
17
19
|
queue = mailbox.delivery_options[:queue] || "default"
|
18
20
|
worker = mailbox.delivery_options[:worker]
|
19
21
|
logger = mailbox.logger
|
20
22
|
|
21
|
-
|
23
|
+
if namespace
|
24
|
+
warn <<~MSG
|
25
|
+
Redis namespaces are deprecated. This option will be ignored in future versions.
|
26
|
+
See https://github.com/sidekiq/sidekiq/issues/2586 for more details."
|
27
|
+
MSG
|
28
|
+
end
|
29
|
+
|
30
|
+
super(redis_url, namespace, sentinels, queue, worker, logger, redis_db, sentinel_username, sentinel_password)
|
22
31
|
end
|
23
32
|
end
|
24
33
|
|
@@ -48,6 +57,8 @@ module MailRoom
|
|
48
57
|
sentinels = options.sentinels
|
49
58
|
redis_options = { url: options.redis_url, db: options.redis_db }
|
50
59
|
redis_options[:sentinels] = sentinels if sentinels
|
60
|
+
redis_options[:sentinel_username] = options.sentinel_username if options.sentinel_username
|
61
|
+
redis_options[:sentinel_password] = options.sentinel_password if options.sentinel_password
|
51
62
|
|
52
63
|
redis = ::Redis.new(redis_options)
|
53
64
|
|
data/lib/mail_room/version.rb
CHANGED
data/mail_room.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["tpitale@gmail.com"]
|
11
11
|
gem.description = %q{mail_room will proxy email (gmail) from IMAP to a delivery method}
|
12
12
|
gem.summary = %q{mail_room will proxy email (gmail) from IMAP to a callback URL, logger, or letter_opener}
|
13
|
-
gem.homepage = "
|
13
|
+
gem.homepage = "https://gitlab.com/gitlab-org/ruby/gems/gitlab-mail_room"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
@@ -20,11 +20,13 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.add_dependency "net-imap", ">= 0.2.1"
|
21
21
|
gem.add_dependency "oauth2", [">= 1.4.4", "< 3"]
|
22
22
|
gem.add_dependency "jwt", ">= 2.0"
|
23
|
+
gem.add_dependency "redis", [">= 5", "< 6"]
|
24
|
+
gem.add_dependency "redis-namespace", '>= 1.8.2'
|
23
25
|
|
24
26
|
gem.add_development_dependency "rake"
|
25
27
|
gem.add_development_dependency "rspec", "~> 3.9"
|
26
28
|
gem.add_development_dependency "rubocop", "~> 1.11"
|
27
|
-
gem.add_development_dependency "mocha", "~>
|
29
|
+
gem.add_development_dependency "mocha", "~> 2.0"
|
28
30
|
gem.add_development_dependency "simplecov"
|
29
31
|
gem.add_development_dependency "webrick", "~> 1.6"
|
30
32
|
|
@@ -32,8 +34,6 @@ Gem::Specification.new do |gem|
|
|
32
34
|
gem.add_development_dependency "faraday"
|
33
35
|
gem.add_development_dependency "mail"
|
34
36
|
gem.add_development_dependency "letter_opener"
|
35
|
-
gem.add_development_dependency "redis", "~> 4"
|
36
|
-
gem.add_development_dependency "redis-namespace"
|
37
37
|
gem.add_development_dependency "pg"
|
38
38
|
gem.add_development_dependency "charlock_holmes"
|
39
39
|
gem.add_development_dependency "webmock"
|
@@ -96,7 +96,7 @@ describe MailRoom::Arbitration::Redis do
|
|
96
96
|
it 'client has same specified url' do
|
97
97
|
subject.deliver?(123)
|
98
98
|
|
99
|
-
expect(raw_client.
|
99
|
+
expect(raw_client.config.server_url).to eq redis_url
|
100
100
|
end
|
101
101
|
|
102
102
|
it 'client is a instance of Redis class' do
|
@@ -135,13 +135,38 @@ describe MailRoom::Arbitration::Redis do
|
|
135
135
|
)
|
136
136
|
}
|
137
137
|
|
138
|
-
before { ::
|
138
|
+
before { ::RedisClient::SentinelConfig.any_instance.stubs(:resolve_master).returns(RedisClient::Config.new(**sentinels.first)) }
|
139
139
|
|
140
140
|
it 'client has same specified sentinel params' do
|
141
|
-
expect(raw_client.
|
142
|
-
expect(raw_client.
|
143
|
-
expect(raw_client.
|
144
|
-
expect(raw_client.
|
141
|
+
expect(raw_client.config).to be_a RedisClient::SentinelConfig
|
142
|
+
expect(raw_client.config.name).to eq('sentinel-master')
|
143
|
+
expect(raw_client.config.host).to eq('10.0.0.1')
|
144
|
+
expect(raw_client.config.password).to eq('mypassword')
|
145
|
+
expect(raw_client.config.sentinels.map(&:server_url)).to eq(["redis://10.0.0.1:26379"])
|
146
|
+
end
|
147
|
+
|
148
|
+
context 'with separate Sentinel username and password' do
|
149
|
+
let(:sentinel_username) { 'my-sentinel-user' }
|
150
|
+
let(:sentinel_password) { 'my-sentinel-pass' }
|
151
|
+
let(:mailbox) {
|
152
|
+
build_mailbox(
|
153
|
+
arbitration_options: {
|
154
|
+
redis_url: redis_url,
|
155
|
+
sentinels: sentinels,
|
156
|
+
sentinel_username: sentinel_username,
|
157
|
+
sentinel_password: sentinel_password
|
158
|
+
}
|
159
|
+
)
|
160
|
+
}
|
161
|
+
|
162
|
+
it 'client uses Sentinel username and password' do
|
163
|
+
expect(raw_client.config).to be_a RedisClient::SentinelConfig
|
164
|
+
expect(raw_client.config.password).to eq('mypassword')
|
165
|
+
|
166
|
+
sentinels = raw_client.config.sentinels
|
167
|
+
expect(sentinels.map(&:username).uniq).to eq([sentinel_username])
|
168
|
+
expect(sentinels.map(&:password).uniq).to eq([sentinel_password])
|
169
|
+
end
|
145
170
|
end
|
146
171
|
end
|
147
172
|
end
|
@@ -8,7 +8,7 @@ describe MailRoom::Delivery::Sidekiq do
|
|
8
8
|
let(:options) { MailRoom::Delivery::Sidekiq::Options.new(mailbox) }
|
9
9
|
|
10
10
|
describe '#options' do
|
11
|
-
let(:redis_url) { 'redis://localhost' }
|
11
|
+
let(:redis_url) { 'redis://localhost:6379' }
|
12
12
|
let(:redis_options) { { redis_url: redis_url } }
|
13
13
|
|
14
14
|
context 'when only redis_url is specified' do
|
@@ -21,7 +21,7 @@ describe MailRoom::Delivery::Sidekiq do
|
|
21
21
|
|
22
22
|
context 'with simple redis url' do
|
23
23
|
it 'client has same specified redis_url' do
|
24
|
-
expect(raw_client.
|
24
|
+
expect(raw_client.config.server_url).to eq(redis_url)
|
25
25
|
end
|
26
26
|
|
27
27
|
it 'client is a instance of RedisNamespace class' do
|
@@ -40,12 +40,12 @@ describe MailRoom::Delivery::Sidekiq do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'client has correct redis_url' do
|
43
|
-
expect(raw_client.
|
43
|
+
expect(raw_client.config.server_url).to eq("#{redis_url}/4")
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'connection has correct values' do
|
47
|
-
expect(
|
48
|
-
expect(
|
47
|
+
expect(raw_client.config.host).to eq('localhost')
|
48
|
+
expect(raw_client.config.db).to eq(4)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -84,15 +84,41 @@ describe MailRoom::Delivery::Sidekiq do
|
|
84
84
|
)
|
85
85
|
}
|
86
86
|
|
87
|
-
before { ::
|
87
|
+
before { ::RedisClient::SentinelConfig.any_instance.stubs(:resolve_master).returns(RedisClient::Config.new(**sentinels.first)) }
|
88
88
|
|
89
89
|
it 'client has same specified sentinel params' do
|
90
|
-
expect(raw_client.
|
91
|
-
expect(raw_client.
|
92
|
-
expect(raw_client.
|
93
|
-
expect(raw_client.
|
90
|
+
expect(raw_client.config).to be_a RedisClient::SentinelConfig
|
91
|
+
expect(raw_client.config.host).to eq('10.0.0.1')
|
92
|
+
expect(raw_client.config.name).to eq('sentinel-master')
|
93
|
+
expect(raw_client.config.password).to eq('mypassword')
|
94
|
+
expect(raw_client.config.sentinels.map(&:server_url)).to eq(["redis://10.0.0.1:26379"])
|
94
95
|
end
|
95
|
-
end
|
96
96
|
|
97
|
+
context 'with separate Sentinel username and password' do
|
98
|
+
let(:sentinel_username) { 'my-sentinel-user' }
|
99
|
+
let(:sentinel_password) { 'my-sentinel-pass' }
|
100
|
+
let(:mailbox) {
|
101
|
+
build_mailbox(
|
102
|
+
delivery_method: :sidekiq,
|
103
|
+
delivery_options: {
|
104
|
+
redis_url: redis_url,
|
105
|
+
sentinels: sentinels,
|
106
|
+
sentinel_username: sentinel_username,
|
107
|
+
sentinel_password: sentinel_password
|
108
|
+
}
|
109
|
+
)
|
110
|
+
}
|
111
|
+
|
112
|
+
it 'client uses Sentinel username and password' do
|
113
|
+
expect(raw_client.config).to be_a RedisClient::SentinelConfig
|
114
|
+
expect(raw_client.config.password).to eq('mypassword')
|
115
|
+
|
116
|
+
sentinels = raw_client.config.sentinels
|
117
|
+
|
118
|
+
expect(sentinels.map(&:username).uniq).to eq([sentinel_username])
|
119
|
+
expect(sentinels.map(&:password).uniq).to eq([sentinel_password])
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
97
123
|
end
|
98
124
|
end
|
@@ -34,12 +34,14 @@ describe MailRoom::HealthCheck do
|
|
34
34
|
|
35
35
|
describe '#run' do
|
36
36
|
it 'sets running to true' do
|
37
|
-
server = stub(start: true)
|
37
|
+
server = stub(start: true, shutdown: true)
|
38
38
|
subject.stubs(:create_server).returns(server)
|
39
39
|
|
40
40
|
subject.run
|
41
41
|
|
42
42
|
expect(subject.running).to be true
|
43
|
+
|
44
|
+
subject.quit
|
43
45
|
end
|
44
46
|
end
|
45
47
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-mail_room
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Pitale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-imap
|
@@ -58,6 +58,40 @@ dependencies:
|
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '2.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: redis
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '5'
|
68
|
+
- - "<"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '6'
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '5'
|
78
|
+
- - "<"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '6'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: redis-namespace
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 1.8.2
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 1.8.2
|
61
95
|
- !ruby/object:Gem::Dependency
|
62
96
|
name: rake
|
63
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -106,14 +140,14 @@ dependencies:
|
|
106
140
|
requirements:
|
107
141
|
- - "~>"
|
108
142
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
143
|
+
version: '2.0'
|
110
144
|
type: :development
|
111
145
|
prerelease: false
|
112
146
|
version_requirements: !ruby/object:Gem::Requirement
|
113
147
|
requirements:
|
114
148
|
- - "~>"
|
115
149
|
- !ruby/object:Gem::Version
|
116
|
-
version: '
|
150
|
+
version: '2.0'
|
117
151
|
- !ruby/object:Gem::Dependency
|
118
152
|
name: simplecov
|
119
153
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,34 +218,6 @@ dependencies:
|
|
184
218
|
- - ">="
|
185
219
|
- !ruby/object:Gem::Version
|
186
220
|
version: '0'
|
187
|
-
- !ruby/object:Gem::Dependency
|
188
|
-
name: redis
|
189
|
-
requirement: !ruby/object:Gem::Requirement
|
190
|
-
requirements:
|
191
|
-
- - "~>"
|
192
|
-
- !ruby/object:Gem::Version
|
193
|
-
version: '4'
|
194
|
-
type: :development
|
195
|
-
prerelease: false
|
196
|
-
version_requirements: !ruby/object:Gem::Requirement
|
197
|
-
requirements:
|
198
|
-
- - "~>"
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
version: '4'
|
201
|
-
- !ruby/object:Gem::Dependency
|
202
|
-
name: redis-namespace
|
203
|
-
requirement: !ruby/object:Gem::Requirement
|
204
|
-
requirements:
|
205
|
-
- - ">="
|
206
|
-
- !ruby/object:Gem::Version
|
207
|
-
version: '0'
|
208
|
-
type: :development
|
209
|
-
prerelease: false
|
210
|
-
version_requirements: !ruby/object:Gem::Requirement
|
211
|
-
requirements:
|
212
|
-
- - ">="
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
version: '0'
|
215
221
|
- !ruby/object:Gem::Dependency
|
216
222
|
name: pg
|
217
223
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,6 +268,8 @@ executables:
|
|
262
268
|
extensions: []
|
263
269
|
extra_rdoc_files: []
|
264
270
|
files:
|
271
|
+
- ".github/dependabot.yml"
|
272
|
+
- ".github/workflows/ci.yml"
|
265
273
|
- ".gitignore"
|
266
274
|
- ".gitlab-ci.yml"
|
267
275
|
- ".gitlab/issue_templates/Default.md"
|
@@ -269,7 +277,7 @@ files:
|
|
269
277
|
- ".rubocop.yml"
|
270
278
|
- ".rubocop_todo.yml"
|
271
279
|
- ".ruby-version"
|
272
|
-
- ".
|
280
|
+
- ".tool-versions"
|
273
281
|
- CHANGELOG.md
|
274
282
|
- CODE_OF_CONDUCT.md
|
275
283
|
- CONTRIBUTING.md
|
@@ -330,7 +338,7 @@ files:
|
|
330
338
|
- spec/lib/message_spec.rb
|
331
339
|
- spec/lib/microsoft_graph/connection_spec.rb
|
332
340
|
- spec/spec_helper.rb
|
333
|
-
homepage:
|
341
|
+
homepage: https://gitlab.com/gitlab-org/ruby/gems/gitlab-mail_room
|
334
342
|
licenses: []
|
335
343
|
metadata: {}
|
336
344
|
post_install_message:
|
@@ -348,7 +356,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
348
356
|
- !ruby/object:Gem::Version
|
349
357
|
version: '0'
|
350
358
|
requirements: []
|
351
|
-
rubygems_version: 3.4
|
359
|
+
rubygems_version: 3.5.4
|
352
360
|
signing_key:
|
353
361
|
specification_version: 4
|
354
362
|
summary: mail_room will proxy email (gmail) from IMAP to a callback URL, logger, or
|