Sha256: 350edc2d132075d25ae29884f993afb8f0b86fdac7411ed55df4c14a3df3c80a

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

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

module Hoe::RCov
  ##
  # Define tasks for plugin.

  def define_rcov_tasks
    begin # take a whack at defining rcov tasks
      require 'rcov/rcovtask'

      Rcov::RcovTask.new do |t|
        pattern = ENV['PATTERN'] || test_globs

        t.test_files = FileList[pattern]
        t.verbose = true
        t.libs = %w[lib test .]
        t.rcov_opts << Hoe::RUBY_FLAGS
        t.rcov_opts << "--no-color"
        t.rcov_opts << "--save coverage.info"
        t.rcov_opts << "-x ^/"
      end

      # 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
    end
  end
end

task :clean => :clobber_rcov

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hoe-2.12.5 lib/hoe/rcov.rb
hoe-2.12.4 lib/hoe/rcov.rb
hoe-2.12.3 lib/hoe/rcov.rb
hoe-2.12.2 lib/hoe/rcov.rb
hoe-2.12.1 lib/hoe/rcov.rb
hoe-2.12.0 lib/hoe/rcov.rb
hoe-2.11.0 lib/hoe/rcov.rb