gitlab-mail_room 0.0.10 → 0.0.14
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/.gitlab/issue_templates/Release.md +1 -0
- data/.gitlab-ci.yml +0 -4
- data/.rubocop.yml +5 -0
- data/.rubocop_todo.yml +501 -0
- data/.travis.yml +9 -3
- data/README.md +88 -9
- data/Rakefile +1 -1
- data/lib/mail_room/arbitration/redis.rb +1 -1
- data/lib/mail_room/connection.rb +1 -3
- data/lib/mail_room/delivery/letter_opener.rb +1 -1
- data/lib/mail_room/delivery/sidekiq.rb +4 -3
- data/lib/mail_room/mailbox.rb +56 -17
- data/lib/mail_room/mailbox_watcher.rb +7 -1
- data/lib/mail_room/microsoft_graph/connection.rb +217 -0
- data/lib/mail_room/microsoft_graph.rb +7 -0
- data/lib/mail_room/version.rb +1 -1
- data/mail_room.gemspec +6 -0
- data/spec/lib/cli_spec.rb +3 -3
- data/spec/lib/configuration_spec.rb +1 -1
- data/spec/lib/delivery/letter_opener_spec.rb +2 -2
- data/spec/lib/delivery/logger_spec.rb +1 -1
- data/spec/lib/delivery/postback_spec.rb +11 -11
- data/spec/lib/delivery/sidekiq_spec.rb +29 -7
- data/spec/lib/mailbox_spec.rb +65 -17
- data/spec/lib/mailbox_watcher_spec.rb +54 -38
- data/spec/lib/microsoft_graph/connection_spec.rb +190 -0
- data/spec/spec_helper.rb +13 -3
- metadata +64 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6be406940356ef2cd8f9f0121c5d605cb4dabdcf1a8dba6a5d8ccc6726cc6977
|
4
|
+
data.tar.gz: 55d0a8aece3f5ec5c69ded80c2de37b609e96d475767ea77bc42be4c9be6fa99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 758daf7cb8ff1494f54f145400e9e46b93490a876c6a544268492c4cad3487b970798f9c73afaf63e9001420f8b08b861c7e8c0210c3eb86850f5576b687d29c
|
7
|
+
data.tar.gz: 6d0b716a7fe2c8f0f2d1c4042ca1f5eb2a7056b27c67aaa9b9b86d3de1c6658fb8a1ee21ff33da1e7f1c298612a7a795610e543c42ed37e291a67830a38ddfa5
|
@@ -3,5 +3,6 @@
|
|
3
3
|
- [ ] create tag in https://gitlab.com/gitlab-org/gitlab-mail_room/
|
4
4
|
- [ ] publish gem from this tag to rubygems.org
|
5
5
|
- [ ] update https://gitlab.com/gitlab-org/gitlab/-/blob/master/Gemfile to use the new gem version
|
6
|
+
- [ ] update https://gitlab.com/gitlab-org/omnibus-gitlab/-/blob/master/config/software/mail_room.rb to use the new gem version
|
6
7
|
- [ ] update gitlab-org/build/CNG to build container images from the new gem (example: https://gitlab.com/gitlab-org/build/CNG/-/merge_requests/451/diffs)
|
7
8
|
- [ ] to deploy the new version to gitlab.com, update gitlab-com/gl-infra/k8s-workloads/gitlab-com to pin the new mailroom container image version and assign it the [release managers](https://about.gitlab.com/community/release-managers/) (example: https://gitlab.com/gitlab-com/gl-infra/k8s-workloads/gitlab-com/-/merge_requests/236/diffs)
|
data/.gitlab-ci.yml
CHANGED
@@ -19,10 +19,6 @@ services:
|
|
19
19
|
- gem install bundler --no-document # Bundler is not installed with the image
|
20
20
|
- bundle install -j $(nproc) --path vendor # Install dependencies into ./vendor/ruby
|
21
21
|
|
22
|
-
rspec-2.5:
|
23
|
-
image: "ruby:2.5"
|
24
|
-
<<: *test
|
25
|
-
|
26
22
|
rspec-2.6:
|
27
23
|
image: "ruby:2.6"
|
28
24
|
<<: *test
|
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,501 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2021-04-26 06:46:39 UTC using RuboCop version 1.11.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 5
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include.
|
12
|
+
# Include: **/*.gemspec
|
13
|
+
Gemspec/OrderedDependencies:
|
14
|
+
Exclude:
|
15
|
+
- 'mail_room.gemspec'
|
16
|
+
|
17
|
+
# Offense count: 1
|
18
|
+
# Configuration parameters: Include.
|
19
|
+
# Include: **/*.gemspec
|
20
|
+
Gemspec/RequiredRubyVersion:
|
21
|
+
Exclude:
|
22
|
+
- 'mail_room.gemspec'
|
23
|
+
|
24
|
+
# Offense count: 4
|
25
|
+
# Cop supports --auto-correct.
|
26
|
+
Layout/BlockEndNewline:
|
27
|
+
Exclude:
|
28
|
+
- 'spec/lib/delivery/postback_spec.rb'
|
29
|
+
- 'spec/lib/delivery/que_spec.rb'
|
30
|
+
|
31
|
+
# Offense count: 5
|
32
|
+
# Cop supports --auto-correct.
|
33
|
+
# Configuration parameters: EnforcedStyle, IndentOneStep, IndentationWidth.
|
34
|
+
# SupportedStyles: case, end
|
35
|
+
Layout/CaseIndentation:
|
36
|
+
Exclude:
|
37
|
+
- 'lib/mail_room/mailbox.rb'
|
38
|
+
|
39
|
+
# Offense count: 1
|
40
|
+
# Cop supports --auto-correct.
|
41
|
+
Layout/EmptyLineAfterMagicComment:
|
42
|
+
Exclude:
|
43
|
+
- 'mail_room.gemspec'
|
44
|
+
|
45
|
+
# Offense count: 2
|
46
|
+
# Cop supports --auto-correct.
|
47
|
+
# Configuration parameters: EnforcedStyle.
|
48
|
+
# SupportedStyles: around, only_before
|
49
|
+
Layout/EmptyLinesAroundAccessModifier:
|
50
|
+
Exclude:
|
51
|
+
- 'lib/mail_room/coordinator.rb'
|
52
|
+
- 'lib/mail_room/delivery/que.rb'
|
53
|
+
|
54
|
+
# Offense count: 4
|
55
|
+
# Cop supports --auto-correct.
|
56
|
+
# Configuration parameters: EnforcedStyle.
|
57
|
+
# SupportedStyles: empty_lines, no_empty_lines
|
58
|
+
Layout/EmptyLinesAroundBlockBody:
|
59
|
+
Exclude:
|
60
|
+
- 'spec/lib/crash_handler_spec.rb'
|
61
|
+
- 'spec/lib/delivery/sidekiq_spec.rb'
|
62
|
+
- 'spec/lib/logger/structured_spec.rb'
|
63
|
+
|
64
|
+
# Offense count: 1
|
65
|
+
# Cop supports --auto-correct.
|
66
|
+
# Configuration parameters: EnforcedStyle.
|
67
|
+
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
|
68
|
+
Layout/EmptyLinesAroundClassBody:
|
69
|
+
Exclude:
|
70
|
+
- 'lib/mail_room/logger/structured.rb'
|
71
|
+
|
72
|
+
# Offense count: 13
|
73
|
+
# Cop supports --auto-correct.
|
74
|
+
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
75
|
+
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
76
|
+
Layout/FirstHashElementIndentation:
|
77
|
+
Exclude:
|
78
|
+
- 'spec/lib/delivery/postback_spec.rb'
|
79
|
+
- 'spec/lib/delivery/que_spec.rb'
|
80
|
+
- 'spec/lib/logger/structured_spec.rb'
|
81
|
+
|
82
|
+
# Offense count: 5
|
83
|
+
# Cop supports --auto-correct.
|
84
|
+
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
85
|
+
# SupportedHashRocketStyles: key, separator, table
|
86
|
+
# SupportedColonStyles: key, separator, table
|
87
|
+
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
88
|
+
Layout/HashAlignment:
|
89
|
+
Exclude:
|
90
|
+
- 'lib/mail_room/delivery/sidekiq.rb'
|
91
|
+
|
92
|
+
# Offense count: 2
|
93
|
+
# Cop supports --auto-correct.
|
94
|
+
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
|
95
|
+
Layout/LeadingCommentSpace:
|
96
|
+
Exclude:
|
97
|
+
- 'lib/mail_room/mailbox.rb'
|
98
|
+
- 'spec/lib/arbitration/redis_spec.rb'
|
99
|
+
|
100
|
+
# Offense count: 4
|
101
|
+
# Cop supports --auto-correct.
|
102
|
+
Layout/MultilineBlockLayout:
|
103
|
+
Exclude:
|
104
|
+
- 'spec/lib/delivery/postback_spec.rb'
|
105
|
+
- 'spec/lib/delivery/que_spec.rb'
|
106
|
+
|
107
|
+
# Offense count: 3
|
108
|
+
# Cop supports --auto-correct.
|
109
|
+
# Configuration parameters: EnforcedStyle.
|
110
|
+
# SupportedStyles: space, no_space
|
111
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
112
|
+
Exclude:
|
113
|
+
- 'lib/mail_room/configuration.rb'
|
114
|
+
- 'lib/mail_room/crash_handler.rb'
|
115
|
+
- 'lib/mail_room/mailbox.rb'
|
116
|
+
|
117
|
+
# Offense count: 2
|
118
|
+
# Cop supports --auto-correct.
|
119
|
+
Layout/SpaceAroundKeyword:
|
120
|
+
Exclude:
|
121
|
+
- 'lib/mail_room/coordinator.rb'
|
122
|
+
- 'lib/mail_room/mailbox_watcher.rb'
|
123
|
+
|
124
|
+
# Offense count: 2
|
125
|
+
# Cop supports --auto-correct.
|
126
|
+
# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator.
|
127
|
+
# SupportedStylesForExponentOperator: space, no_space
|
128
|
+
Layout/SpaceAroundOperators:
|
129
|
+
Exclude:
|
130
|
+
- 'lib/mail_room/mailbox.rb'
|
131
|
+
- 'spec/lib/arbitration/redis_spec.rb'
|
132
|
+
|
133
|
+
# Offense count: 7
|
134
|
+
# Cop supports --auto-correct.
|
135
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
136
|
+
# SupportedStyles: space, no_space
|
137
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
138
|
+
Layout/SpaceBeforeBlockBraces:
|
139
|
+
Exclude:
|
140
|
+
- 'mail_room.gemspec'
|
141
|
+
- 'spec/lib/crash_handler_spec.rb'
|
142
|
+
- 'spec/lib/mailbox_spec.rb'
|
143
|
+
|
144
|
+
# Offense count: 50
|
145
|
+
# Cop supports --auto-correct.
|
146
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
|
147
|
+
# SupportedStyles: space, no_space
|
148
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
149
|
+
Layout/SpaceInsideBlockBraces:
|
150
|
+
Exclude:
|
151
|
+
- 'lib/mail_room/coordinator.rb'
|
152
|
+
- 'spec/lib/cli_spec.rb'
|
153
|
+
- 'spec/lib/configuration_spec.rb'
|
154
|
+
- 'spec/lib/delivery/letter_opener_spec.rb'
|
155
|
+
- 'spec/lib/delivery/logger_spec.rb'
|
156
|
+
- 'spec/lib/delivery/postback_spec.rb'
|
157
|
+
- 'spec/lib/delivery/que_spec.rb'
|
158
|
+
- 'spec/lib/imap/connection_spec.rb'
|
159
|
+
- 'spec/lib/mailbox_watcher_spec.rb'
|
160
|
+
|
161
|
+
# Offense count: 34
|
162
|
+
# Cop supports --auto-correct.
|
163
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
164
|
+
# SupportedStyles: space, no_space, compact
|
165
|
+
# SupportedStylesForEmptyBraces: space, no_space
|
166
|
+
Layout/SpaceInsideHashLiteralBraces:
|
167
|
+
Exclude:
|
168
|
+
- 'lib/mail_room/arbitration/redis.rb'
|
169
|
+
- 'lib/mail_room/mailbox.rb'
|
170
|
+
- 'spec/lib/cli_spec.rb'
|
171
|
+
- 'spec/lib/mailbox_spec.rb'
|
172
|
+
|
173
|
+
# Offense count: 1
|
174
|
+
# Cop supports --auto-correct.
|
175
|
+
# Configuration parameters: EnforcedStyle.
|
176
|
+
# SupportedStyles: space, no_space
|
177
|
+
Layout/SpaceInsideParens:
|
178
|
+
Exclude:
|
179
|
+
- 'spec/lib/logger/structured_spec.rb'
|
180
|
+
|
181
|
+
# Offense count: 1
|
182
|
+
# Cop supports --auto-correct.
|
183
|
+
# Configuration parameters: EnforcedStyle.
|
184
|
+
# SupportedStyles: final_newline, final_blank_line
|
185
|
+
Layout/TrailingEmptyLines:
|
186
|
+
Exclude:
|
187
|
+
- 'spec/lib/delivery/letter_opener_spec.rb'
|
188
|
+
|
189
|
+
# Offense count: 7
|
190
|
+
# Cop supports --auto-correct.
|
191
|
+
# Configuration parameters: AllowInHeredoc.
|
192
|
+
Layout/TrailingWhitespace:
|
193
|
+
Exclude:
|
194
|
+
- 'lib/mail_room/coordinator.rb'
|
195
|
+
- 'lib/mail_room/imap.rb'
|
196
|
+
- 'spec/lib/coordinator_spec.rb'
|
197
|
+
- 'spec/lib/delivery/postback_spec.rb'
|
198
|
+
|
199
|
+
# Offense count: 5
|
200
|
+
# Configuration parameters: AllowedMethods.
|
201
|
+
# AllowedMethods: enums
|
202
|
+
Lint/ConstantDefinitionInBlock:
|
203
|
+
Exclude:
|
204
|
+
- 'lib/mail_room/mailbox.rb'
|
205
|
+
|
206
|
+
# Offense count: 1
|
207
|
+
Lint/RescueException:
|
208
|
+
Exclude:
|
209
|
+
- 'lib/mail_room/cli.rb'
|
210
|
+
|
211
|
+
# Offense count: 1
|
212
|
+
# Cop supports --auto-correct.
|
213
|
+
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
|
214
|
+
Lint/UnusedMethodArgument:
|
215
|
+
Exclude:
|
216
|
+
- 'lib/mail_room/logger/structured.rb'
|
217
|
+
|
218
|
+
# Offense count: 4
|
219
|
+
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
220
|
+
Metrics/AbcSize:
|
221
|
+
Max: 27
|
222
|
+
|
223
|
+
# Offense count: 27
|
224
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
225
|
+
# IgnoredMethods: refine
|
226
|
+
Metrics/BlockLength:
|
227
|
+
Max: 145
|
228
|
+
|
229
|
+
# Offense count: 3
|
230
|
+
# Configuration parameters: CountComments, CountAsOne.
|
231
|
+
Metrics/ClassLength:
|
232
|
+
Max: 151
|
233
|
+
|
234
|
+
# Offense count: 1
|
235
|
+
# Configuration parameters: IgnoredMethods.
|
236
|
+
Metrics/CyclomaticComplexity:
|
237
|
+
Max: 8
|
238
|
+
|
239
|
+
# Offense count: 13
|
240
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
241
|
+
Metrics/MethodLength:
|
242
|
+
Max: 22
|
243
|
+
|
244
|
+
# Offense count: 1
|
245
|
+
# Configuration parameters: CountComments, CountAsOne.
|
246
|
+
Metrics/ModuleLength:
|
247
|
+
Max: 172
|
248
|
+
|
249
|
+
# Offense count: 1
|
250
|
+
Naming/AccessorMethodName:
|
251
|
+
Exclude:
|
252
|
+
- 'lib/mail_room/configuration.rb'
|
253
|
+
|
254
|
+
# Offense count: 1
|
255
|
+
# Cop supports --auto-correct.
|
256
|
+
Security/YAMLLoad:
|
257
|
+
Exclude:
|
258
|
+
- 'lib/mail_room/configuration.rb'
|
259
|
+
|
260
|
+
# Offense count: 2
|
261
|
+
# Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols.
|
262
|
+
# SupportedStyles: inline, group
|
263
|
+
Style/AccessModifierDeclarations:
|
264
|
+
Exclude:
|
265
|
+
- 'lib/mail_room/arbitration.rb'
|
266
|
+
- 'lib/mail_room/delivery.rb'
|
267
|
+
|
268
|
+
# Offense count: 1
|
269
|
+
# Cop supports --auto-correct.
|
270
|
+
# Configuration parameters: EnforcedStyle.
|
271
|
+
# SupportedStyles: prefer_alias, prefer_alias_method
|
272
|
+
Style/Alias:
|
273
|
+
Exclude:
|
274
|
+
- 'lib/mail_room/coordinator.rb'
|
275
|
+
|
276
|
+
# Offense count: 14
|
277
|
+
# Cop supports --auto-correct.
|
278
|
+
# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
|
279
|
+
# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
|
280
|
+
# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
|
281
|
+
# FunctionalMethods: let, let!, subject, watch
|
282
|
+
# IgnoredMethods: lambda, proc, it
|
283
|
+
Style/BlockDelimiters:
|
284
|
+
Exclude:
|
285
|
+
- 'spec/lib/arbitration/redis_spec.rb'
|
286
|
+
- 'spec/lib/delivery/postback_spec.rb'
|
287
|
+
- 'spec/lib/delivery/que_spec.rb'
|
288
|
+
- 'spec/lib/delivery/sidekiq_spec.rb'
|
289
|
+
|
290
|
+
# Offense count: 12
|
291
|
+
Style/Documentation:
|
292
|
+
Exclude:
|
293
|
+
- 'spec/**/*'
|
294
|
+
- 'test/**/*'
|
295
|
+
- 'lib/mail_room.rb'
|
296
|
+
- 'lib/mail_room/arbitration.rb'
|
297
|
+
- 'lib/mail_room/arbitration/noop.rb'
|
298
|
+
- 'lib/mail_room/arbitration/redis.rb'
|
299
|
+
- 'lib/mail_room/connection.rb'
|
300
|
+
- 'lib/mail_room/crash_handler.rb'
|
301
|
+
- 'lib/mail_room/delivery.rb'
|
302
|
+
- 'lib/mail_room/imap/connection.rb'
|
303
|
+
- 'lib/mail_room/imap/message.rb'
|
304
|
+
- 'lib/mail_room/logger/structured.rb'
|
305
|
+
- 'lib/mail_room/message.rb'
|
306
|
+
- 'lib/mail_room/microsoft_graph/connection.rb'
|
307
|
+
|
308
|
+
# Offense count: 2
|
309
|
+
# Cop supports --auto-correct.
|
310
|
+
# Configuration parameters: EnforcedStyle.
|
311
|
+
# SupportedStyles: compact, expanded
|
312
|
+
Style/EmptyMethod:
|
313
|
+
Exclude:
|
314
|
+
- 'lib/mail_room/arbitration/noop.rb'
|
315
|
+
- 'lib/mail_room/delivery/noop.rb'
|
316
|
+
|
317
|
+
# Offense count: 1
|
318
|
+
# Cop supports --auto-correct.
|
319
|
+
Style/Encoding:
|
320
|
+
Exclude:
|
321
|
+
- 'mail_room.gemspec'
|
322
|
+
|
323
|
+
# Offense count: 2
|
324
|
+
# Cop supports --auto-correct.
|
325
|
+
Style/ExpandPathArguments:
|
326
|
+
Exclude:
|
327
|
+
- 'mail_room.gemspec'
|
328
|
+
- 'spec/spec_helper.rb'
|
329
|
+
|
330
|
+
# Offense count: 38
|
331
|
+
# Cop supports --auto-correct.
|
332
|
+
# Configuration parameters: EnforcedStyle.
|
333
|
+
# SupportedStyles: always, always_true, never
|
334
|
+
Style/FrozenStringLiteralComment:
|
335
|
+
Enabled: false
|
336
|
+
|
337
|
+
# Offense count: 5
|
338
|
+
# Cop supports --auto-correct.
|
339
|
+
Style/GlobalStdStream:
|
340
|
+
Exclude:
|
341
|
+
- 'lib/mail_room/crash_handler.rb'
|
342
|
+
- 'lib/mail_room/delivery/logger.rb'
|
343
|
+
- 'lib/mail_room/mailbox.rb'
|
344
|
+
- 'spec/lib/delivery/logger_spec.rb'
|
345
|
+
|
346
|
+
# Offense count: 3
|
347
|
+
# Configuration parameters: MinBodyLength.
|
348
|
+
Style/GuardClause:
|
349
|
+
Exclude:
|
350
|
+
- 'lib/mail_room/configuration.rb'
|
351
|
+
- 'lib/mail_room/imap/connection.rb'
|
352
|
+
- 'lib/mail_room/mailbox_watcher.rb'
|
353
|
+
|
354
|
+
# Offense count: 1
|
355
|
+
# Cop supports --auto-correct.
|
356
|
+
# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
357
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
358
|
+
Style/HashSyntax:
|
359
|
+
Exclude:
|
360
|
+
- 'spec/lib/microsoft_graph/connection_spec.rb'
|
361
|
+
|
362
|
+
# Offense count: 1
|
363
|
+
# Cop supports --auto-correct.
|
364
|
+
Style/IfUnlessModifier:
|
365
|
+
Exclude:
|
366
|
+
- 'lib/mail_room/mailbox_watcher.rb'
|
367
|
+
|
368
|
+
# Offense count: 5
|
369
|
+
# Cop supports --auto-correct.
|
370
|
+
# Configuration parameters: EnforcedStyle.
|
371
|
+
# SupportedStyles: literals, strict
|
372
|
+
Style/MutableConstant:
|
373
|
+
Exclude:
|
374
|
+
- 'lib/mail_room/crash_handler.rb'
|
375
|
+
- 'lib/mail_room/mailbox.rb'
|
376
|
+
- 'lib/mail_room/version.rb'
|
377
|
+
- 'spec/spec_helper.rb'
|
378
|
+
|
379
|
+
# Offense count: 1
|
380
|
+
# Cop supports --auto-correct.
|
381
|
+
# Configuration parameters: EnforcedStyle, IgnoredMethods.
|
382
|
+
# SupportedStyles: predicate, comparison
|
383
|
+
Style/NumericPredicate:
|
384
|
+
Exclude:
|
385
|
+
- 'spec/**/*'
|
386
|
+
- 'lib/mail_room/imap/connection.rb'
|
387
|
+
|
388
|
+
# Offense count: 2
|
389
|
+
# Cop supports --auto-correct.
|
390
|
+
# Configuration parameters: EnforcedStyle.
|
391
|
+
# SupportedStyles: short, verbose
|
392
|
+
Style/PreferredHashMethods:
|
393
|
+
Exclude:
|
394
|
+
- 'lib/mail_room/configuration.rb'
|
395
|
+
- 'lib/mail_room/mailbox.rb'
|
396
|
+
|
397
|
+
# Offense count: 1
|
398
|
+
# Cop supports --auto-correct.
|
399
|
+
# Configuration parameters: EnforcedStyle, AllowedCompactTypes.
|
400
|
+
# SupportedStyles: compact, exploded
|
401
|
+
Style/RaiseArgs:
|
402
|
+
Exclude:
|
403
|
+
- 'lib/mail_room/logger/structured.rb'
|
404
|
+
|
405
|
+
# Offense count: 2
|
406
|
+
# Cop supports --auto-correct.
|
407
|
+
Style/RedundantPercentQ:
|
408
|
+
Exclude:
|
409
|
+
- 'mail_room.gemspec'
|
410
|
+
|
411
|
+
# Offense count: 7
|
412
|
+
# Cop supports --auto-correct.
|
413
|
+
Style/RedundantSelf:
|
414
|
+
Exclude:
|
415
|
+
- 'lib/mail_room/configuration.rb'
|
416
|
+
- 'lib/mail_room/coordinator.rb'
|
417
|
+
- 'lib/mail_room/mailbox.rb'
|
418
|
+
- 'lib/mail_room/mailbox_watcher.rb'
|
419
|
+
|
420
|
+
# Offense count: 1
|
421
|
+
# Cop supports --auto-correct.
|
422
|
+
# Configuration parameters: EnforcedStyle.
|
423
|
+
# SupportedStyles: implicit, explicit
|
424
|
+
Style/RescueStandardError:
|
425
|
+
Exclude:
|
426
|
+
- 'lib/mail_room/configuration.rb'
|
427
|
+
|
428
|
+
# Offense count: 1
|
429
|
+
# Cop supports --auto-correct.
|
430
|
+
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods.
|
431
|
+
# AllowedMethods: present?, blank?, presence, try, try!
|
432
|
+
Style/SafeNavigation:
|
433
|
+
Exclude:
|
434
|
+
- 'lib/mail_room/mailbox_watcher.rb'
|
435
|
+
|
436
|
+
# Offense count: 1
|
437
|
+
# Cop supports --auto-correct.
|
438
|
+
# Configuration parameters: EnforcedStyle.
|
439
|
+
# SupportedStyles: use_perl_names, use_english_names
|
440
|
+
Style/SpecialGlobalVars:
|
441
|
+
Exclude:
|
442
|
+
- 'mail_room.gemspec'
|
443
|
+
|
444
|
+
# Offense count: 1
|
445
|
+
# Cop supports --auto-correct.
|
446
|
+
Style/StringConcatenation:
|
447
|
+
Exclude:
|
448
|
+
- 'lib/mail_room/logger/structured.rb'
|
449
|
+
|
450
|
+
# Offense count: 135
|
451
|
+
# Cop supports --auto-correct.
|
452
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
453
|
+
# SupportedStyles: single_quotes, double_quotes
|
454
|
+
Style/StringLiterals:
|
455
|
+
Enabled: false
|
456
|
+
|
457
|
+
# Offense count: 4
|
458
|
+
# Cop supports --auto-correct.
|
459
|
+
# Configuration parameters: EnforcedStyle, MinSize.
|
460
|
+
# SupportedStyles: percent, brackets
|
461
|
+
Style/SymbolArray:
|
462
|
+
Exclude:
|
463
|
+
- 'lib/mail_room/mailbox.rb'
|
464
|
+
- 'spec/lib/logger/structured_spec.rb'
|
465
|
+
|
466
|
+
# Offense count: 2
|
467
|
+
# Cop supports --auto-correct.
|
468
|
+
# Configuration parameters: EnforcedStyleForMultiline.
|
469
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
470
|
+
Style/TrailingCommaInHashLiteral:
|
471
|
+
Exclude:
|
472
|
+
- 'spec/lib/mailbox_spec.rb'
|
473
|
+
- 'spec/spec_helper.rb'
|
474
|
+
|
475
|
+
# Offense count: 1
|
476
|
+
# Cop supports --auto-correct.
|
477
|
+
Style/WhileUntilDo:
|
478
|
+
Exclude:
|
479
|
+
- 'lib/mail_room/mailbox_watcher.rb'
|
480
|
+
|
481
|
+
# Offense count: 2
|
482
|
+
# Cop supports --auto-correct.
|
483
|
+
Style/WhileUntilModifier:
|
484
|
+
Exclude:
|
485
|
+
- 'lib/mail_room/coordinator.rb'
|
486
|
+
- 'lib/mail_room/mailbox_watcher.rb'
|
487
|
+
|
488
|
+
# Offense count: 3
|
489
|
+
# Cop supports --auto-correct.
|
490
|
+
# Configuration parameters: WordRegex.
|
491
|
+
# SupportedStyles: percent, brackets
|
492
|
+
Style/WordArray:
|
493
|
+
EnforcedStyle: percent
|
494
|
+
MinSize: 3
|
495
|
+
|
496
|
+
# Offense count: 6
|
497
|
+
# Cop supports --auto-correct.
|
498
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
499
|
+
# URISchemes: http, https
|
500
|
+
Layout/LineLength:
|
501
|
+
Max: 177
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -20,7 +20,14 @@ The fork is useful as we can post quick fixes to our own fork and release fixes
|
|
20
20
|
|
21
21
|
## README
|
22
22
|
|
23
|
-
mail_room is a configuration based process that will
|
23
|
+
mail_room is a configuration based process that will listen for incoming
|
24
|
+
e-mail and execute a delivery method when a new message is
|
25
|
+
received. mail_room supports the following methods for receiving e-mail:
|
26
|
+
|
27
|
+
* IMAP
|
28
|
+
* [Microsoft Graph API](https://docs.microsoft.com/en-us/graph/api/resources/mail-api-overview?view=graph-rest-1.0)
|
29
|
+
|
30
|
+
Examples of delivery methods include:
|
24
31
|
|
25
32
|
* POST to a delivery URL (Postback)
|
26
33
|
* Queue a job to Sidekiq or Que for later processing (Sidekiq or Que)
|
@@ -117,6 +124,20 @@ You will also need to install `faraday` or `letter_opener` if you use the `postb
|
|
117
124
|
:host: 127.0.0.1
|
118
125
|
:port: 26379
|
119
126
|
:worker: EmailReceiverWorker
|
127
|
+
-
|
128
|
+
:email: "user7@outlook365.com"
|
129
|
+
:password: "password"
|
130
|
+
:name: "inbox"
|
131
|
+
:inbox_method: microsoft_graph
|
132
|
+
:inbox_options:
|
133
|
+
:tenant_id: 12345
|
134
|
+
:client_id: ABCDE
|
135
|
+
:client_secret: YOUR-SECRET-HERE
|
136
|
+
:poll_interval: 60
|
137
|
+
:delivery_method: sidekiq
|
138
|
+
:delivery_options:
|
139
|
+
:redis_url: redis://localhost:6379
|
140
|
+
:worker: EmailReceiverWorker
|
120
141
|
```
|
121
142
|
|
122
143
|
**Note:** If using `delete_after_delivery`, you also probably want to use
|
@@ -134,6 +155,72 @@ the server is running. Otherwise, it returns a 500 status code.
|
|
134
155
|
|
135
156
|
This feature is not included in upstream `mail_room` and is specific to GitLab.
|
136
157
|
|
158
|
+
## inbox_method
|
159
|
+
|
160
|
+
By default, IMAP mode is assumed for reading a mailbox.
|
161
|
+
|
162
|
+
### IMAP Server Configuration ##
|
163
|
+
|
164
|
+
You can set per-mailbox configuration for the IMAP server's `host` (default: 'imap.gmail.com'), `port` (default: 993), `ssl` (default: true), and `start_tls` (default: false).
|
165
|
+
|
166
|
+
If you want to set additional options for IMAP SSL you can pass a YAML hash to match [SSLContext#set_params](http://docs.ruby-lang.org/en/2.2.0/OpenSSL/SSL/SSLContext.html#method-i-set_params). If you set `verify_mode` to `:none` it'll replace with the appropriate constant.
|
167
|
+
|
168
|
+
If you're seeing the error `Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure)`, you need to configure your Gmail account to allow less secure apps to access it: https://support.google.com/accounts/answer/6010255.
|
169
|
+
|
170
|
+
### Microsoft Graph configuration
|
171
|
+
|
172
|
+
To use the Microsoft Graph API instead of IMAP to read e-mail, you will
|
173
|
+
need to create an application in the Azure Active Directory. See the
|
174
|
+
[Microsoft instructions](https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app) for more details:
|
175
|
+
|
176
|
+
1. Sign in to the [Azure portal](https://portal.azure.com).
|
177
|
+
1. Search for and select `Azure Active Directory`.
|
178
|
+
1. Under `Manage`, select `App registrations` > `New registration`.
|
179
|
+
1. Enter a `Name` for your application, such as `MailRoom`. Users of your app might see this name, and you can change it later.
|
180
|
+
1. If `Supported account types` is listed, select the appropriate option.
|
181
|
+
1. Leave `Redirect URI` blank. This is not needed.
|
182
|
+
1. Select `Register`.
|
183
|
+
1. Under `Manage`, select `Certificates & secrets`.
|
184
|
+
1. Under `Client secrets`, select `New client secret`, and enter a name.
|
185
|
+
1. Under `Expires`, select `Never`, unless you plan on updating the credentials every time it expires.
|
186
|
+
1. Select `Add`. Record the secret value in a safe location for use in a later step.
|
187
|
+
1. Under `Manage`, select `API Permissions` > `Add a permission`. Select `Microsoft Graph`.
|
188
|
+
1. Select `Application permissions`.
|
189
|
+
1. Under the `Mail` node, select `Mail.ReadWrite`, and then select Add permissions.
|
190
|
+
1. If `User.Read` is listed in the permission list, you can delete this.
|
191
|
+
1. Click `Grant admin consent` for these permissions.
|
192
|
+
|
193
|
+
#### Restrict mailbox access
|
194
|
+
|
195
|
+
Note that for MailRoom to work as a service account, this application
|
196
|
+
must have the `Mail.ReadWrite` to read/write mail in *all*
|
197
|
+
mailboxes. However, while this appears to be security risk,
|
198
|
+
we can configure an application access policy to limit the
|
199
|
+
mailbox access for this account. [Follow these instructions](https://docs.microsoft.com/en-us/graph/auth-limit-mailbox-access)
|
200
|
+
to setup PowerShell and configure this policy.
|
201
|
+
|
202
|
+
#### MailRoom config for Microsoft Graph
|
203
|
+
|
204
|
+
In the MailRoom configuration, set `inbox_method` to `microsoft_graph`.
|
205
|
+
You will also need:
|
206
|
+
|
207
|
+
* The client and tenant ID from the `Overview` section in the Azure app page
|
208
|
+
* The client secret created earlier
|
209
|
+
|
210
|
+
Fill in `inbox_options` with these values:
|
211
|
+
|
212
|
+
```yaml
|
213
|
+
:inbox_method: microsoft_graph
|
214
|
+
:inbox_options:
|
215
|
+
:tenant_id: 12345
|
216
|
+
:client_id: ABCDE
|
217
|
+
:client_secret: YOUR-SECRET-HERE
|
218
|
+
:poll_interval: 60
|
219
|
+
```
|
220
|
+
|
221
|
+
By default, MailRoom will poll for new messages every 60 seconds. `poll_interval` configures the number of
|
222
|
+
seconds to poll. Setting the value to 0 or under will default to 60 seconds.
|
223
|
+
|
137
224
|
## delivery_method ##
|
138
225
|
|
139
226
|
### postback ###
|
@@ -284,14 +371,6 @@ If you'd prefer not to wait that long, you can pass `idle_timeout` in seconds fo
|
|
284
371
|
|
285
372
|
This setting allows configuration of the IMAP search command sent to the server. This still defaults 'UNSEEN'. You may find that 'NEW' works better for you.
|
286
373
|
|
287
|
-
## IMAP Server Configuration ##
|
288
|
-
|
289
|
-
You can set per-mailbox configuration for the IMAP server's `host` (default: 'imap.gmail.com'), `port` (default: 993), `ssl` (default: true), and `start_tls` (default: false).
|
290
|
-
|
291
|
-
If you want to set additional options for IMAP SSL you can pass a YAML hash to match [SSLContext#set_params](http://docs.ruby-lang.org/en/2.2.0/OpenSSL/SSL/SSLContext.html#method-i-set_params). If you set `verify_mode` to `:none` it'll replace with the appropriate constant.
|
292
|
-
|
293
|
-
If you're seeing the error `Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure)`, you need to configure your Gmail account to allow less secure apps to access it: https://support.google.com/accounts/answer/6010255.
|
294
|
-
|
295
374
|
## Running in Production ##
|
296
375
|
|
297
376
|
I suggest running with either upstart or init.d. Check out this wiki page for some example scripts for both: https://github.com/tpitale/mail_room/wiki/Init-Scripts-for-Running-mail_room
|
data/Rakefile
CHANGED