In Files

Hoe::RCov

RCov plugin for hoe.

Tasks Provided:

rcov

Analyze code coverage with tests

Public Instance Methods

define_rcov_tasks() click to toggle source

Define tasks for plugin.

    # File lib/hoe/rcov.rb, line 12
12:   def define_rcov_tasks
13:     begin # take a whack at defining rcov tasks
14:       require 'rcov/rcovtask'
15: 
16:       Rcov::RcovTask.new do |t|
17:         pattern = ENV['PATTERN'] || test_globs
18: 
19:         t.test_files = FileList[pattern]
20:         t.verbose = true
21:         t.rcov_opts << Hoe::RUBY_FLAGS
22:         t.rcov_opts << "--no-color"
23:         t.rcov_opts << "--save coverage.info"
24:         t.rcov_opts << "-x ^/"
25:       end
26: 
27:       # this is for my emacs rcov overlay stuff on emacswiki.
28:       task :rcov_overlay do
29:         path = ENV["FILE"]
30:         rcov, eol = Marshal.load(File.read("coverage.info")).last[path], 1
31:         puts rcov[:lines].zip(rcov[:coverage]).map { |line, coverage|
32:           bol, eol = eol, eol + line.length
33:           [bol, eol, "#ffcccc"] unless coverage
34:         }.compact.inspect
35:       end
36:     rescue LoadError
37:       # skip
38:       task :clobber_rcov # in case rcov didn't load
39:     end
40:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.