smtp_mock 0.1.2 → 1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c6fcd84a6232032428e31f2d0627b9c72a98a74a257dcb7638fb8b0bb11dbba5
4
- data.tar.gz: 1b06de5c2a1009eb9dddc7f3b1aa2a15573f6f2ff2fadd2a4d81fb50c8c7d91f
3
+ metadata.gz: 6609f9f6630224a07d5f7326e569a4dede87bd77d68a06ce5087a3aed8e2e7cb
4
+ data.tar.gz: 16f4fdd27fa57274e8768e4111c4710d04640c0624a9f34b6caf0e4bc07b82ab
5
5
  SHA512:
6
- metadata.gz: bd6df23a441cebf9a7d597d770f16af4548880da884082c32e91f507399a76e953a274ee6985f963143cd5fac98560cd5d9563896c3f8019a26ee266f4c29d3a
7
- data.tar.gz: aa7c24286f3e74b059b48f3d59f67e5dd4548feabcdc3cd85ae6381d8950c64ec5042ca84baa6d06e1a55155668f2f296c7e6fd95bf1bcdb6614e81024ea282c
6
+ metadata.gz: 715a635bd7592994cd52a99b8b3cc638eec058720ebe6fd846d58d2ebfc73404908044f51149a5a9138e3fbf1ba595c1a03de1b64af228218d1a11e4ffdf7218
7
+ data.tar.gz: a2fe9ea5c0769b9796dd9117ff2290047a48f61b145276fc6bedb64e775ac1cc57c9fc56abe028adb5891b8021f0eda53e20162e86309617824152c444ba4a3f
data/.circleci/config.yml CHANGED
@@ -6,7 +6,7 @@ defaults: &defaults
6
6
  - image: cimg/ruby:<< parameters.ruby-version >>
7
7
 
8
8
  orbs:
9
- ruby: circleci/ruby@1.2.0
9
+ ruby: circleci/ruby@1.7.1
10
10
 
11
11
  references:
12
12
  restore_bundle_cache: &restore_bundle_cache
@@ -40,6 +40,18 @@ references:
40
40
  curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
41
41
  chmod +x ./cc-test-reporter
42
42
 
43
+ use_latest_gemspec: &use_latest_gemspec
44
+ run:
45
+ name: Using latest gemspec
46
+ command: |
47
+ cp .circleci/gemspec_latest smtp_mock.gemspec
48
+
49
+ use_compatible_gemspec: &use_compatible_gemspec
50
+ run:
51
+ name: Using compatible gemspec
52
+ command: |
53
+ cp .circleci/gemspec_compatible smtp_mock.gemspec
54
+
43
55
  jobs:
44
56
  linters-ruby:
45
57
  parameters:
@@ -51,6 +63,7 @@ jobs:
51
63
  steps:
52
64
  - checkout
53
65
 
66
+ - <<: *use_latest_gemspec
54
67
  - <<: *restore_bundle_cache
55
68
  - <<: *bundle_install
56
69
  - <<: *save_bundle_cache
@@ -71,6 +84,7 @@ jobs:
71
84
  steps:
72
85
  - checkout
73
86
 
87
+ - <<: *use_latest_gemspec
74
88
  - <<: *restore_bundle_cache
75
89
  - <<: *bundle_install
76
90
  - <<: *save_bundle_cache
@@ -106,8 +120,9 @@ jobs:
106
120
  - image: cimg/ruby:<< parameters.ruby-version >>
107
121
  steps:
108
122
  - checkout
123
+ - <<: *use_compatible_gemspec
109
124
  - ruby/install-deps:
110
- bundler-version: "2.3.5"
125
+ bundler-version: "2.3.13"
111
126
  with-cache: false
112
127
  path: './vendor/custom_bundle'
113
128
  - <<: *system_dependencies
@@ -121,12 +136,12 @@ workflows:
121
136
  - linters-ruby:
122
137
  matrix:
123
138
  parameters:
124
- ruby-version: ["2.5"]
139
+ ruby-version: ["3.1"]
125
140
  - tests-ruby:
126
141
  matrix:
127
142
  parameters:
128
- ruby-version: ["2.5"]
143
+ ruby-version: ["3.1"]
129
144
  - compatibility-ruby:
130
145
  matrix:
131
146
  parameters:
132
- ruby-version: ["2.6", "2.7", "3.0", "3.1"]
147
+ ruby-version: ["2.5", "2.6", "2.7", "3.0"]
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/smtp_mock/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'smtp_mock'
7
+ spec.version = SmtpMock::VERSION
8
+ spec.authors = ['Vladislav Trotsenko']
9
+ spec.email = ['admin@bestweb.com.ua']
10
+
11
+ spec.summary = %(smtp_mock)
12
+ spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behaviour for your test environment.)
13
+
14
+ spec.homepage = 'https://github.com/mocktools/ruby-smtp-mock'
15
+ spec.license = 'MIT'
16
+
17
+ spec.metadata = {
18
+ 'homepage_uri' => 'https://github.com/mocktools/ruby-smtp-mock',
19
+ 'changelog_uri' => 'https://github.com/mocktools/ruby-smtp-mock/blob/master/CHANGELOG.md',
20
+ 'source_code_uri' => 'https://github.com/mocktools/ruby-smtp-mock',
21
+ 'documentation_uri' => 'https://github.com/mocktools/ruby-smtp-mock/blob/master/README.md',
22
+ 'bug_tracker_uri' => 'https://github.com/mocktools/ruby-smtp-mock/issues'
23
+ }
24
+
25
+ spec.required_ruby_version = '>= 2.5.0'
26
+
27
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ spec.executables = %w[smtp_mock]
29
+ spec.require_paths = %w[lib]
30
+
31
+ spec.add_runtime_dependency 'dry-struct', '~> 1.4'
32
+
33
+ spec.add_development_dependency 'ffaker', '~> 2.21'
34
+ spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
35
+ spec.add_development_dependency 'rspec', '~> 3.11'
36
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/smtp_mock/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'smtp_mock'
7
+ spec.version = SmtpMock::VERSION
8
+ spec.authors = ['Vladislav Trotsenko']
9
+ spec.email = ['admin@bestweb.com.ua']
10
+
11
+ spec.summary = %(smtp_mock)
12
+ spec.description = %(💎 Ruby SMTP mock. Mimic any SMTP server behaviour for your test environment.)
13
+
14
+ spec.homepage = 'https://github.com/mocktools/ruby-smtp-mock'
15
+ spec.license = 'MIT'
16
+
17
+ spec.metadata = {
18
+ 'homepage_uri' => 'https://github.com/mocktools/ruby-smtp-mock',
19
+ 'changelog_uri' => 'https://github.com/mocktools/ruby-smtp-mock/blob/master/CHANGELOG.md',
20
+ 'source_code_uri' => 'https://github.com/mocktools/ruby-smtp-mock',
21
+ 'documentation_uri' => 'https://github.com/mocktools/ruby-smtp-mock/blob/master/README.md',
22
+ 'bug_tracker_uri' => 'https://github.com/mocktools/ruby-smtp-mock/issues'
23
+ }
24
+
25
+ spec.required_ruby_version = '>= 2.5.0'
26
+
27
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ spec.executables = %w[smtp_mock]
29
+ spec.require_paths = %w[lib]
30
+ spec.post_install_message = 'smtpmock is required system dependency. For more details run: `bundle exec smtp_mock -h`'
31
+
32
+ spec.add_runtime_dependency 'dry-struct', '~> 1.4'
33
+
34
+ spec.add_development_dependency 'bundler-audit', '~> 0.9.0.1'
35
+ spec.add_development_dependency 'fasterer', '~> 0.10.0'
36
+ spec.add_development_dependency 'ffaker', '~> 2.21'
37
+ spec.add_development_dependency 'net-smtp', '~> 0.3.1'
38
+ spec.add_development_dependency 'overcommit', '~> 0.59.1'
39
+ spec.add_development_dependency 'pry-byebug', '~> 3.9'
40
+ spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
41
+ spec.add_development_dependency 'reek', '~> 6.1', '>= 6.1.1'
42
+ spec.add_development_dependency 'rspec', '~> 3.11'
43
+ spec.add_development_dependency 'rubocop', '~> 1.29', '>= 1.29.1'
44
+ spec.add_development_dependency 'rubocop-performance', '~> 1.13', '>= 1.13.3'
45
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.10'
46
+ spec.add_development_dependency 'simplecov', '~> 0.21.2'
47
+ end
data/.codeclimate.yml CHANGED
@@ -7,7 +7,7 @@ checks:
7
7
  plugins:
8
8
  rubocop:
9
9
  enabled: true
10
- channel: rubocop-1-24
10
+ channel: rubocop-1-29
11
11
 
12
12
  reek:
13
13
  enabled: true
@@ -0,0 +1,26 @@
1
+ # Development environment guide
2
+
3
+ ## Preparing
4
+
5
+ Clone `smtp_mock` repository:
6
+
7
+ ```bash
8
+ git clone https://github.com/mocktools/ruby-smtp-mock.git
9
+ cd ruby-smtp-mock
10
+ ```
11
+
12
+ Configure latest Ruby environment:
13
+
14
+ ```bash
15
+ echo 'ruby-3.1.2' > .ruby-version
16
+ cp .circleci/gemspec_latest smtp_mock.gemspec
17
+ ```
18
+
19
+ ## Commiting
20
+
21
+ Commit your changes excluding `.ruby-version`, `smtp_mock.gemspec`
22
+
23
+ ```bash
24
+ git add . ':!.ruby-version' ':!smtp_mock.gemspec'
25
+ git commit -m 'Your new awesome smtp_mock feature'
26
+ ```
@@ -0,0 +1 @@
1
+ github: [bestwebua]
data/.reek.yml CHANGED
@@ -9,17 +9,18 @@ detectors:
9
9
  - SmtpMock::ServerHelper
10
10
  - SmtpMock::TestFramework::RSpec::Helper#smtp_mock_server
11
11
  - SmtpMock::ContextGeneratorHelper#random_message
12
+ - SmtpMock::Cli::Resolver#install_to
12
13
 
13
14
  NestedIterators:
14
15
  exclude:
15
16
  - SmtpMock::CommandLineArgsBuilder#define_attribute
16
- - SmtpMock::Cli::Resolver#resolve
17
17
 
18
18
  TooManyStatements:
19
19
  exclude:
20
- - SmtpMock::Cli::Resolver#resolve
21
20
  - SmtpMock::Server#run
22
21
  - SmtpMock::ServerHelper#create_fake_servers
22
+ - SmtpMock::Cli::Resolver#install
23
+ - SmtpMock::Cli::Resolver#resolve
23
24
 
24
25
  TooManyInstanceVariables:
25
26
  exclude:
data/.rubocop.yml CHANGED
@@ -166,6 +166,21 @@ Style/MapToHash:
166
166
  Style/OpenStructUse:
167
167
  Enabled: true
168
168
 
169
+ Style/NestedFileDirname:
170
+ Enabled: true
171
+
172
+ Style/EnvHome:
173
+ Enabled: true
174
+
175
+ Style/FetchEnvVar:
176
+ Enabled: true
177
+
178
+ Style/ObjectThen:
179
+ Enabled: true
180
+
181
+ Style/RedundantInitialize:
182
+ Enabled: true
183
+
169
184
  Layout/LineLength:
170
185
  Max: 150
171
186
 
@@ -281,6 +296,9 @@ Lint/IncompatibleIoSelectWithFiberScheduler:
281
296
  Lint/RequireRelativeSelfPath:
282
297
  Enabled: true
283
298
 
299
+ Lint/RefinementImportMethods:
300
+ Enabled: true
301
+
284
302
  Lint/UselessRuby2Keywords:
285
303
  Enabled: true
286
304
 
@@ -290,12 +308,12 @@ Gemspec/DateAssignment:
290
308
  Gemspec/RequireMFA:
291
309
  Enabled: false
292
310
 
293
- Gemspec/RubyVersionGlobalsUsage:
294
- Enabled: false
295
-
296
311
  Security/IoMethods:
297
312
  Enabled: true
298
313
 
314
+ Security/CompoundHash:
315
+ Enabled: true
316
+
299
317
  Performance/AncestorsInclude:
300
318
  Enabled: true
301
319
 
@@ -394,3 +412,12 @@ RSpec/SubjectDeclaration:
394
412
 
395
413
  RSpec/FactoryBot/SyntaxMethods:
396
414
  Enabled: true
415
+
416
+ RSpec/BeEq:
417
+ Enabled: true
418
+
419
+ RSpec/BeNil:
420
+ Enabled: true
421
+
422
+ RSpec/VerifiedDoubleReference:
423
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -2,6 +2,48 @@
2
2
 
3
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
4
 
5
+
6
+ ## [1.1.0] - 2022-05-17
7
+
8
+ ### Added
9
+
10
+ - Ability to check `smtpmock` version from cli
11
+
12
+ ### Updated
13
+
14
+ - Updated gemspecs
15
+ - Updated codeclimate/circleci configs
16
+ - Updated gem development dependencies
17
+ - Updated gem version
18
+
19
+ ## [1.0.1] - 2022-03-10
20
+
21
+ ### Added
22
+
23
+ - Development environment guide
24
+
25
+ ### Updated
26
+
27
+ - Updated gemspecs
28
+ - Updated codeclimate/circleci configs
29
+ - Updated gem development dependencies
30
+ - Updated gem version
31
+
32
+ ## [1.0.0] - 2022-01-31
33
+
34
+ ### Added
35
+
36
+ - Added `smtpmock` version checker
37
+ - Added command for upgrade `smtpmock` to latest version
38
+ - Added `SmtpMock::Error::Dependency::SMTPMOCK_MIN_VERSION`
39
+ - Added `SmtpMock::Server#version`, tests
40
+
41
+ ### Updated
42
+
43
+ - Updated `SmtpMock::Dependency.verify_dependencies`, tests
44
+ - Updated `SmtpMock::Cli::Command`, tests
45
+ - Updated gem version, documentation
46
+
5
47
  ## [0.1.2] - 2022-01-24
6
48
 
7
49
  ### Updated
data/CONTRIBUTING.md CHANGED
@@ -42,5 +42,7 @@ Guidelines for pull requests:
42
42
  2. Fork the repo, checkout to `develop` branch
43
43
  3. Run the tests. This is to make sure your starting point works
44
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
45
+ 5. Create a new branch
46
+ 6. Read our [setup development environment guide](.github/DEVELOPMENT_ENVIRONMENT_GUIDE.md)
47
+ 7. Make your changes. Please note that your PR should include tests for the new codebase!
48
+ 9. Push to your fork and submit a pull request to `develop` branch
data/README.md CHANGED
@@ -77,8 +77,10 @@ This gem includes easy system dependency manager. Run `bundle exec smtp_mock` wi
77
77
  | Flag | Description | Example of usage |
78
78
  | --- | --- | --- |
79
79
  | `-s`, `--sudo` | Run command as sudo | `bundle exec smtp_mock -s -i ~` |
80
- | `-i`, `--install=PATH` | Install smtpmock to the existing path | `bundle exec smtp_mock -i ~/existent_dir` |
81
- | `-u`, `--uninstall` | Uninstall smtpmock | `bundle exec smtp_mock -u` |
80
+ | `-i`, `--install=PATH` | Install `smtpmock` to the existing path | `bundle exec smtp_mock -i ~/existent_dir` |
81
+ | `-u`, `--uninstall` | Uninstall `smtpmock` | `bundle exec smtp_mock -u` |
82
+ | `-g`, `--upgrade` | Upgrade to latest version of `smtpmock` | `bundle exec smtp_mock -g` |
83
+ | `-v`, `--version` | Prints current version of `smtpmock` | `bundle exec smtp_mock -v` |
82
84
  | `-h`, `--help` | Prints help | `bundle exec smtp_mock -h` |
83
85
 
84
86
  ### DSL
@@ -134,6 +136,9 @@ smtp_mock_server.port # => 55640
134
136
  # returns current smtp mock server port
135
137
  smtp_mock_server.pid # => 38195
136
138
 
139
+ # returns current smtp mock server version
140
+ smtp_mock_server.version # => '1.5.2'
141
+
137
142
  # interface for graceful shutdown current smtp mock server
138
143
  smtp_mock_server.stop # => true
139
144
 
@@ -8,53 +8,83 @@ module SmtpMock
8
8
  USE_CASE = 'Usage: smtp_mock [options], example: `bundle exec smtp_mock -s -i ~/existent_dir`'
9
9
  DOWNLOAD_SCRIPT = 'https://raw.githubusercontent.com/mocktools/go-smtp-mock/master/script/download.sh'
10
10
 
11
- def resolve(command_line_args) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
11
+ def resolve(command_line_args) # rubocop:disable Metrics/AbcSize
12
12
  opt_parser = ::OptionParser.new do |parser|
13
13
  parser.banner = SmtpMock::Cli::Resolver::USE_CASE
14
+ parser.on('-s', '--sudo', 'Run command as sudo') { self.sudo = true }
15
+ parser.on('-iPATH', '--install=PATH', 'Install smtpmock to the existing path', &install)
16
+ parser.on('-u', '--uninstall', 'Uninstall smtpmock', &uninstall)
17
+ parser.on('-g', '--upgrade', 'Upgrade to latest version of smtpmock', &upgrade)
18
+ parser.on('-v', '--version', 'Prints current smtpmock version', &version)
19
+ parser.on('-h', '--help', 'Prints help') { self.message = parser.to_s }
14
20
 
15
- parser.on('-s', '--sudo', 'Run command as sudo') do
16
- self.sudo = true
17
- end
21
+ self.success = true
22
+ end
18
23
 
19
- parser.on('-iPATH', '--install=PATH', 'Install smtpmock to the existing path') do |argument|
20
- self.install_path = argument
21
- return self.message = 'smtpmock is already installed' if ::File.exist?(binary_path)
24
+ opt_parser.parse(command_line_args) # TODO: add error handler
25
+ end
22
26
 
23
- ::Kernel.system("cd #{install_path} && curl -sL #{SmtpMock::Cli::Resolver::DOWNLOAD_SCRIPT} | bash")
24
- ::Kernel.system("#{as_sudo}ln -s #{binary_path} #{SmtpMock::Dependency::SYMLINK}")
27
+ private
25
28
 
26
- self.message = 'smtpmock was installed successfully'
27
- end
29
+ def install
30
+ lambda do |argument|
31
+ self.install_path = argument
32
+ return self.message = 'smtpmock is already installed' if ::File.exist?(binary_path)
28
33
 
29
- parser.on('-u', '--uninstall', 'Uninstall smtpmock') do
30
- current_smtpmock_path = SmtpMock::Dependency.smtpmock_path_by_symlink
31
- return self.message = 'smtpmock not installed yet' if current_smtpmock_path.empty?
34
+ install_to(install_path)
35
+ ::Kernel.system("#{as_sudo}ln -s #{binary_path} #{SmtpMock::Dependency::SYMLINK}")
36
+ self.message = 'smtpmock was installed successfully'
37
+ end
38
+ end
32
39
 
33
- ::Kernel.system("#{as_sudo}unlink #{SmtpMock::Dependency::SYMLINK}")
34
- ::Kernel.system("rm #{current_smtpmock_path}")
40
+ def uninstall
41
+ lambda do |_|
42
+ return if not_installed?
35
43
 
36
- self.message = 'smtpmock was uninstalled successfully'
37
- end
44
+ ::Kernel.system("#{as_sudo}unlink #{SmtpMock::Dependency::SYMLINK}")
45
+ ::Kernel.system("rm #{current_smtpmock_path}")
46
+ self.message = 'smtpmock was uninstalled successfully'
47
+ end
48
+ end
38
49
 
39
- parser.on('-h', '--help', 'Prints help') do
40
- self.message = parser.to_s
41
- end
50
+ def upgrade
51
+ lambda do |_|
52
+ return if not_installed?
42
53
 
43
- self.success = true
54
+ install_to(current_smtpmock_path[%r{(.+)/.+}, 1])
55
+ self.message = 'smtpmock was upgraded successfully'
44
56
  end
45
-
46
- opt_parser.parse(command_line_args) # TODO: add error handler
47
57
  end
48
58
 
49
- private
59
+ def version
60
+ lambda do |_|
61
+ return if not_installed?
62
+
63
+ self.message = SmtpMock::Dependency.version
64
+ end
65
+ end
50
66
 
51
67
  def binary_path
52
68
  "#{install_path}/smtpmock"
53
69
  end
54
70
 
71
+ def install_to(install_path)
72
+ ::Kernel.system("cd #{install_path} && curl -sL #{SmtpMock::Cli::Resolver::DOWNLOAD_SCRIPT} | bash")
73
+ end
74
+
55
75
  def as_sudo
56
76
  return 'sudo ' if sudo
57
77
  end
78
+
79
+ def current_smtpmock_path
80
+ @current_smtpmock_path ||= SmtpMock::Dependency.smtpmock_path_by_symlink
81
+ end
82
+
83
+ def not_installed?
84
+ return false unless current_smtpmock_path.empty?
85
+ self.message = 'smtpmock not installed yet'
86
+ true
87
+ end
58
88
  end
59
89
  end
60
90
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmtpMock
4
+ SMTPMOCK_MIN_VERSION = '1.5.0'
5
+
4
6
  module Error
5
7
  require_relative '../smtp_mock/error/argument'
6
8
  require_relative '../smtp_mock/error/dependency'
@@ -4,6 +4,7 @@ module SmtpMock
4
4
  module Dependency
5
5
  BINARY_SHORTCUT = 'smtpmock'
6
6
  SYMLINK = "/usr/local/bin/#{BINARY_SHORTCUT}"
7
+ VERSION_REGEX_PATTERN = /#{BINARY_SHORTCUT}: (.+)/.freeze
7
8
 
8
9
  class << self
9
10
  def smtpmock_path_by_symlink
@@ -16,11 +17,27 @@ module SmtpMock
16
17
 
17
18
  def verify_dependencies
18
19
  raise SmtpMock::Error::Dependency, SmtpMock::Error::Dependency::SMTPMOCK_NOT_INSTALLED unless smtpmock?
20
+ current_version = version
21
+ raise SmtpMock::Error::Dependency, SmtpMock::Error::Dependency::SMTPMOCK_MIN_VERSION unless minimal_version?(current_version)
22
+ current_version
19
23
  end
20
24
 
21
25
  def compose_command(command_line_args)
22
26
  "#{SmtpMock::Dependency::BINARY_SHORTCUT} #{command_line_args}".strip
23
27
  end
28
+
29
+ def version
30
+ ::Kernel.public_send(
31
+ :`,
32
+ "#{SmtpMock::Dependency::BINARY_SHORTCUT} -v"
33
+ )[SmtpMock::Dependency::VERSION_REGEX_PATTERN, 1]
34
+ end
35
+
36
+ private
37
+
38
+ def minimal_version?(current_version)
39
+ !!current_version && current_version >= SmtpMock::SMTPMOCK_MIN_VERSION
40
+ end
24
41
  end
25
42
  end
26
43
  end
@@ -4,6 +4,7 @@ module SmtpMock
4
4
  module Error
5
5
  class Dependency < ::RuntimeError
6
6
  SMTPMOCK_NOT_INSTALLED = 'smtpmock is required system dependency. Run `bundle exec smtp_mock -h` for details'
7
+ SMTPMOCK_MIN_VERSION = "smtpmock #{SmtpMock::SMTPMOCK_MIN_VERSION} or higher is required. Run `bundle exec smtp_mock -g` for version upgrade"
7
8
  end
8
9
  end
9
10
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module SmtpMock
4
4
  class Server
5
- attr_reader :pid, :port
5
+ attr_reader :pid, :port, :version
6
6
 
7
7
  def initialize( # rubocop:disable Metrics/ParameterLists
8
8
  deps_handler = SmtpMock::Dependency,
@@ -11,7 +11,7 @@ module SmtpMock
11
11
  process = SmtpMock::Server::Process,
12
12
  **args
13
13
  )
14
- deps_handler.verify_dependencies
14
+ @version = deps_handler.verify_dependencies
15
15
  args[:port] = port_checker.random_free_port unless args.include?(:port)
16
16
  @command_line_args, @port = args_builder.call(**args), args[:port]
17
17
  @deps_handler, @port_checker, @process = deps_handler, port_checker, process
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmtpMock
4
- VERSION = '0.1.2'
4
+ VERSION = '1.1.0'
5
5
  end
data/smtp_mock.gemspec CHANGED
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = ::File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require 'smtp_mock/version'
3
+ require_relative 'lib/smtp_mock/version'
6
4
 
7
5
  Gem::Specification.new do |spec|
8
6
  spec.name = 'smtp_mock'
@@ -33,17 +31,8 @@ Gem::Specification.new do |spec|
33
31
 
34
32
  spec.add_runtime_dependency 'dry-struct', '~> 1.4'
35
33
 
36
- spec.add_development_dependency 'bundler-audit', '~> 0.9.0.1'
37
- spec.add_development_dependency 'fasterer', '~> 0.9.0'
38
- spec.add_development_dependency 'ffaker', '~> 2.20'
39
- spec.add_development_dependency 'net-smtp', '~> 0.3' if ::RUBY_VERSION >= '3.1.0'
40
- spec.add_development_dependency 'overcommit', '~> 0.58.0'
41
- spec.add_development_dependency 'pry-byebug', '~> 3.9'
34
+ spec.add_development_dependency 'ffaker', '~> 2.21'
35
+ spec.add_development_dependency 'net-smtp', '~> 0.3.1' if ::RUBY_VERSION >= '3.1.0'
42
36
  spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
43
- spec.add_development_dependency 'reek', '~> 6.0', '>= 6.0.6'
44
- spec.add_development_dependency 'rspec', '~> 3.10'
45
- spec.add_development_dependency 'rubocop', '~> 1.24'
46
- spec.add_development_dependency 'rubocop-performance', '~> 1.13'
47
- spec.add_development_dependency 'rubocop-rspec', '~> 2.7'
48
- spec.add_development_dependency 'simplecov', '~> 0.17.1'
37
+ spec.add_development_dependency 'rspec', '~> 3.11'
49
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smtp_mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladislav Trotsenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-24 00:00:00.000000000 Z
11
+ date: 2022-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-struct
@@ -24,76 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.4'
27
- - !ruby/object:Gem::Dependency
28
- name: bundler-audit
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 0.9.0.1
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 0.9.0.1
41
- - !ruby/object:Gem::Dependency
42
- name: fasterer
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.9.0
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.9.0
55
27
  - !ruby/object:Gem::Dependency
56
28
  name: ffaker
57
29
  requirement: !ruby/object:Gem::Requirement
58
30
  requirements:
59
31
  - - "~>"
60
32
  - !ruby/object:Gem::Version
61
- version: '2.20'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '2.20'
69
- - !ruby/object:Gem::Dependency
70
- name: overcommit
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 0.58.0
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 0.58.0
83
- - !ruby/object:Gem::Dependency
84
- name: pry-byebug
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.9'
33
+ version: '2.21'
90
34
  type: :development
91
35
  prerelease: false
92
36
  version_requirements: !ruby/object:Gem::Requirement
93
37
  requirements:
94
38
  - - "~>"
95
39
  - !ruby/object:Gem::Version
96
- version: '3.9'
40
+ version: '2.21'
97
41
  - !ruby/object:Gem::Dependency
98
42
  name: rake
99
43
  requirement: !ruby/object:Gem::Requirement
@@ -114,96 +58,20 @@ dependencies:
114
58
  - - ">="
115
59
  - !ruby/object:Gem::Version
116
60
  version: 13.0.6
117
- - !ruby/object:Gem::Dependency
118
- name: reek
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: '6.0'
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: 6.0.6
127
- type: :development
128
- prerelease: false
129
- version_requirements: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - "~>"
132
- - !ruby/object:Gem::Version
133
- version: '6.0'
134
- - - ">="
135
- - !ruby/object:Gem::Version
136
- version: 6.0.6
137
61
  - !ruby/object:Gem::Dependency
138
62
  name: rspec
139
63
  requirement: !ruby/object:Gem::Requirement
140
64
  requirements:
141
65
  - - "~>"
142
66
  - !ruby/object:Gem::Version
143
- version: '3.10'
144
- type: :development
145
- prerelease: false
146
- version_requirements: !ruby/object:Gem::Requirement
147
- requirements:
148
- - - "~>"
149
- - !ruby/object:Gem::Version
150
- version: '3.10'
151
- - !ruby/object:Gem::Dependency
152
- name: rubocop
153
- requirement: !ruby/object:Gem::Requirement
154
- requirements:
155
- - - "~>"
156
- - !ruby/object:Gem::Version
157
- version: '1.24'
158
- type: :development
159
- prerelease: false
160
- version_requirements: !ruby/object:Gem::Requirement
161
- requirements:
162
- - - "~>"
163
- - !ruby/object:Gem::Version
164
- version: '1.24'
165
- - !ruby/object:Gem::Dependency
166
- name: rubocop-performance
167
- requirement: !ruby/object:Gem::Requirement
168
- requirements:
169
- - - "~>"
170
- - !ruby/object:Gem::Version
171
- version: '1.13'
172
- type: :development
173
- prerelease: false
174
- version_requirements: !ruby/object:Gem::Requirement
175
- requirements:
176
- - - "~>"
177
- - !ruby/object:Gem::Version
178
- version: '1.13'
179
- - !ruby/object:Gem::Dependency
180
- name: rubocop-rspec
181
- requirement: !ruby/object:Gem::Requirement
182
- requirements:
183
- - - "~>"
184
- - !ruby/object:Gem::Version
185
- version: '2.7'
186
- type: :development
187
- prerelease: false
188
- version_requirements: !ruby/object:Gem::Requirement
189
- requirements:
190
- - - "~>"
191
- - !ruby/object:Gem::Version
192
- version: '2.7'
193
- - !ruby/object:Gem::Dependency
194
- name: simplecov
195
- requirement: !ruby/object:Gem::Requirement
196
- requirements:
197
- - - "~>"
198
- - !ruby/object:Gem::Version
199
- version: 0.17.1
67
+ version: '3.11'
200
68
  type: :development
201
69
  prerelease: false
202
70
  version_requirements: !ruby/object:Gem::Requirement
203
71
  requirements:
204
72
  - - "~>"
205
73
  - !ruby/object:Gem::Version
206
- version: 0.17.1
74
+ version: '3.11'
207
75
  description: "\U0001F48E Ruby SMTP mock. Mimic any SMTP server behaviour for your
208
76
  test environment."
209
77
  email:
@@ -214,8 +82,12 @@ extensions: []
214
82
  extra_rdoc_files: []
215
83
  files:
216
84
  - ".circleci/config.yml"
85
+ - ".circleci/gemspec_compatible"
86
+ - ".circleci/gemspec_latest"
217
87
  - ".codeclimate.yml"
218
88
  - ".github/BRANCH_NAMING_CONVENTION.md"
89
+ - ".github/DEVELOPMENT_ENVIRONMENT_GUIDE.md"
90
+ - ".github/FUNDING.yml"
219
91
  - ".github/ISSUE_TEMPLATE/bug_report.md"
220
92
  - ".github/ISSUE_TEMPLATE/feature_request.md"
221
93
  - ".github/ISSUE_TEMPLATE/issue_report.md"
@@ -281,7 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
153
  - !ruby/object:Gem::Version
282
154
  version: '0'
283
155
  requirements: []
284
- rubygems_version: 3.2.20
156
+ rubyforge_project:
157
+ rubygems_version: 2.7.3
285
158
  signing_key:
286
159
  specification_version: 4
287
160
  summary: smtp_mock