Skip to content

Commit f707f2e

Browse files
authored
Technical/Update gem dependencies (#23)
* Updated gem development dependencies * Updated simplecov/CircleCi config * Fixed syntax compatibility with Ruby 3.x * Updated gem version, changelog, documentation
1 parent 02b1fad commit f707f2e

18 files changed

+159
-74
lines changed

.circleci/config.yml

Lines changed: 59 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1+
version: 2.1
2+
13
defaults: &defaults
24
working_directory: ~/truemail-ruby-client
35
docker:
4-
- image: circleci/ruby:2.5.0-node
6+
- image: cimg/ruby:<< parameters.ruby-version >>
57
environment:
68
CC_TEST_REPORTER_ID: 183d1173cc05e4e5dbd07ddb60a04b9c4115ed11a4bacda0e1834572eb168c51
79

10+
orbs:
11+
ruby: circleci/ruby@1.1.3
12+
813
references:
14+
install_bundler: &install_bundler
15+
run:
16+
name: Installing Bundler
17+
command: gem i bundler -v $(tail -1 Gemfile.lock | tr -d ' ')
18+
919
restore_bundle_cache: &restore_bundle_cache
1020
restore_cache:
1121
keys:
@@ -24,66 +34,97 @@ references:
2434

2535
install_codeclimate_reporter: &install_codeclimate_reporter
2636
run:
27-
name: Install Code Climate Test Reporter
37+
name: Installing CodeClimate test reporter
2838
command: |
2939
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
3040
chmod +x ./cc-test-reporter
3141
32-
version: 2
3342
jobs:
34-
linters:
43+
linters-ruby:
44+
parameters:
45+
ruby-version:
46+
type: string
47+
3548
<<: *defaults
3649

3750
steps:
3851
- checkout
3952

53+
- <<: *install_bundler
4054
- <<: *restore_bundle_cache
4155
- <<: *bundle_install
4256
- <<: *save_bundle_cache
4357

4458
- run:
45-
name: Running overcommit
59+
name: Running Overcommit
4660
command: |
4761
bundle exec overcommit -s
4862
SKIP=AuthorEmail,AuthorName bundle exec overcommit -r
4963
50-
tests:
64+
tests-ruby:
65+
parameters:
66+
ruby-version:
67+
type: string
68+
5169
<<: *defaults
5270

5371
steps:
5472
- checkout
5573

74+
- <<: *install_bundler
5675
- <<: *restore_bundle_cache
5776
- <<: *bundle_install
5877
- <<: *save_bundle_cache
5978
- <<: *install_codeclimate_reporter
6079

6180
- run:
62-
name: Running tests
81+
name: Running RSpec
6382
command: |
64-
mkdir /tmp/test-results
6583
./cc-test-reporter before-build
6684
bundle exec rspec
6785
6886
- run:
69-
name: Code Climate Test Coverage
87+
name: Creating CodeClimate test coverage report
7088
command: |
7189
./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
7290
73-
- store_test_results:
74-
path: /tmp/test-results
75-
7691
- store_artifacts:
77-
path: /tmp/test-results
78-
destination: test-results
92+
name: Saving Simplecov coverage artifacts
93+
path: ~/truemail-ruby-client/coverage
94+
destination: coverage
7995

8096
- deploy:
97+
name: Uploading CodeClimate test coverage report
8198
command: |
8299
./cc-test-reporter sum-coverage --output - --parts $CIRCLE_NODE_TOTAL coverage/codeclimate.*.json | ./cc-test-reporter upload-coverage --debug --input -
83100
101+
compatibility-ruby:
102+
parameters:
103+
ruby-version:
104+
type: string
105+
docker:
106+
- image: cimg/ruby:<< parameters.ruby-version >>
107+
steps:
108+
- checkout
109+
- ruby/install-deps:
110+
with-cache: false
111+
path: './vendor/custom_bundle'
112+
- run:
113+
name: Running compatibility tests
114+
command: bundle exec rspec
115+
84116
workflows:
85-
version: 2
86-
build:
117+
build_and_test:
87118
jobs:
88-
- linters
89-
- tests
119+
- linters-ruby:
120+
matrix:
121+
parameters:
122+
ruby-version: ["2.5"]
123+
- tests-ruby:
124+
matrix:
125+
parameters:
126+
ruby-version: ["2.5"]
127+
- compatibility-ruby:
128+
matrix:
129+
parameters:
130+
ruby-version: ["2.6", "2.7", "3.0"]

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
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).
44

5+
## [0.3.2] - 2021-05-19
6+
7+
### Fixed
8+
9+
- Gem syntax compatibility with Ruby 3.x
10+
11+
### Changed
12+
13+
- Updated gem dependencies
14+
- Updated rubocop/codeclimate config
15+
- Updated gem version
16+
517
## [0.3.1] - 2021-05-08
618

719
### Changed

Gemfile.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
truemail-client (0.3.1)
4+
truemail-client (0.3.2)
55

66
GEM
77
remote: https://rubygems.org/
@@ -20,8 +20,8 @@ GEM
2020
crack (0.4.5)
2121
rexml
2222
diff-lcs (1.4.4)
23-
docile (1.3.5)
24-
faker (2.17.0)
23+
docile (1.4.0)
24+
faker (2.18.0)
2525
i18n (>= 1.6, < 2)
2626
fasterer (0.9.0)
2727
colorize (~> 0.7)
@@ -48,7 +48,7 @@ GEM
4848
pry-byebug (3.9.0)
4949
byebug (~> 11.0)
5050
pry (~> 0.13.0)
51-
psych (3.3.1)
51+
psych (3.3.2)
5252
public_suffix (4.0.6)
5353
rainbow (3.0.0)
5454
rake (13.0.3)
@@ -72,7 +72,7 @@ GEM
7272
diff-lcs (>= 1.2.0, < 2.0)
7373
rspec-support (~> 3.10.0)
7474
rspec-support (3.10.2)
75-
rubocop (1.14.0)
75+
rubocop (1.15.0)
7676
parallel (~> 1.10)
7777
parser (>= 3.0.0.0)
7878
rainbow (>= 2.2.2, < 4.0)
@@ -90,26 +90,26 @@ GEM
9090
rubocop (~> 1.0)
9191
rubocop-ast (>= 1.1.0)
9292
ruby-progressbar (1.11.0)
93-
ruby_parser (3.15.1)
94-
sexp_processor (~> 4.9)
95-
sexp_processor (4.15.2)
93+
ruby_parser (3.16.0)
94+
sexp_processor (~> 4.15, >= 4.15.1)
95+
sexp_processor (4.15.3)
9696
simplecov (0.17.1)
9797
docile (~> 1.1)
9898
json (>= 1.8, < 3)
9999
simplecov-html (~> 0.10.0)
100100
simplecov-html (0.10.2)
101101
thor (1.1.0)
102102
unicode-display_width (2.0.0)
103-
webmock (3.12.2)
103+
webmock (3.13.0)
104104
addressable (>= 2.3.6)
105105
crack (>= 0.3.2)
106106
hashdiff (>= 0.4.0, < 2.0.0)
107107

108108
PLATFORMS
109-
ruby
109+
x86_64-darwin-19
110110

111111
DEPENDENCIES
112-
bundler (~> 1.16)
112+
bundler (~> 2.2, >= 2.2.17)
113113
bundler-audit (~> 0.8.0)
114114
faker (~> 2.17)
115115
fasterer (~> 0.9.0)
@@ -127,4 +127,4 @@ DEPENDENCIES
127127
webmock (~> 3.12, >= 3.12.2)
128128

129129
BUNDLED WITH
130-
1.16.6
130+
2.2.17

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,17 @@ To have an access for `Truemail::Client` you must configure it first as in the e
5959
require 'truemail/client'
6060

6161
Truemail::Client.configure do |config|
62-
# Optional parameter (Boolean). By default it is equal false
63-
config.secure_connection = true
64-
6562
# Required parameter (String). It should be a hostname or an ip address where Truemail server runs
6663
config.host = 'example.com'
6764

68-
# Optional parameter (Integer). By default it is equal 9292
69-
config.port = 80
70-
7165
# Required parameter (String). It should be valid Truemail server access token
7266
config.token = 'token'
67+
68+
# Optional parameter (Boolean). By default it is equal false
69+
config.secure_connection = true
70+
71+
# Optional parameter (Integer). By default it is equal 9292
72+
config.port = 80
7373
end
7474
```
7575

@@ -94,6 +94,8 @@ Truemail::Client.validate('admin@bestweb.com.ua')
9494
"whitelist_validation": false,
9595
"whitelisted_domains": null,
9696
"blacklisted_domains": null,
97+
"blacklisted_mx_ip_addresses": null,
98+
"dns": null,
9799
"smtp_safe_check": false,
98100
"email_pattern": "default gem value",
99101
"smtp_error_body_pattern": "default gem value",

lib/truemail/client/configuration.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ module Client
55
class Configuration
66
DEFAULT_PORT = 9292
77

8-
Error = Class.new(StandardError)
9-
ArgumentError = Class.new(StandardError) do
8+
Error = ::Class.new(::StandardError)
9+
ArgumentError = ::Class.new(::StandardError) do
1010
def initialize(arg_value, arg_name)
1111
super("#{arg_value} is not a valid #{arg_name[0..-2]}")
1212
end
@@ -26,7 +26,7 @@ def initialize(&block)
2626
raise_unless(
2727
argument,
2828
__method__,
29-
method.eql?(:port) ? argument.is_a?(Integer) && argument.positive? : argument.is_a?(String)
29+
method.eql?(:port) ? argument.is_a?(::Integer) && argument.positive? : argument.is_a?(::String)
3030
)
3131
instance_variable_set(:"@#{method}", argument)
3232
end

lib/truemail/client/http.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def initialize(endpoint = Truemail::Client::Http::VALIDATION_ENDPOINT, **uri_par
2222
end
2323

2424
def run
25-
Net::HTTP.start(uri.host, uri.port, use_ssl: secure_connection) do |http|
26-
request = Net::HTTP::Get.new(uri)
25+
::Net::HTTP.start(uri.host, uri.port, use_ssl: secure_connection) do |http|
26+
request = ::Net::HTTP::Get.new(uri)
2727
request['User-Agent'] = Truemail::Client::Http::USER_AGENT
2828
request['Accept'] = Truemail::Client::Http::MIME_TYPE
2929
request['Content-Type'] = Truemail::Client::Http::MIME_TYPE
@@ -41,9 +41,9 @@ def run
4141
attr_reader(*Truemail::Client::Http::URI_ATTRS)
4242

4343
def request_uri
44-
URI::HTTP.build(
44+
::URI::HTTP.build(
4545
path: endpoint,
46-
query: uri_params.empty? ? nil : URI.encode_www_form(uri_params)
46+
query: uri_params.empty? ? nil : ::URI.encode_www_form(uri_params)
4747
).request_uri
4848
end
4949

lib/truemail/client/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
module Truemail
44
module Client
5-
VERSION = '0.3.1'
5+
VERSION = '0.3.2'
66
end
77
end

spec/spec_helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

3-
rspec_custom = File.join(File.dirname(__FILE__), 'support/**/*.rb')
4-
Dir[File.expand_path(rspec_custom)].sort.each { |file| require file unless file[/\A.+_spec\.rb\z/] }
3+
rspec_custom = ::File.join(File.dirname(__FILE__), 'support/**/*.rb')
4+
::Dir[::File.expand_path(rspec_custom)].sort.each { |file| require file unless file[/\A.+_spec\.rb\z/] }
55

66
require 'truemail/client'
77

@@ -22,5 +22,5 @@
2222
config.order = :random
2323
config.before { Truemail::Client.reset_configuration! }
2424

25-
Kernel.srand(config.seed)
25+
::Kernel.srand(config.seed)
2626
end

spec/support/config/simplecov.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# frozen_string_literal: true
22

3-
require 'simplecov'
3+
if ::RUBY_VERSION[/\A2\.5.+\z/]
4+
require 'simplecov'
45

5-
SimpleCov.minimum_coverage(100)
6-
SimpleCov.start
6+
SimpleCov.minimum_coverage(100)
7+
SimpleCov.start { add_filter(%r{\A/spec/}) }
8+
end

spec/support/helpers/configuration_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def configure_client(**configuration_settings)
1919
Truemail::Client.reset_configuration!
2020
configuration_settings[:host] = Faker::Internet.domain_name unless configuration_settings[:host]
2121
configuration_settings[:token] = create_token unless configuration_settings[:token]
22-
Truemail::Client.configure(&configuration_block(configuration_settings))
22+
Truemail::Client.configure(&configuration_block(**configuration_settings))
2323
end
2424

2525
def client_configuration

spec/support/helpers/configuration_helper_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
RSpec.describe ConfigurationHelper, type: :helper do
44
describe '#configuration_block' do
55
let(:configuration_params) { { param_1: 1, param_2: 2 } }
6-
let(:configuration_instance) { Struct.new(*configuration_params.keys).new }
6+
let(:configuration_instance) { ::Struct.new(*configuration_params.keys).new }
77

8-
before { configuration_block(configuration_params).call(configuration_instance) }
8+
before { configuration_block(**configuration_params).call(configuration_instance) }
99

10-
specify { expect(configuration_block).to be_an_instance_of(Proc) }
10+
specify { expect(configuration_block).to be_an_instance_of(::Proc) }
1111

1212
it 'sets configuration instance attributes' do
1313
configuration_params.each do |attribute, value|
@@ -19,12 +19,12 @@
1919
describe '#create_token' do
2020
it 'returns secure token' do
2121
expect(SecureRandom).to receive(:uuid).and_call_original
22-
expect(create_token).to be_an_instance_of(String)
22+
expect(create_token).to be_an_instance_of(::String)
2323
end
2424
end
2525

2626
describe '#configure_client' do
27-
subject(:configuration_builder) { configure_client(params) }
27+
subject(:configuration_builder) { configure_client(**params) }
2828

2929
let(:params) { {} }
3030

0 commit comments

Comments
 (0)