Sha256: aa585feebca0abc98aa3ee16c362b6dead0db34cf4adf1c4e9c23d0223631cd1

Contents?: true

Size: 1.79 KB

Versions: 5

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

5 entries across 5 versions & 1 rubygems

Version Path
wagn-1.19.4 lib/wagn/simplecov_helper.rb
wagn-1.19.3 lib/wagn/simplecov_helper.rb
wagn-1.19.2 lib/wagn/simplecov_helper.rb
wagn-1.19.1 lib/wagn/simplecov_helper.rb
wagn-1.19.0 lib/wagn/simplecov_helper.rb