Skip to content

Commit

Permalink
travis: Update CodeClimate config
Browse files Browse the repository at this point in the history
  • Loading branch information
glebm committed Dec 26, 2016
1 parent 678f301 commit 2bc819e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 28 deletions.
15 changes: 5 additions & 10 deletions .simplecov
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
unless !ENV['COVERAGE'] || defined?(RUBY_ENGINE) && %w(rbx jruby).include?(RUBY_ENGINE)
if ENV['TRAVIS']
require 'codeclimate_batch'
require 'codeclimate-test-reporter'
CodeClimate::TestReporter.configuration.git_dir = File.dirname(__FILE__)
CodeclimateBatch.start
else
SimpleCov.start do
formatter SimpleCov::Formatter::HTMLFormatter
end
# frozen_string_literal: true
unless defined?(RUBY_ENGINE) && %w(rbx jruby).include?(RUBY_ENGINE)
SimpleCov.start do
add_filter '/spec/'
formatter SimpleCov::Formatter::HTMLFormatter unless ENV['TRAVIS']
end
end
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ matrix:
- rvm: rbx
cache: bundler
bundler_args: --without debug
script: bundle exec rspec
script:
- bundle exec rspec --format d
- bundle exec rubocop
- bundle exec codeclimate-test-reporter
env:
global:
- TRAVIS=1 COVERAGE=1
- TRAVIS=1 CI=1 COVERAGE=1
# google translate api key:
- secure: "LSP0PfgTfRfyjm3iV770tgqF+G1G4lD+s7LSFE7QwsX+HoZPm8SwHW9S0sOThub+qAkOkfPvApvHwL8nBBFPPM+ZZcgBUViLfErUSOKHFLQt6/pMQvpRg+47hSUszedGnxHck6z9q71a/4GrxHcuY+VslCpT+PhCTt0rsAf3bvY="
# codeclimate repo token:
Expand Down
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ unless ENV['TRAVIS']
end
end

group :test do
gem 'codeclimate-test-reporter', require: nil
gem 'codeclimate_batch', require: nil
if ENV['CI']
group :test do
# CodeClimate coverage reporting.
gem 'codeclimate-test-reporter', require: false
end
end
12 changes: 2 additions & 10 deletions spec/bin_simplecov_helper.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
# frozen_string_literal: true
unless !ENV['COVERAGE'] || defined?(RUBY_ENGINE) && %w(rbx jruby).include?(RUBY_ENGINE)
if ENV['COVERAGE'] && !%w(rbx jruby).include?(RUBY_ENGINE)
ENV['SIMPLECOV_NO_DEFAULTS'] = '1'
require 'simplecov'
SimpleCov.command_name "bin/i18n-tasks #{ARGV.join ' '}".strip
SimpleCov.command_name "#{$PROGRAM_NAME} #{ARGV.join ' '}".strip
SimpleCov.root File.expand_path(File.join(File.dirname(__FILE__), '..'))
require 'simplecov/defaults'
SimpleCov::Formatter::HTMLFormatter.send(:define_method, :puts) { |*| }
if defined?(CodeClimate)
class NullLoger < Logger
def initialize(*args); end

def add(*args, &block); end
end
CodeClimate::TestReporter.configuration.logger = NullLoger.new
end
end
5 changes: 2 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# frozen_string_literal: true
ENV['RAILS_ENV'] = ENV['RAKE_ENV'] = 'test'

unless defined?(RUBY_ENGINE) && %w(rbx jruby).include?(RUBY_ENGINE)
if ENV['COVERAGE'] && !%w(rbx jruby).include?(RUBY_ENGINE)
require 'simplecov'
SimpleCov.command_name 'RSpec'
end

$LOAD_PATH << File.expand_path('../lib', __FILE__)
Expand Down

0 comments on commit 2bc819e

Please sign in to comment.