gitlab-mail_room 0.0.23 → 0.0.24

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: 1fa8e5569da85c3fa57acd7d2729af8f67429f281f13cc87fdbfdd8d533f3ee9
4
- data.tar.gz: 50d4dccc94549ff477922d7318115e1992a87566e6d159d50f046015cf875e10
3
+ metadata.gz: 0e4c047999e1f2e3d77862ea0e65f146fe92c89de4d0367892649d518de8ad66
4
+ data.tar.gz: 36000daee0622b345eea3be14143652ce335ea9441ab012a4088d0038b7bef8c
5
5
  SHA512:
6
- metadata.gz: 2e4d8fe88a968459036de06624cd917b3e68a6f4bf5a5cd1bcbb9e0d466dcff8608cead170a8e813f45bcccc2b5c342d603732b9520314d8792c23e4523d91ff
7
- data.tar.gz: 5de2450bbd78041a19c4996ebaa74b2497af0e7362c4e6e5338ccc10a740bc4cc13a508bd3cc7cea55a7eabd7da25365b544d7baa0e33dd134c40b0bd1a0f577
6
+ metadata.gz: 9693c9ee292e8e45025d251c720d4bda9f80b121aa0524c6c2bad0924b5ec731fcb017f91641c27adf2c7a3321a59345d1f0b80177bbde998ac5b42bc080a13d
7
+ data.tar.gz: d8c733b9eaef28122e6b2533e1e5fca6a0aba6581b07be93189f498f38ad4845ef624016258c339a2e6cd8ac56e7eb2fbe3c52a9724d5d9363deb58ed1d8d431
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "bundler"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "daily"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "weekly"
@@ -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@v3
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@v3
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
@@ -10,7 +10,7 @@ services:
10
10
  paths:
11
11
  - vendor/ruby
12
12
  variables:
13
- REDIS_URL: redis://redis:6379
13
+ REDIS_URL: redis://redis:6379/0
14
14
  before_script:
15
15
  - apt update && apt install -y libicu-dev
16
16
  - ruby -v # Print out ruby version for debugging
data/.rubocop.yml CHANGED
@@ -3,3 +3,4 @@ inherit_from: .rubocop_todo.yml
3
3
  Style/HashSyntax:
4
4
  Enabled: true
5
5
  EnforcedStyle: ruby19_no_mixed_keys
6
+ EnforcedShorthandSyntax: either
data/.rubocop_todo.yml CHANGED
@@ -1,13 +1,13 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2022-03-15 06:29:40 UTC using RuboCop version 1.26.0.
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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: IgnoredMethods, CountRepeatedAttributes.
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, ExcludedMethods, IgnoredMethods.
223
- # IgnoredMethods: refine
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: IgnoredMethods.
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, ExcludedMethods, IgnoredMethods.
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 safe auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
268
- # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
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
- # IgnoredMethods: lambda, proc, it
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: 12
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 safe auto-correction (--auto-correct).
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 safe auto-correction (--auto-correct).
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
- # Configuration parameters: MinBodyLength.
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 safe auto-correction (--auto-correct).
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 auto-correction (--auto-correct-all).
373
- # Configuration parameters: EnforcedStyle, IgnoredMethods.
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 auto-correction (--auto-correct-all).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 safe auto-correction (--auto-correct).
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 safe auto-correction (--auto-correct).
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 auto-correction (--auto-correct-all).
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: 140
444
- # This cop supports safe auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
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 auto-correction (--auto-correct).
491
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
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/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 the Azure Active Directory. See the
187
- [Microsoft instructions](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app) for more details:
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 `Azure Active Directory`.
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
 
@@ -9,6 +9,13 @@ module MailRoom
9
9
  namespace = mailbox.arbitration_options[:namespace]
10
10
  sentinels = mailbox.arbitration_options[:sentinels]
11
11
 
12
+ if namespace
13
+ warn <<~MSG
14
+ Redis namespaces are deprecated. This option will be ignored in future versions.
15
+ See https://github.com/sidekiq/sidekiq/issues/2586 for more details."
16
+ MSG
17
+ end
18
+
12
19
  super(redis_url, namespace, sentinels)
13
20
  end
14
21
  end
@@ -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
 
@@ -73,10 +73,7 @@ module MailRoom
73
73
  if @delivery_options.token_auth?
74
74
  connection.token_auth @delivery_options.token
75
75
  elsif @delivery_options.basic_auth?
76
- connection.basic_auth(
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,21 @@ module MailRoom
103
100
 
104
101
  request.headers[@delivery_options.jwt.header] = @delivery_options.jwt.token
105
102
  end
103
+
104
+ def config_basic_auth(connection)
105
+ if defined?(connection.basic_auth)
106
+ connection.basic_auth(
107
+ @delivery_options.username,
108
+ @delivery_options.password
109
+ )
110
+ else
111
+ connection.request(
112
+ :authorization, :basic,
113
+ @delivery_options.username,
114
+ @delivery_options.password
115
+ )
116
+ end
117
+ end
106
118
  end
107
119
  end
108
120
  end
@@ -18,6 +18,13 @@ module MailRoom
18
18
  worker = mailbox.delivery_options[:worker]
19
19
  logger = mailbox.logger
20
20
 
21
+ if namespace
22
+ warn <<~MSG
23
+ Redis namespaces are deprecated. This option will be ignored in future versions.
24
+ See https://github.com/sidekiq/sidekiq/issues/2586 for more details."
25
+ MSG
26
+ end
27
+
21
28
  super(redis_url, namespace, sentinels, queue, worker, logger, redis_db)
22
29
  end
23
30
  end
@@ -1,4 +1,4 @@
1
1
  module MailRoom
2
2
  # Current version of gitlab-mail_room gem
3
- VERSION = "0.0.23"
3
+ VERSION = "0.0.24"
4
4
  end
data/mail_room.gemspec CHANGED
@@ -20,6 +20,8 @@ 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", [">= 4", "< 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"
@@ -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"
@@ -11,12 +11,21 @@ describe MailRoom::Arbitration::Redis do
11
11
  )
12
12
  }
13
13
  let(:options) { described_class::Options.new(mailbox) }
14
+ let(:redis5) { Gem::Version.new(Redis::VERSION) >= Gem::Version.new('5.0') }
14
15
  subject { described_class.new(options) }
15
16
 
16
17
  # Private, but we don't care.
17
18
  let(:redis) { subject.send(:client) }
18
19
  let(:raw_client) { redis._client }
19
20
 
21
+ let(:server_url) do
22
+ if redis5
23
+ raw_client.config.server_url
24
+ else
25
+ raw_client.options[:url]
26
+ end
27
+ end
28
+
20
29
  describe '#deliver?' do
21
30
  context "when called the first time" do
22
31
  after do
@@ -80,7 +89,7 @@ describe MailRoom::Arbitration::Redis do
80
89
 
81
90
  context 'redis client connection params' do
82
91
  context 'when only url is present' do
83
- let(:redis_url) { ENV.fetch('REDIS_URL', 'redis://localhost:6379') }
92
+ let(:redis_url) { ENV.fetch('REDIS_URL', 'redis://localhost:6379/0') }
84
93
  let(:mailbox) {
85
94
  build_mailbox(
86
95
  arbitration_options: {
@@ -96,7 +105,7 @@ describe MailRoom::Arbitration::Redis do
96
105
  it 'client has same specified url' do
97
106
  subject.deliver?(123)
98
107
 
99
- expect(raw_client.options[:url]).to eq redis_url
108
+ expect(server_url).to eq redis_url
100
109
  end
101
110
 
102
111
  it 'client is a instance of Redis class' do
@@ -135,13 +144,18 @@ describe MailRoom::Arbitration::Redis do
135
144
  )
136
145
  }
137
146
 
138
- before { ::Redis::Client::Connector::Sentinel.any_instance.stubs(:resolve).returns(sentinels) }
139
-
140
147
  it 'client has same specified sentinel params' do
141
- expect(raw_client.instance_variable_get(:@connector)).to be_a Redis::Client::Connector::Sentinel
142
- expect(raw_client.options[:host]).to eq('sentinel-master')
143
- expect(raw_client.options[:password]).to eq('mypassword')
144
- expect(raw_client.options[:sentinels]).to eq(sentinels)
148
+ if redis5
149
+ expect(raw_client.config.password).to eq('mypassword')
150
+ client_sentinels = raw_client.config.sentinels
151
+ expect(client_sentinels.length).to eq(sentinels.length)
152
+ expect(client_sentinels[0].host).to eq('10.0.0.1')
153
+ expect(client_sentinels[0].port).to eq(26379) # rubocop:disable Style/NumericLiterals
154
+ else
155
+ expect(raw_client.options[:host]).to eq('sentinel-master')
156
+ expect(raw_client.options[:password]).to eq('mypassword')
157
+ expect(raw_client.options[:sentinels]).to eq(sentinels)
158
+ end
145
159
  end
146
160
  end
147
161
  end
@@ -6,6 +6,14 @@ describe MailRoom::Delivery::Sidekiq do
6
6
  let(:redis) { subject.send(:client) }
7
7
  let(:raw_client) { redis._client }
8
8
  let(:options) { MailRoom::Delivery::Sidekiq::Options.new(mailbox) }
9
+ let(:redis5) { Gem::Version.new(Redis::VERSION) >= Gem::Version.new('5.0') }
10
+ let(:server_url) do
11
+ if redis5
12
+ raw_client.config.server_url
13
+ else
14
+ raw_client.options[:url]
15
+ end
16
+ end
9
17
 
10
18
  describe '#options' do
11
19
  let(:redis_url) { 'redis://localhost' }
@@ -20,8 +28,10 @@ describe MailRoom::Delivery::Sidekiq do
20
28
  }
21
29
 
22
30
  context 'with simple redis url' do
31
+ let(:expected_url) { redis5 ? "#{redis_url}:6379/0" : redis_url }
32
+
23
33
  it 'client has same specified redis_url' do
24
- expect(raw_client.options[:url]).to eq(redis_url)
34
+ expect(raw_client.server_url).to eq(expected_url)
25
35
  end
26
36
 
27
37
  it 'client is a instance of RedisNamespace class' do
@@ -35,12 +45,14 @@ describe MailRoom::Delivery::Sidekiq do
35
45
  end
36
46
 
37
47
  context 'with redis_db specified in options' do
48
+ let(:expected_url) { redis5 ? "#{redis_url}:6379/4" : redis_url }
49
+
38
50
  before do
39
51
  redis_options[:redis_db] = 4
40
52
  end
41
53
 
42
54
  it 'client has correct redis_url' do
43
- expect(raw_client.options[:url]).to eq(redis_url)
55
+ expect(raw_client.server_url).to eq(expected_url)
44
56
  end
45
57
 
46
58
  it 'connection has correct values' do
@@ -84,15 +96,19 @@ describe MailRoom::Delivery::Sidekiq do
84
96
  )
85
97
  }
86
98
 
87
- before { ::Redis::Client::Connector::Sentinel.any_instance.stubs(:resolve).returns(sentinels) }
88
-
89
99
  it 'client has same specified sentinel params' do
90
- expect(raw_client.instance_variable_get(:@connector)).to be_a Redis::Client::Connector::Sentinel
91
- expect(raw_client.options[:host]).to eq('sentinel-master')
92
- expect(raw_client.options[:password]).to eq('mypassword')
93
- expect(raw_client.options[:sentinels]).to eq(sentinels)
100
+ if redis5
101
+ expect(raw_client.config.password).to eq('mypassword')
102
+ client_sentinels = raw_client.config.sentinels
103
+ expect(client_sentinels.length).to eq(sentinels.length)
104
+ expect(client_sentinels[0].host).to eq('10.0.0.1')
105
+ expect(client_sentinels[0].port).to eq(26379) # rubocop:disable Style/NumericLiterals
106
+ else
107
+ expect(raw_client.options[:host]).to eq('sentinel-master')
108
+ expect(raw_client.options[:password]).to eq('mypassword')
109
+ expect(raw_client.options[:sentinels]).to eq(sentinels)
110
+ end
94
111
  end
95
112
  end
96
-
97
113
  end
98
114
  end
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.23
4
+ version: 0.0.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Pitale
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-12 00:00:00.000000000 Z
11
+ date: 2023-12-08 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: '4'
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: '4'
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
@@ -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,6 @@ files:
269
277
  - ".rubocop.yml"
270
278
  - ".rubocop_todo.yml"
271
279
  - ".ruby-version"
272
- - ".travis.yml"
273
280
  - CHANGELOG.md
274
281
  - CODE_OF_CONDUCT.md
275
282
  - CONTRIBUTING.md
@@ -348,7 +355,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
348
355
  - !ruby/object:Gem::Version
349
356
  version: '0'
350
357
  requirements: []
351
- rubygems_version: 3.4.7
358
+ rubygems_version: 3.4.22
352
359
  signing_key:
353
360
  specification_version: 4
354
361
  summary: mail_room will proxy email (gmail) from IMAP to a callback URL, logger, or
data/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.5
4
- - 2.6
5
- - 2.7
6
- - 3.0
7
- - truffleruby
8
- services:
9
- - redis
10
- script:
11
- - bundle exec rspec spec
12
-
13
- jobs:
14
- - language: ruby
15
- rvm: 2.7
16
- script:
17
- - bundle exec rubocop