diff --git a/.gitignore b/.gitignore index 922b4d0..606d825 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ .greenbar .rubocop-* measurements +.byebug_history diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..9790ad7 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,4 @@ +# Please keep AllCops, Bundler, Style, Metrics groups and then order cops +# alphabetically +inherit_from: + - https://raw.githubusercontent.com/hanami/devtools/master/.rubocop.yml diff --git a/.travis.yml b/.travis.yml index 3625e31..30b3ba3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,12 @@ language: ruby sudo: false cache: bundler -before_install: - - gem update --system - - rvm @global do gem uninstall bundler -a -x - - rvm @global do gem install bundler -v 1.13.7 -script: 'bundle exec rake --trace' +script: ./script/ci rvm: - - 2.3.3 - - 2.4.0 + - 2.3.5 + - 2.4.2 - ruby-head - - jruby-9.1.6.0 + - jruby-9.1.13.0 - jruby-head matrix: diff --git a/CHANGELOG.md b/CHANGELOG.md index 83e3e54..6ae23c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ # Hanami::Mailer Mail for Ruby applications +## v1.1.0 - 2017-10-25 + +## v1.1.0.rc1 - 2017-10-16 + +## v1.1.0.beta3 - 2017-10-04 + +## v1.1.0.beta2 - 2017-10-03 + +## v1.1.0.beta1 - 2017-08-11 + ## v1.0.0 - 2017-04-06 ## v1.0.0.rc1 - 2017-03-31 diff --git a/Gemfile b/Gemfile index 887655a..582c921 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,8 @@ unless ENV['TRAVIS'] gem 'yard', require: false end -gem 'hanami-utils', '~> 1.0', require: false, git: 'https://github.com/hanami/utils.git', branch: '1.0.x' +gem 'hanami-utils', '~> 1.1', require: false, git: 'https://github.com/hanami/utils.git', branch: 'unstable' gem 'haml' +gem 'hanami-devtools', require: false, git: 'https://github.com/hanami/devtools.git' gem 'coveralls', require: false diff --git a/hanami-mailer.gemspec b/hanami-mailer.gemspec index 8403064..9be3fbc 100644 --- a/hanami-mailer.gemspec +++ b/hanami-mailer.gemspec @@ -19,7 +19,7 @@ Gem::Specification.new do |spec| spec.require_paths = ['lib'] spec.required_ruby_version = '>= 2.3.0' - spec.add_dependency 'hanami-utils', '~> 1.0' + spec.add_dependency 'hanami-utils', '~> 1.1' spec.add_dependency 'tilt', '~> 2.0', '>= 2.0.1' spec.add_dependency 'mail', '~> 2.6' diff --git a/lib/hanami-mailer.rb b/lib/hanami-mailer.rb index 549ee34..e8132d3 100644 --- a/lib/hanami-mailer.rb +++ b/lib/hanami-mailer.rb @@ -1 +1 @@ -require 'hanami/mailer' # rubocop:disable Style/FileName +require 'hanami/mailer' # rubocop:disable Naming/FileName diff --git a/lib/hanami/mailer/rendering/template_name.rb b/lib/hanami/mailer/rendering/template_name.rb index b559fd9..e7abb82 100644 --- a/lib/hanami/mailer/rendering/template_name.rb +++ b/lib/hanami/mailer/rendering/template_name.rb @@ -31,7 +31,7 @@ module Hanami # @api private def compile!(namespace) tokens(namespace) { |token| replace!(token) } - @name = Utils::String.new(@name).underscore + @name = Utils::String.underscore(@name) end # @since 0.1.0 diff --git a/lib/hanami/mailer/version.rb b/lib/hanami/mailer/version.rb index a24fc10..06b0719 100644 --- a/lib/hanami/mailer/version.rb +++ b/lib/hanami/mailer/version.rb @@ -1,6 +1,6 @@ module Hanami module Mailer # @since 0.1.0 - VERSION = '1.0.0'.freeze + VERSION = '1.1.0'.freeze end end diff --git a/script/ci b/script/ci new file mode 100755 index 0000000..c495767 --- /dev/null +++ b/script/ci @@ -0,0 +1,51 @@ +#!/bin/bash +set -euo pipefail +IFS=$'\n\t' + +run_code_quality_checks() { + bundle exec rubocop . +} + +run_unit_tests() { + bundle exec rake spec:coverage +} + +run_isolation_tests() { + local pwd=$PWD + local root="$pwd/spec/isolation" + + if [ -d $root ]; then + for test in $(find $root -name '*_spec.rb') + do + run_isolation_test $test + + if [ $? -ne 0 ]; then + local exit_code=$? + echo "Failing test: $test" + exit $exit_code + fi + done + fi +} + +run_isolation_test() { + local test=$1 + + printf "\n\n\nRunning: $test\n" + ruby $test --options spec/isolation/.rspec +} + +run_test() { + local test=$1 + + printf "\n\n\nRunning: $test\n" + COVERAGE=true bundle exec rspec $test +} + +main() { + run_code_quality_checks && + run_unit_tests && + run_isolation_tests +} + +main diff --git a/spec/unit/hanami/mailer/dsl_spec.rb b/spec/unit/hanami/mailer/dsl_spec.rb index 5ec8cee..1e0451c 100644 --- a/spec/unit/hanami/mailer/dsl_spec.rb +++ b/spec/unit/hanami/mailer/dsl_spec.rb @@ -21,7 +21,7 @@ RSpec.describe Hanami::Mailer do describe 'when no value is set' do it 'returns a set of templates' do template_formats = LazyMailer.templates.keys - expect(template_formats).to eq(%i(html txt)) + expect(template_formats).to eq(%i[html txt]) end it 'returns only the template for the given format' do diff --git a/spec/unit/hanami/mailer/version_spec.rb b/spec/unit/hanami/mailer/version_spec.rb index d7910f9..636b839 100644 --- a/spec/unit/hanami/mailer/version_spec.rb +++ b/spec/unit/hanami/mailer/version_spec.rb @@ -1,5 +1,5 @@ RSpec.describe "Hanami::Mailer::VERSION" do it "returns current version" do - expect(Hanami::Mailer::VERSION).to eq("1.0.0") + expect(Hanami::Mailer::VERSION).to eq("1.1.0") end end