Module: Hoe::Cov

Defined in:
lib/hoe/cov.rb

Overview

Coverage plugin for hoe. Uses simplecov.

Tasks Provided:

cov

Analyze code coverage with tests using simplecov.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#cov_filterObject

Directories to filter out from coverage.



13
14
15
# File 'lib/hoe/cov.rb', line 13

def cov_filter
  @cov_filter
end

Instance Method Details

#activate_cov_depsObject

Activate the cov dependencies.



22
23
24
# File 'lib/hoe/cov.rb', line 22

def activate_cov_deps
  dependency "simplecov", "~> 0.21", :development
end

#define_cov_tasksObject

Define tasks for plugin.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/hoe/cov.rb', line 29

def define_cov_tasks
  task :isolate # ensure it exists

  self.clean_globs << "coverage"

  desc "Run tests and analyze code coverage"
  task :cov => :isolate do
    test_task.test_prelude =
      %(require "simplecov"; SimpleCov.start { add_filter %p }) % [cov_filter]

    Rake::Task[:test].invoke
  end
rescue LoadError
  warn "simplecov not found"
end

#initialize_covObject

:nodoc:



15
16
17
# File 'lib/hoe/cov.rb', line 15

def initialize_cov # :nodoc:
  self.cov_filter = %w[tmp test]
end