From 50b96e12594954771df05e11e968f45da094903a Mon Sep 17 00:00:00 2001 From: Rustam Ibragimov Date: Sat, 25 May 2019 18:50:21 +0300 Subject: [PATCH 1/5] our oss contact --- polist.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polist.gemspec b/polist.gemspec index ec54a04..bb420b2 100644 --- a/polist.gemspec +++ b/polist.gemspec @@ -8,7 +8,7 @@ Gem::Specification.new do |spec| spec.name = "polist" spec.version = Polist::VERSION spec.authors = ["Yuri Smirnov"] - spec.email = ["tycooon@yandex.ru"] + spec.email = ["tycooon@yandex.ru", "oss@umbrellio.biz"] spec.summary = "A gem for creating simple service classes and more." spec.description = "Polist is a gem for creating simple service classes and more." From 4787aa6a8b7693047743db1ea1d46be5d51d82d5 Mon Sep 17 00:00:00 2001 From: Rustam Ibragimov Date: Sat, 25 May 2019 18:51:23 +0300 Subject: [PATCH 2/5] actualized license years --- LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.txt b/LICENSE.txt index 15c2da9..eaa17da 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2017 Yuri Smirnov +Copyright (c) 2017-2019 Yuri Smirnov Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 1ef90196b51605d3a87c21ac15441dcf49034841 Mon Sep 17 00:00:00 2001 From: Rustam Ibragimov Date: Sat, 25 May 2019 18:57:13 +0300 Subject: [PATCH 3/5] reconfigured travis --- .rubocop.yml | 2 +- .travis.yml | 23 ++++++++--------------- polist.gemspec | 19 ++++++++++--------- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index a513808..143c8d9 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -3,7 +3,7 @@ inherit_gem: AllCops: DisplayCopNames: true - TargetRubyVersion: 2.5 + TargetRubyVersion: 2.6 Naming/MemoizedInstanceVariableName: Enabled: false diff --git a/.travis.yml b/.travis.yml index a1f398c..0036019 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,17 @@ language: ruby - sudo: false - -rvm: - - 2.3 - - 2.4 - - 2.5 - - ruby-head - before_install: gem install bundler - env: SUITE="rspec" - script: bundle exec $SUITE - matrix: fast_finish: true - # Only run RuboCop on the latest Ruby include: - - rvm: 2.5 - env: SUITE="rubocop" + - rvm: 2.3 + - rvm: 2.4 + - rvm: 2.5 + - rvm: 2.6 + - rvm: 2.6 # Only run RuboCop on the latest Ruby + env: SUITE="rubocop" + - rvm: ruby-head allow_failures: - - rvm: ruby-head + - rvm: ruby-head diff --git a/polist.gemspec b/polist.gemspec index bb420b2..7351a02 100644 --- a/polist.gemspec +++ b/polist.gemspec @@ -5,17 +5,17 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "polist/version" Gem::Specification.new do |spec| - spec.name = "polist" - spec.version = Polist::VERSION - spec.authors = ["Yuri Smirnov"] - spec.email = ["tycooon@yandex.ru", "oss@umbrellio.biz"] + spec.name = "polist" + spec.version = Polist::VERSION + spec.authors = ["Yuri Smirnov"] + spec.email = ["tycooon@yandex.ru", "oss@umbrellio.biz"] - spec.summary = "A gem for creating simple service classes and more." - spec.description = "Polist is a gem for creating simple service classes and more." - spec.homepage = "https://github.com/umbrellio/polist" - spec.license = "MIT" + spec.summary = "A gem for creating simple service classes and more." + spec.description = "Polist is a gem for creating simple service classes and more." + spec.homepage = "https://github.com/umbrellio/polist" + spec.license = "MIT" - spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) } + spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^spec/}) } spec.require_paths = ["lib"] spec.add_runtime_dependency "activemodel", ">= 3.0" @@ -23,6 +23,7 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "tainbox" spec.add_runtime_dependency "uber" + spec.add_development_dependency "rubocop-config-umbrellio" spec.add_development_dependency "bundler" spec.add_development_dependency "coveralls" spec.add_development_dependency "pry" From 787f5eff26c269f77dfbea14a6e80c0597816f96 Mon Sep 17 00:00:00 2001 From: Rustam Ibragimov Date: Sat, 25 May 2019 19:43:10 +0300 Subject: [PATCH 4/5] correct rake tasks --- Rakefile | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Rakefile b/Rakefile index b6ae734..6aa396a 100644 --- a/Rakefile +++ b/Rakefile @@ -1,8 +1,20 @@ # frozen_string_literal: true -require "bundler/gem_tasks" -require "rspec/core/rake_task" +require 'bundler/gem_tasks' +require 'rspec/core/rake_task' +require 'rubocop' +require 'rubocop-rspec' +require 'rubocop-performance' +require 'rubocop/rake_task' -RSpec::Core::RakeTask.new(:spec) +RuboCop::RakeTask.new(:rubocop) do |t| + config_path = File.expand_path(File.join('.rubocop.yml'), __dir__) -task default: :spec + t.options = ['--config', config_path] + t.requires << 'rubocop-rspec' + t.requires << 'rubocop-performance' +end + +RSpec::Core::RakeTask.new(:rspec) + +task default: :rspec From 4a42eac6c16bfa0e6219975dbed5488584587fe0 Mon Sep 17 00:00:00 2001 From: Rustam Ibragimov Date: Sat, 25 May 2019 19:51:00 +0300 Subject: [PATCH 5/5] code style updates --- Rakefile | 20 ++++++++++---------- bin/console | 8 ++++++++ lib/polist/service.rb | 4 ++-- polist.gemspec | 2 +- spec/polist/service_spec.rb | 4 ++-- 5 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 bin/console diff --git a/Rakefile b/Rakefile index 6aa396a..39ad954 100644 --- a/Rakefile +++ b/Rakefile @@ -1,18 +1,18 @@ # frozen_string_literal: true -require 'bundler/gem_tasks' -require 'rspec/core/rake_task' -require 'rubocop' -require 'rubocop-rspec' -require 'rubocop-performance' -require 'rubocop/rake_task' +require "bundler/gem_tasks" +require "rspec/core/rake_task" +require "rubocop" +require "rubocop-rspec" +require "rubocop-performance" +require "rubocop/rake_task" RuboCop::RakeTask.new(:rubocop) do |t| - config_path = File.expand_path(File.join('.rubocop.yml'), __dir__) + config_path = File.expand_path(File.join(".rubocop.yml"), __dir__) - t.options = ['--config', config_path] - t.requires << 'rubocop-rspec' - t.requires << 'rubocop-performance' + t.options = ["--config", config_path] + t.requires << "rubocop-rspec" + t.requires << "rubocop-performance" end RSpec::Core::RakeTask.new(:rspec) diff --git a/bin/console b/bin/console new file mode 100644 index 0000000..84d9112 --- /dev/null +++ b/bin/console @@ -0,0 +1,8 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +require 'bundler/setup' +require 'polist' + +require 'pry' +Pry.start diff --git a/lib/polist/service.rb b/lib/polist/service.rb index 977c98a..5c769dc 100644 --- a/lib/polist/service.rb +++ b/lib/polist/service.rb @@ -85,8 +85,8 @@ def call; end def run(&block) call(&block) - rescue self.class::Failure => error - @response = error.response + rescue self.class::Failure => e + @response = e.response @failure = true end diff --git a/polist.gemspec b/polist.gemspec index 7351a02..55cfe77 100644 --- a/polist.gemspec +++ b/polist.gemspec @@ -23,11 +23,11 @@ Gem::Specification.new do |spec| spec.add_runtime_dependency "tainbox" spec.add_runtime_dependency "uber" - spec.add_development_dependency "rubocop-config-umbrellio" spec.add_development_dependency "bundler" spec.add_development_dependency "coveralls" spec.add_development_dependency "pry" spec.add_development_dependency "rake" spec.add_development_dependency "rspec" + spec.add_development_dependency "rubocop-config-umbrellio" spec.add_development_dependency "simplecov" end diff --git a/spec/polist/service_spec.rb b/spec/polist/service_spec.rb index 2024ba8..46ee8b3 100644 --- a/spec/polist/service_spec.rb +++ b/spec/polist/service_spec.rb @@ -72,8 +72,8 @@ def call class ServiceWichRescueBlock < BasicService def call yield - rescue StandardError => error - success!(error) + rescue StandardError => e + success!(e) end end