Sha256: 956a164e1a02994b59bca3c745ea53c679d7ca619ebe8aab7f4f3bca403e9d7e

Contents?: true

Size: 1.46 KB

Versions: 27

Compression:

Stored size: 1.46 KB

Contents

##
# RCov plugin for hoe.
#
# === Tasks Provided:
#
# rcov::               Analyze code coverage with tests

module Hoe::RCov

  ##
  # Activate the rcov dependencies.

  def activate_rcov_deps
    dependency "rcov", "~> 0.9", :development
  end

  ##
  # Define tasks for plugin.

  def define_rcov_tasks
    task :isolate # ensure it exists

    task :rcov => :isolate do
      sh(*make_rcov_cmd)
    end

    task :clobber_rcov do
      rm_rf "coverage"
    end

    task :clobber => :clobber_rcov

    # this is for my emacs rcov overlay stuff on emacswiki.
    task :rcov_overlay do
      path = ENV["FILE"]
      rcov, eol = Marshal.load(File.read("coverage.info")).last[path], 1
      puts rcov[:lines].zip(rcov[:coverage]).map { |line, coverage|
        bol, eol = eol, eol + line.length
        [bol, eol, "#ffcccc"] unless coverage
      }.compact.inspect
    end
  rescue LoadError
    # skip
    task :clobber_rcov # in case rcov didn't load
    # TODO: didn't load? this must be terribly historical
  end

  def make_rcov_cmd # :nodoc:
    rcov  = Gem.bin_wrapper "rcov"
    tests = test_globs.sort.map { |g| Dir.glob(g) }.flatten.map(&:inspect)

    cmd = %W[#{rcov}
             #{Hoe::RUBY_FLAGS}
             --text-report
             --no-color
             --save coverage.info
             -x ^/
             -x tmp/isolate
             --sort coverage
             --sort-reverse
             -o coverage
            ] + tests

    cmd
  end
end

task :clean => :clobber_rcov

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
hoe-3.25.0 lib/hoe/rcov.rb
hoe-3.24.0 lib/hoe/rcov.rb
hoe-3.23.1 lib/hoe/rcov.rb
hoe-3.23.0 lib/hoe/rcov.rb
hoe-3.22.3 lib/hoe/rcov.rb
hoe-3.22.2 lib/hoe/rcov.rb
hoe-3.22.1 lib/hoe/rcov.rb
hoe-3.22.0 lib/hoe/rcov.rb
hoe-3.21.0 lib/hoe/rcov.rb
hoe-3.20.0 lib/hoe/rcov.rb
hoe-3.19.0 lib/hoe/rcov.rb
hoe-3.18.1 lib/hoe/rcov.rb
hoe-3.18.0 lib/hoe/rcov.rb
hoe-3.17.2 lib/hoe/rcov.rb
hoe-3.17.1 lib/hoe/rcov.rb
hoe-3.17.0 lib/hoe/rcov.rb
hoe-3.16.2 lib/hoe/rcov.rb
hoe-3.16.1 lib/hoe/rcov.rb
hoe-3.16.0 lib/hoe/rcov.rb
hoe-3.15.3 lib/hoe/rcov.rb