Module: EasyCov::Filters
- Included in:
- EasyCov
- Defined in:
- lib/easycov/filters.rb
Constant Summary collapse
- IGNORE_TESTS =
Ignore files in <root>/test/
lambda { |filename| filename =~ %r{^#{EasyCov.root}/test/} }
- IGNORE_OUTSIDE_ROOT =
Ignore all filfes outside EasyCov.root (pwd by default)
lambda { |filename| filename !~ /^#{EasyCov.root}/ }
- IGNORE_STDLIB =
Ignore all ruby STDLIB files
lambda { |filename| EasyCov::Filters.stdlib_paths.each do |path| if filename =~ /^#{path}/ then return true end end false }
- IGNORE_GEMS =
Ignore all gems (uses GEM_PATH if set, else /gems/ in filename)
lambda { |filename| if ENV["GEM_PATH"] && !ENV["GEM_PATH"].empty? then # use GEM_PATH if avail ENV["GEM_PATH"].split(':').each do |path| if filename =~ /^#{path}/ then return true end end false else # simple regex filename =~ %r{/gems/} end }
Class Method Summary collapse
-
.stdlib_paths ⇒ Object
Get the list of STDLIB load paths.
Class Method Details
.stdlib_paths ⇒ Object
Get the list of STDLIB load paths
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/easycov/filters.rb', line 7 def stdlib_paths return @stdlib_paths if !@stdlib_paths.nil? # see if we have a cached answer if ENV["EASYCOV_STDLIB_PATHS"] then @stdlib_paths = ENV["EASYCOV_STDLIB_PATHS"].split(/:/) return @stdlib_paths end # load opt, lib = ENV.delete("RUBYOPT"), ENV.delete("RUBYLIB") @stdlib_paths = `ruby -e 'puts $:'`.strip.split(/\n/) ENV["RUBYOPT"] = opt ENV["RUBYLIB"] = lib ENV["EASYCOV_STDLIB_PATHS"] = @stdlib_paths.join(":") return @stdlib_paths end |