Sha256: 74ba7efbef138b3345f04717dff4c6b302539cd92965cba4f96d294e068de214

Contents?: true

Size: 1.79 KB

Versions: 7

Compression:

Stored size: 1.79 KB

Contents

def card_simplecov_filters
  add_filter 'spec/'
  add_filter '/config/'
  add_filter '/tasks/'

  # filter all card mods
  add_filter do |src_file|
    src_file.filename =~ /tmp\// && !/\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/**/#{m[1]}"].present? }
  end

  # add group for each deck mod
  Dir['mod/*'].map { |path| path.sub('mod/', '') }.each do |mod|
    add_group mod.capitalize do |src_file|
      src_file.filename =~ /mod\/#{mod}\// ||
        (
          src_file.filename =~ /tmp\// &&
          /\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/#{mod}/**/#{m[1]}"].present? }
        )
    end
  end

  add_group 'Sets' do |src_file|
    src_file.filename =~ /tmp\/set\// &&
      /\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/**/#{m[1]}"].present? }
  end
  add_group 'Set patterns' do |src_file|
    src_file.filename =~ /tmp\/set_pattern\// &&
      /\d+-(.+\.rb)/.match(src_file.filename) { |m| Dir["mod/**/#{m[1]}"].present? }
  end
  add_group 'Formats' do |src_file|
    src_file.filename =~ /mod\/[^\/]+\/formats/
  end
  add_group 'Chunks' do |src_file|
    src_file.filename =~ /mod\/[^\/]+\/chunks/
  end
end

def card_core_dev_simplecov_filters
  filters.clear # This will remove the :root_filter that comes via simplecov's defaults
  add_filter do |src|
    !(src.filename =~ /^#{SimpleCov.root}/) unless src.filename =~ /wagn/
  end

  add_filter '/spec/'
  add_filter '/features/'
  add_filter '/config/'
  add_filter '/tasks/'
  add_filter '/generators/'
  add_filter 'lib/card'

  add_group 'Card', 'lib/card'
  add_group 'Set Patterns', 'tmp/set_pattern/'
  add_group 'Sets',         'tmp/set/'
  add_group 'Formats' do |src_file|
    src_file.filename =~ /mod\/[^\/]+\/format/
  end
  add_group 'Chunks' do |src_file|
    src_file.filename =~ /mod\/[^\/]+\/chunk/
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wagn-1.18.6 lib/wagn/simplecov_helper.rb
wagn-1.18.5 lib/wagn/simplecov_helper.rb
wagn-1.18.4 lib/wagn/simplecov_helper.rb
wagn-1.18.3 lib/wagn/simplecov_helper.rb
wagn-1.18.2 lib/wagn/simplecov_helper.rb
wagn-1.18.1 lib/wagn/simplecov_helper.rb
wagn-1.18.0 lib/wagn/simplecov_helper.rb