2018-01-14 18:55:16 -05:00
|
|
|
require File.expand_path("on_what", File.dirname(File.dirname(__FILE__)))
|
2014-06-15 13:24:15 -04:00
|
|
|
|
2015-06-24 16:18:43 -04:00
|
|
|
# Code coverage (via SimpleCov) on Ruby 1.9+
|
|
|
|
unless on_1_8?
|
|
|
|
begin
|
2018-01-14 18:55:16 -05:00
|
|
|
require "simplecov"
|
2015-06-24 16:18:43 -04:00
|
|
|
SimpleCov.start do
|
2018-01-14 18:55:16 -05:00
|
|
|
add_filter "/spec/" # exclude test code
|
|
|
|
add_filter "/vendor/" # exclude gems which are vendored on Travis CI
|
|
|
|
add_filter "/on_what.rb" # exclude help used only in gemspec
|
2015-06-24 16:18:43 -04:00
|
|
|
end
|
2011-12-06 14:46:46 -05:00
|
|
|
|
2015-06-24 16:18:43 -04:00
|
|
|
# On CI we publish simplecov results to codecov.io
|
|
|
|
if on_travis?
|
2018-01-14 18:55:16 -05:00
|
|
|
require "codecov"
|
2015-06-24 16:18:43 -04:00
|
|
|
SimpleCov.formatter = SimpleCov::Formatter::Codecov
|
|
|
|
end
|
2015-06-24 16:00:41 -04:00
|
|
|
|
2015-06-24 16:18:43 -04:00
|
|
|
# Due to circular dependency (simplecov depends on docile), remove docile and require again below
|
|
|
|
Object.send(:remove_const, :Docile)
|
|
|
|
$LOADED_FEATURES.reject! { |f| f =~ /\/docile\// }
|
|
|
|
rescue LoadError
|
2018-01-14 18:55:16 -05:00
|
|
|
warn "warning: simplecov or codecov gems not found; skipping coverage"
|
2015-06-24 16:18:43 -04:00
|
|
|
end
|
2014-02-21 15:10:13 -05:00
|
|
|
end
|
2011-12-06 14:46:46 -05:00
|
|
|
|
2018-01-14 18:55:16 -05:00
|
|
|
lib_dir = File.join(File.dirname(File.dirname(__FILE__)), "lib")
|
2014-02-21 15:10:13 -05:00
|
|
|
$LOAD_PATH.unshift lib_dir unless $LOAD_PATH.include? lib_dir
|
2011-12-06 14:46:46 -05:00
|
|
|
|
2014-02-21 15:10:13 -05:00
|
|
|
# Require Docile again, now with coverage enabled on 1.9+
|
2018-01-14 18:55:16 -05:00
|
|
|
require "docile"
|