module Hoe::RCov

RCov plugin for hoe.

Tasks Provided:

rcov

Analyze code coverage with tests

Public Instance Methods

activate_rcov_deps() click to toggle source

Activate the rcov dependencies.

# File lib/hoe/rcov.rb, line 13
def activate_rcov_deps
  dependency "rcov", "~> 0.9", :development
end
define_rcov_tasks() click to toggle source

Define tasks for plugin.

# File lib/hoe/rcov.rb, line 20
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