smtp_mock 0.1.0

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.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +132 -0
  3. data/.codeclimate.yml +13 -0
  4. data/.github/BRANCH_NAMING_CONVENTION.md +36 -0
  5. data/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
  6. data/.github/ISSUE_TEMPLATE/feature_request.md +27 -0
  7. data/.github/ISSUE_TEMPLATE/issue_report.md +28 -0
  8. data/.github/ISSUE_TEMPLATE/question.md +22 -0
  9. data/.github/PULL_REQUEST_TEMPLATE.md +49 -0
  10. data/.gitignore +12 -0
  11. data/.overcommit.yml +32 -0
  12. data/.reek.yml +30 -0
  13. data/.rspec +3 -0
  14. data/.rubocop.yml +396 -0
  15. data/.ruby-gemset +1 -0
  16. data/.ruby-version +1 -0
  17. data/CHANGELOG.md +9 -0
  18. data/CODE_OF_CONDUCT.md +74 -0
  19. data/CONTRIBUTING.md +46 -0
  20. data/Gemfile +5 -0
  21. data/LICENSE.txt +21 -0
  22. data/README.md +242 -0
  23. data/Rakefile +8 -0
  24. data/bin/console +15 -0
  25. data/bin/setup +8 -0
  26. data/bin/smtp_mock +6 -0
  27. data/lib/smtp_mock/cli/resolver.rb +61 -0
  28. data/lib/smtp_mock/cli.rb +17 -0
  29. data/lib/smtp_mock/command_line_args_builder.rb +94 -0
  30. data/lib/smtp_mock/core.rb +18 -0
  31. data/lib/smtp_mock/dependency.rb +26 -0
  32. data/lib/smtp_mock/error/argument.rb +7 -0
  33. data/lib/smtp_mock/error/dependency.rb +9 -0
  34. data/lib/smtp_mock/error/server.rb +7 -0
  35. data/lib/smtp_mock/server/port.rb +27 -0
  36. data/lib/smtp_mock/server/process.rb +44 -0
  37. data/lib/smtp_mock/server.rb +59 -0
  38. data/lib/smtp_mock/test_framework/rspec/helper.rb +15 -0
  39. data/lib/smtp_mock/test_framework/rspec/interface.rb +29 -0
  40. data/lib/smtp_mock/test_framework/rspec.rb +10 -0
  41. data/lib/smtp_mock/version.rb +5 -0
  42. data/lib/smtp_mock.rb +19 -0
  43. data/smtp_mock.gemspec +49 -0
  44. data/tmp/.gitkeep +0 -0
  45. metadata +288 -0
data/.rubocop.yml ADDED
@@ -0,0 +1,396 @@
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-performance
4
+
5
+ AllCops:
6
+ DisplayCopNames: true
7
+ DisplayStyleGuide: true
8
+ TargetRubyVersion: 2.5
9
+
10
+ Metrics/ClassLength:
11
+ Max: 150
12
+
13
+ Metrics/MethodLength:
14
+ Max: 15
15
+
16
+ Metrics/BlockLength:
17
+ Enabled: false
18
+
19
+ Metrics/CyclomaticComplexity:
20
+ Enabled: false
21
+
22
+ Metrics/PerceivedComplexity:
23
+ Enabled: false
24
+
25
+ Naming/VariableNumber:
26
+ Enabled: false
27
+
28
+ Naming/RescuedExceptionsVariableName:
29
+ Enabled: false
30
+
31
+ Naming/InclusiveLanguage:
32
+ Enabled: false
33
+
34
+ Naming/BlockForwarding:
35
+ Enabled: true
36
+
37
+ Style/Documentation:
38
+ Enabled: false
39
+
40
+ Style/DoubleNegation:
41
+ Enabled: false
42
+
43
+ Style/EmptyCaseCondition:
44
+ Enabled: false
45
+
46
+ Style/ParallelAssignment:
47
+ Enabled: false
48
+
49
+ Style/RescueStandardError:
50
+ Enabled: false
51
+
52
+ Style/HashEachMethods:
53
+ Enabled: true
54
+
55
+ Style/HashTransformKeys:
56
+ Enabled: true
57
+
58
+ Style/HashTransformValues:
59
+ Enabled: true
60
+
61
+ Style/AccessorGrouping:
62
+ Enabled: true
63
+
64
+ Style/ArrayCoercion:
65
+ Enabled: true
66
+
67
+ Style/BisectedAttrAccessor:
68
+ Enabled: true
69
+
70
+ Style/CaseLikeIf:
71
+ Enabled: true
72
+
73
+ Style/ExponentialNotation:
74
+ Enabled: true
75
+
76
+ Style/HashAsLastArrayItem:
77
+ Enabled: true
78
+
79
+ Style/HashLikeCase:
80
+ Enabled: true
81
+
82
+ Style/RedundantAssignment:
83
+ Enabled: true
84
+
85
+ Style/RedundantFetchBlock:
86
+ Enabled: true
87
+
88
+ Style/RedundantFileExtensionInRequire:
89
+ Enabled: true
90
+
91
+ Style/RedundantRegexpCharacterClass:
92
+ Enabled: true
93
+
94
+ Style/RedundantRegexpEscape:
95
+ Enabled: true
96
+
97
+ Style/SlicingWithRange:
98
+ Enabled: true
99
+
100
+ Style/ArgumentsForwarding:
101
+ Enabled: true
102
+
103
+ Style/CollectionCompact:
104
+ Enabled: true
105
+
106
+ Style/DocumentDynamicEvalDefinition:
107
+ Enabled: true
108
+
109
+ Style/NegatedIfElseCondition:
110
+ Enabled: true
111
+
112
+ Style/NilLambda:
113
+ Enabled: true
114
+
115
+ Style/RedundantArgument:
116
+ Enabled: true
117
+
118
+ Style/SwapValues:
119
+ Enabled: true
120
+
121
+ Style/EndlessMethod:
122
+ Enabled: true
123
+
124
+ Style/HashExcept:
125
+ Enabled: true
126
+
127
+ Style/IfWithBooleanLiteralBranches:
128
+ Enabled: true
129
+
130
+ Style/HashConversion:
131
+ Enabled: true
132
+
133
+ Style/StringChars:
134
+ Enabled: true
135
+
136
+ Style/InPatternThen:
137
+ Enabled: true
138
+
139
+ Style/MultilineInPatternThen:
140
+ Enabled: true
141
+
142
+ Style/QuotedSymbols:
143
+ Enabled: true
144
+
145
+ Style/RedundantSelfAssignmentBranch:
146
+ Enabled: true
147
+
148
+ Style/NumberedParameters:
149
+ Enabled: true
150
+
151
+ Style/NumberedParametersLimit:
152
+ Enabled: true
153
+
154
+ Style/SelectByRegexp:
155
+ Enabled: true
156
+
157
+ Style/FileRead:
158
+ Enabled: true
159
+
160
+ Style/FileWrite:
161
+ Enabled: true
162
+
163
+ Style/MapToHash:
164
+ Enabled: true
165
+
166
+ Style/OpenStructUse:
167
+ Enabled: true
168
+
169
+ Layout/LineLength:
170
+ Max: 150
171
+
172
+ Layout/EmptyLinesAroundAttributeAccessor:
173
+ Enabled: true
174
+
175
+ Layout/SpaceAroundMethodCallOperator:
176
+ Enabled: true
177
+
178
+ Layout/ClassStructure:
179
+ Enabled: true
180
+ Categories:
181
+ module_inclusion:
182
+ - include
183
+ - prepend
184
+ - extend
185
+ ExpectedOrder:
186
+ - module_inclusion
187
+ - constants
188
+ - public_class_methods
189
+ - initializer
190
+ - public_methods
191
+ - protected_methods
192
+ - private_methods
193
+
194
+ Layout/EmptyLineAfterGuardClause:
195
+ Enabled: false
196
+
197
+ Layout/SpaceBeforeBrackets:
198
+ Enabled: true
199
+
200
+ Layout/LineEndStringConcatenationIndentation:
201
+ Enabled: true
202
+
203
+ Lint/NonDeterministicRequireOrder:
204
+ Enabled: true
205
+
206
+ Lint/DeprecatedOpenSSLConstant:
207
+ Enabled: true
208
+
209
+ Lint/DuplicateElsifCondition:
210
+ Enabled: true
211
+
212
+ Lint/MixedRegexpCaptureTypes:
213
+ Enabled: true
214
+
215
+ Lint/RaiseException:
216
+ Enabled: true
217
+
218
+ Lint/StructNewOverride:
219
+ Enabled: true
220
+
221
+ Lint/DuplicateBranch:
222
+ Enabled: true
223
+
224
+ Lint/DuplicateRegexpCharacterClassElement:
225
+ Enabled: true
226
+
227
+ Lint/EmptyBlock:
228
+ Enabled: true
229
+
230
+ Lint/EmptyClass:
231
+ Enabled: true
232
+
233
+ Lint/NoReturnInBeginEndBlocks:
234
+ Enabled: true
235
+
236
+ Lint/ToEnumArguments:
237
+ Enabled: true
238
+
239
+ Lint/UnexpectedBlockArity:
240
+ Enabled: true
241
+
242
+ Lint/AmbiguousAssignment:
243
+ Enabled: true
244
+
245
+ Lint/DeprecatedConstants:
246
+ Enabled: true
247
+
248
+ Lint/LambdaWithoutLiteralBlock:
249
+ Enabled: true
250
+
251
+ Lint/RedundantDirGlobSort:
252
+ Enabled: true
253
+
254
+ Lint/UnmodifiedReduceAccumulator:
255
+ Enabled: true
256
+
257
+ Lint/NumberedParameterAssignment:
258
+ Enabled: true
259
+
260
+ Lint/OrAssignmentToConstant:
261
+ Enabled: true
262
+
263
+ Lint/SymbolConversion:
264
+ Enabled: true
265
+
266
+ Lint/TripleQuotes:
267
+ Enabled: true
268
+
269
+ Lint/EmptyInPattern:
270
+ Enabled: true
271
+
272
+ Lint/AmbiguousRange:
273
+ Enabled: true
274
+
275
+ Lint/AmbiguousOperatorPrecedence:
276
+ Enabled: true
277
+
278
+ Lint/IncompatibleIoSelectWithFiberScheduler:
279
+ Enabled: true
280
+
281
+ Lint/RequireRelativeSelfPath:
282
+ Enabled: true
283
+
284
+ Lint/UselessRuby2Keywords:
285
+ Enabled: true
286
+
287
+ Gemspec/DateAssignment:
288
+ Enabled: true
289
+
290
+ Gemspec/RequireMFA:
291
+ Enabled: false
292
+
293
+ Gemspec/RubyVersionGlobalsUsage:
294
+ Enabled: false
295
+
296
+ Security/IoMethods:
297
+ Enabled: true
298
+
299
+ Performance/AncestorsInclude:
300
+ Enabled: true
301
+
302
+ Performance/BigDecimalWithNumericArgument:
303
+ Enabled: true
304
+
305
+ Performance/RedundantSortBlock:
306
+ Enabled: true
307
+
308
+ Performance/RedundantStringChars:
309
+ Enabled: true
310
+
311
+ Performance/ReverseFirst:
312
+ Enabled: true
313
+
314
+ Performance/SortReverse:
315
+ Enabled: true
316
+
317
+ Performance/Squeeze:
318
+ Enabled: true
319
+
320
+ Performance/StringInclude:
321
+ Enabled: true
322
+
323
+ Performance/BlockGivenWithExplicitBlock:
324
+ Enabled: true
325
+
326
+ Performance/CollectionLiteralInLoop:
327
+ Enabled: true
328
+
329
+ Performance/ConstantRegexp:
330
+ Enabled: true
331
+
332
+ Performance/MethodObjectAsBlock:
333
+ Enabled: false
334
+
335
+ Performance/Sum:
336
+ Enabled: true
337
+
338
+ Performance/RedundantEqualityComparisonBlock:
339
+ Enabled: true
340
+
341
+ Performance/RedundantSplitRegexpArgument:
342
+ Enabled: true
343
+
344
+ Performance/MapCompact:
345
+ Enabled: true
346
+
347
+ Performance/ConcurrentMonotonicTime:
348
+ Enabled: true
349
+
350
+ Performance/StringIdentifierArgument:
351
+ Enabled: true
352
+
353
+ RSpec/ExampleLength:
354
+ Enabled: false
355
+
356
+ RSpec/NestedGroups:
357
+ Enabled: false
358
+
359
+ RSpec/MultipleExpectations:
360
+ Enabled: false
361
+
362
+ RSpec/MessageChain:
363
+ Enabled: false
364
+
365
+ RSpec/ContextWording:
366
+ Enabled: false
367
+
368
+ RSpec/AnyInstance:
369
+ Enabled: false
370
+
371
+ RSpec/MessageSpies:
372
+ Enabled: false
373
+
374
+ RSpec/MultipleDescribes:
375
+ Enabled: false
376
+
377
+ RSpec/MultipleMemoizedHelpers:
378
+ Enabled: false
379
+
380
+ RSpec/StubbedMock:
381
+ Enabled: false
382
+
383
+ RSpec/IdenticalEqualityAssertion:
384
+ Enabled: true
385
+
386
+ RSpec/Rails/AvoidSetupHook:
387
+ Enabled: true
388
+
389
+ RSpec/ExcessiveDocstringSpacing:
390
+ Enabled: true
391
+
392
+ RSpec/SubjectDeclaration:
393
+ Enabled: true
394
+
395
+ RSpec/FactoryBot/SyntaxMethods:
396
+ Enabled: true
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ smtp_mock
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.5.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
+
5
+ ## [0.1.0] - 2022-01-18
6
+
7
+ ### Added
8
+
9
+ - First release of `SmtpMock`. Thanks [@le0pard](https://github.com/le0pard) for support 🚀
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at admin@bestweb.com.ua. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,46 @@
1
+ # Contributing to SmtpMock
2
+
3
+ Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved.
4
+
5
+ Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features.
6
+
7
+ ## Using the issue tracker
8
+
9
+ The issue tracker is the preferred channel for [issue/bug reports](#issuebug-reports), [feature requests](#feature-requests), [questions](#questions) and submitting [pull requests](#pull-requests).
10
+
11
+ ## Issue/bug reports
12
+
13
+ A bug is a _demonstrable problem_ that is caused by the code in the repository. Good bug reports are extremely helpful - thank you!
14
+
15
+ Guidelines for issue/bug reports:
16
+
17
+ 1. **Use the GitHub issue search** — check if the issue has already been reported
18
+ 2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or `develop` branch in the repository
19
+ 3. SmtpMock [issue template](.github/ISSUE_TEMPLATE/issue_report.md)/[bug template](.github/ISSUE_TEMPLATE/bug_report.md)
20
+
21
+ A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What would you expect to be the outcome? All these details will help people to fix any potential bugs.
22
+
23
+ ## Feature requests
24
+
25
+ Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
26
+
27
+ ## Questions
28
+
29
+ We're always open to a new conversations. So if you have any questions just ask us.
30
+
31
+ ## Pull requests
32
+
33
+ Good pull requests - patches, improvements, new features - are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.
34
+
35
+ **Please ask first** before embarking on any significant pull request (e.g. implementing features, refactoring code, porting to a different language), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project.
36
+
37
+ Please adhere to the coding conventions used throughout a project (indentation, accurate comments, etc.) and any other requirements (such as test coverage). Not all features proposed will be added but we are open to having a conversation about a feature you are championing.
38
+
39
+ Guidelines for pull requests:
40
+
41
+ 1. SmtpMock [pull request template](.github/PULL_REQUEST_TEMPLATE.md)
42
+ 2. Fork the repo, checkout to `develop` branch
43
+ 3. Run the tests. This is to make sure your starting point works
44
+ 4. Read our [branch naming convention](.github/BRANCH_NAMING_CONVENTION.md)
45
+ 5. Create a new branch and make your changes. This includes tests for features!
46
+ 6. Push to your fork and submit a pull request to `develop` branch
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
5
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Vladislav Trotsenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.