Skip to content

Commit

Permalink
Merge pull request #67 from mocktools/develop
Browse files Browse the repository at this point in the history
Ruby SmtpMock v1.3.3
  • Loading branch information
bestwebua committed Jan 10, 2023
2 parents 91e06ea + c9e5bc2 commit 6b9f231
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 19 deletions.
10 changes: 7 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ jobs:
name: Running code documentation linters
command: lefthook run code-documentation-linters

- run:
name: Running release linters
command: lefthook run release-linters

tests-ruby:
parameters:
ruby-version:
Expand Down Expand Up @@ -183,15 +187,15 @@ workflows:
- linters-ruby:
matrix:
parameters:
ruby-version: ["3.1-node"]
ruby-version: ["3.2-node"]
- tests-ruby:
matrix:
parameters:
ruby-version: ["3.1"]
ruby-version: ["3.2"]
- compatibility-ruby:
matrix:
parameters:
ruby-version: ["2.5", "2.6", "2.7", "3.0"]
ruby-version: ["2.5", "2.6", "2.7", "3.0", "3.1"]
- releasing-gem-from-ruby:
requires:
- linters-ruby
Expand Down
4 changes: 3 additions & 1 deletion .circleci/gemspecs/compatible
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Gem::Specification.new do |spec|
spec.homepage = 'https://github.com/mocktools/ruby-smtp-mock'
spec.license = 'MIT'

dry_struct_version = ::Gem::Version.new(::RUBY_VERSION) >= ::Gem::Version.new('2.7.0') ? '~> 1.6' : '~> 1.4'
current_ruby_version = ::Gem::Version.new(::RUBY_VERSION)
dry_struct_version = current_ruby_version >= ::Gem::Version.new('2.7.0') ? '~> 1.6' : '~> 1.4'

spec.required_ruby_version = '>= 2.5.0'
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
Expand All @@ -22,6 +23,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'dry-struct', dry_struct_version

spec.add_development_dependency 'ffaker'
spec.add_development_dependency 'net-smtp' if current_ruby_version >= ::Gem::Version.new('3.1.0')
spec.add_development_dependency 'rake'
spec.add_development_dependency 'rspec'
end
10 changes: 5 additions & 5 deletions .circleci/gemspecs/latest
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'net-smtp', '~> 0.3.3'
spec.add_development_dependency 'pry-byebug', '~> 3.10', '>= 3.10.1'
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
spec.add_development_dependency 'reek', '~> 6.1', '>= 6.1.1'
spec.add_development_dependency 'reek', '~> 6.1', '>= 6.1.3'
spec.add_development_dependency 'rspec', '~> 3.12'
spec.add_development_dependency 'rubocop', '~> 1.40'
spec.add_development_dependency 'rubocop-performance', '~> 1.15', '>= 1.15.1'
spec.add_development_dependency 'rubocop-rspec', '~> 2.15'
spec.add_development_dependency 'simplecov', '~> 0.21.2'
spec.add_development_dependency 'rubocop', '~> 1.42'
spec.add_development_dependency 'rubocop-performance', '~> 1.15', '>= 1.15.2'
spec.add_development_dependency 'rubocop-rspec', '~> 2.16'
spec.add_development_dependency 'simplecov', '~> 0.22.0'
end
6 changes: 6 additions & 0 deletions .circleci/linter_configs/.lefthook.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---

no_tty: true
skip_output:
- meta

Expand Down Expand Up @@ -31,3 +32,8 @@ code-documentation-linters:
run: cspell-cli lint -c '.circleci/linter_configs/.cspell.yml' '**/*.{txt,md}'
markdownlint:
run: markdownlint -c '.circleci/linter_configs/.markdownlint.yml' '**/*.md'

release-linters:
commands:
changeloglint:
run: .circleci/scripts/changeloglint.sh
22 changes: 22 additions & 0 deletions .circleci/scripts/changeloglint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
set -e

changelog=$(if [ "$1" = "" ]; then echo "CHANGELOG.md"; else echo "$1"; fi)

get_current_gem_version() {
ruby -r rubygems -e "puts Gem::Specification::load('$(ls -- *.gemspec)').version"
}

latest_changelog_tag() {
grep -Po "(?<=\#\# \[)[0-9]+\.[0-9]+\.[0-9]+?(?=\])" "$changelog" | head -n 1
}

current_gem_version="$(get_current_gem_version)"

if [ "$current_gem_version" = "$(latest_changelog_tag)" ]
then
echo "SUCCESS: Current gem version ($current_gem_version) has been found on the top of project changelog."
else
echo "FAILURE: Following to \"Keep a Changelog\" convention current gem version ($current_gem_version) must be mentioned on the top of project changelog."
exit 1
fi
3 changes: 1 addition & 2 deletions .circleci/scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DELIMETER="_"
PACKAGE_FILE="$FILE_NAME$DELIMETER$BUILD_ARCHITECTURE"

gh_cli_latest_release() {
curl -sL -o /dev/null -w '%{url_effective}' "$GH_CLI_RELEASES_URL/latest" | rev | cut -f1 -d'/'| rev
curl -sL -o /dev/null -w '%{url_effective}' "$GH_CLI_RELEASES_URL/latest" | rev | cut -f 1 -d '/'| rev
}

download_gh_cli() {
Expand Down Expand Up @@ -42,7 +42,6 @@ release_to_rubygems() {
git config --global user.email "${PUBLISHER_EMAIL}"
git config --global user.name "${PUBLISHER_NAME}"
git stash
git checkout develop
gem install yard gem-ctags
bundle install
echo "Publishing new gem release to RubyGems..."
Expand Down
2 changes: 1 addition & 1 deletion .codeclimate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ checks:
plugins:
rubocop:
enabled: true
channel: rubocop-1-39
channel: rubocop-1-42
config:
file: .circleci/linter_configs/.rubocop.yml

Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

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

## [1.3.3] - 2023-01-10

### Added

- Added and tested Ruby 3.2.x support
- Added `changeloglint`

### Updated

- Updated `CircleCI` config
- Updated `lefthook`/`codeclimate`/`simplecov`/`pry` configs
- Updated gem deploy flow (tagging new release on master merge commit)
- Updated gem version, license

## [1.3.2] - 2022-12-12

### Added
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2022 Vladislav Trotsenko
Copyright (c) 2022-2023 Vladislav Trotsenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion lib/smtp_mock/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module SmtpMock
VERSION = '1.3.2'
VERSION = '1.3.3'
end
4 changes: 1 addition & 3 deletions smtp_mock.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ Gem::Specification.new do |spec|
'bug_tracker_uri' => 'https://github.com/mocktools/ruby-smtp-mock/issues'
}

current_ruby_version = ::Gem::Version.new(::RUBY_VERSION)
dry_struct_version = current_ruby_version >= ::Gem::Version.new('2.7.0') ? '~> 1.6' : '~> 1.4'
dry_struct_version = ::Gem::Version.new(::RUBY_VERSION) >= ::Gem::Version.new('2.7.0') ? '~> 1.6' : '~> 1.4'

spec.required_ruby_version = '>= 2.5.0'
spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r{^(bin|lib|tmp)/|.ruby-version|smtp_mock.gemspec|LICENSE}) }
Expand All @@ -34,7 +33,6 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency 'dry-struct', dry_struct_version

spec.add_development_dependency 'ffaker', '~> 2.21'
spec.add_development_dependency 'net-smtp', '~> 0.3.3' if current_ruby_version >= ::Gem::Version.new('3.1.0')
spec.add_development_dependency 'rake', '~> 13.0', '>= 13.0.6'
spec.add_development_dependency 'rspec', '~> 3.12'
end
2 changes: 1 addition & 1 deletion spec/support/config/pry.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# frozen_string_literal: true

require 'pry' if ::RUBY_VERSION[/\A3\.1.+\z/]
require 'pry' if ::RUBY_VERSION[/\A3\.2.+\z/]
2 changes: 1 addition & 1 deletion spec/support/config/simplecov.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

if ::RUBY_VERSION[/\A3\.1.+\z/]
if ::RUBY_VERSION[/\A3\.2.+\z/]
require 'simplecov'

SimpleCov.minimum_coverage(100)
Expand Down

0 comments on commit 6b9f231

Please sign in to comment.