From 72e8acf12429ad6ab34bf65f6e5b7cf1d38971c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=BC=E6=99=82=E5=BC=A6=E4=B9=9F?= Date: Fri, 12 May 2017 10:56:23 +0800 Subject: [PATCH] Setup codeclimate and coveralls --- .gitignore | 2 ++ .travis.yml | 8 +++++--- Appraisals | 4 ++-- Gemfile.lock | 21 +++++++++++++++++++++ gemfiles/rails_4.gemfile | 2 +- gemfiles/rails_4.gemfile.lock | 20 +++++++++++++++++++- gemfiles/rails_5.gemfile | 2 +- gemfiles/rails_5.gemfile.lock | 20 +++++++++++++++++++- rails-letsencrypt.gemspec | 3 +++ spec/spec_helper.rb | 30 ++++++++++++++++++++++++++---- 10 files changed, 99 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 71f82cb..14acdd0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ test/dummy/db/*.sqlite3 test/dummy/db/*.sqlite3-journal test/dummy/log/*.log test/dummy/tmp/ + +coverage/ diff --git a/.travis.yml b/.travis.yml index c11a052..3e962e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,8 @@ gemfile: - gemfiles/rails_4.gemfile - gemfiles/rails_5.gemfile before_install: - - "rm -f Gemfile.lock" -install: "bundle install --jobs=3 --retry=3" -script: "bundle exec rspec" + - rm -f Gemfile.lock +install: bundle install --jobs=3 --retry=3 +script: + - bundle exec rspec + - bundle exec codeclimate-test-reporter diff --git a/Appraisals b/Appraisals index 93a83da..5a2a6a4 100644 --- a/Appraisals +++ b/Appraisals @@ -1,9 +1,9 @@ # frozen_string_literal: true appraise 'rails-4' do - gem 'rails', '4.2.8' + gem 'rails', '~> 4.2' end appraise 'rails-5' do - gem 'rails', '5.1.0' + gem 'rails', '~> 5.1' end diff --git a/Gemfile.lock b/Gemfile.lock index 68eaa3e..619323a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,14 +54,24 @@ GEM thor (>= 0.14.0) arel (8.0.0) builder (3.2.3) + codeclimate-test-reporter (1.0.7) + simplecov concurrent-ruby (1.0.5) + coveralls (0.8.21) + json (>= 1.8, < 3) + simplecov (~> 0.14.1) + term-ansicolor (~> 1.3) + thor (~> 0.19.4) + tins (~> 1.6) diff-lcs (1.3) + docile (1.1.5) erubi (1.6.0) faraday (0.12.1) multipart-post (>= 1.2, < 3) globalid (0.4.0) activesupport (>= 4.2.0) i18n (0.8.1) + json (2.1.0) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.5) @@ -121,6 +131,11 @@ GEM rspec-mocks (~> 3.6.0) rspec-support (~> 3.6.0) rspec-support (3.6.0) + simplecov (0.14.1) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.0) sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -128,8 +143,11 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) + term-ansicolor (1.6.0) + tins (~> 1.0) thor (0.19.4) thread_safe (0.3.6) + tins (1.13.2) tzinfo (1.2.3) thread_safe (~> 0.1) websocket-driver (0.6.5) @@ -141,8 +159,11 @@ PLATFORMS DEPENDENCIES appraisal + codeclimate-test-reporter + coveralls rails-letsencrypt! rspec-rails + simplecov BUNDLED WITH 1.14.6 diff --git a/gemfiles/rails_4.gemfile b/gemfiles/rails_4.gemfile index 8235ec9..b74b2d5 100644 --- a/gemfiles/rails_4.gemfile +++ b/gemfiles/rails_4.gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" -gem "rails", "4.2.8" +gem "rails", "~> 4.2" gemspec path: "../" diff --git a/gemfiles/rails_4.gemfile.lock b/gemfiles/rails_4.gemfile.lock index 254ad84..8d73fd6 100644 --- a/gemfiles/rails_4.gemfile.lock +++ b/gemfiles/rails_4.gemfile.lock @@ -52,13 +52,21 @@ GEM arel (6.0.4) builder (3.2.3) concurrent-ruby (1.0.5) + coveralls (0.8.21) + json (>= 1.8, < 3) + simplecov (~> 0.14.1) + term-ansicolor (~> 1.3) + thor (~> 0.19.4) + tins (~> 1.6) diff-lcs (1.3) + docile (1.1.5) erubis (2.7.0) faraday (0.12.1) multipart-post (>= 1.2, < 3) globalid (0.4.0) activesupport (>= 4.2.0) i18n (0.8.1) + json (2.1.0) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.5) @@ -117,6 +125,11 @@ GEM rspec-mocks (~> 3.6.0) rspec-support (~> 3.6.0) rspec-support (3.6.0) + simplecov (0.14.1) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.0) sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -124,8 +137,11 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) + term-ansicolor (1.6.0) + tins (~> 1.0) thor (0.19.4) thread_safe (0.3.6) + tins (1.13.2) tzinfo (1.2.3) thread_safe (~> 0.1) @@ -134,9 +150,11 @@ PLATFORMS DEPENDENCIES appraisal - rails (= 4.2.8) + coveralls + rails (~> 4.2) rails-letsencrypt! rspec-rails + simplecov BUNDLED WITH 1.14.6 diff --git a/gemfiles/rails_5.gemfile b/gemfiles/rails_5.gemfile index 715eca4..8c6c833 100644 --- a/gemfiles/rails_5.gemfile +++ b/gemfiles/rails_5.gemfile @@ -2,6 +2,6 @@ source "https://rubygems.org" -gem "rails", "5.1.0" +gem "rails", "~> 5.1" gemspec path: "../" diff --git a/gemfiles/rails_5.gemfile.lock b/gemfiles/rails_5.gemfile.lock index 0df60b0..3d0de01 100644 --- a/gemfiles/rails_5.gemfile.lock +++ b/gemfiles/rails_5.gemfile.lock @@ -55,13 +55,21 @@ GEM arel (8.0.0) builder (3.2.3) concurrent-ruby (1.0.5) + coveralls (0.8.21) + json (>= 1.8, < 3) + simplecov (~> 0.14.1) + term-ansicolor (~> 1.3) + thor (~> 0.19.4) + tins (~> 1.6) diff-lcs (1.3) + docile (1.1.5) erubi (1.6.0) faraday (0.12.1) multipart-post (>= 1.2, < 3) globalid (0.4.0) activesupport (>= 4.2.0) i18n (0.8.1) + json (2.1.0) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.5) @@ -121,6 +129,11 @@ GEM rspec-mocks (~> 3.6.0) rspec-support (~> 3.6.0) rspec-support (3.6.0) + simplecov (0.14.1) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.0) sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -128,8 +141,11 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) + term-ansicolor (1.6.0) + tins (~> 1.0) thor (0.19.4) thread_safe (0.3.6) + tins (1.13.2) tzinfo (1.2.3) thread_safe (~> 0.1) websocket-driver (0.6.5) @@ -141,9 +157,11 @@ PLATFORMS DEPENDENCIES appraisal - rails (= 5.1.0) + coveralls + rails (~> 5.1) rails-letsencrypt! rspec-rails + simplecov BUNDLED WITH 1.14.6 diff --git a/rails-letsencrypt.gemspec b/rails-letsencrypt.gemspec index 84218bf..cd61294 100644 --- a/rails-letsencrypt.gemspec +++ b/rails-letsencrypt.gemspec @@ -23,4 +23,7 @@ Gem::Specification.new do |s| s.add_development_dependency "appraisal" s.add_development_dependency "rspec-rails" + s.add_development_dependency "simplecov" + s.add_development_dependency "coveralls" + s.add_development_dependency "codeclimate-test-reporter" end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ce33d66..8b2b940 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,6 +13,28 @@ # it. # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration + +require 'simplecov' +require 'coveralls' +require 'codeclimate-test-reporter' + +SimpleCov.start do + formatter SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter + ] + + load_profile 'test_frameworks' + + add_group 'Let\'s Encrypt', 'lib/letsencrypt' + add_group 'Generators', 'lib/generators/lets_encrypt' + add_group 'Controllers', 'app/controllers' + add_group 'Models', 'app/models' + add_group 'Jobs', 'app/jobs' + + track_files '{app,lib}/**/*.rb' +end + RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate # assertion/expectation library such as wrong or the stdlib/minitest @@ -22,9 +44,9 @@ # and `failure_message` of custom matchers include text for helper methods # defined using `chain`, e.g.: # be_bigger_than(2).and_smaller_than(4).description - # # => "be bigger than 2 and smaller than 4" + # # => 'be bigger than 2 and smaller than 4' # ...rather than: - # # => "be bigger than 2" + # # => 'be bigger than 2' expectations.include_chain_clauses_in_custom_matcher_descriptions = true end @@ -57,7 +79,7 @@ # Allows RSpec to persist some state between runs in order to support # the `--only-failures` and `--next-failure` CLI options. We recommend # you configure your source control system to ignore this file. - config.example_status_persistence_file_path = "spec/examples.txt" + config.example_status_persistence_file_path = 'spec/examples.txt' # Limits the available syntax to the non-monkey patched syntax that is # recommended. For more details, see: @@ -73,7 +95,7 @@ # Use the documentation formatter for detailed output, # unless a formatter has already been configured # (e.g. via a command-line flag). - config.default_formatter = "doc" + config.default_formatter = 'doc' end # Print the 10 slowest examples and example groups at the