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
-
#cov_branches ⇒ Object
Set to true to enable branch level coverage reporting.
-
#cov_filter ⇒ Object
Directories to filter out from coverage.
Instance Method Summary collapse
-
#activate_cov_deps ⇒ Object
Activate the cov dependencies.
-
#define_cov_tasks ⇒ Object
Define tasks for plugin.
-
#initialize_cov ⇒ Object
:nodoc:.
Instance Attribute Details
#cov_branches ⇒ Object
Set to true to enable branch level coverage reporting.
The default = false
22 23 24 |
# File 'lib/hoe/cov.rb', line 22 def cov_branches @cov_branches end |
#cov_filter ⇒ Object
Directories to filter out from coverage.
The default = tmp:test
15 16 17 |
# File 'lib/hoe/cov.rb', line 15 def cov_filter @cov_filter end |
Instance Method Details
#activate_cov_deps ⇒ Object
Activate the cov dependencies.
32 33 34 |
# File 'lib/hoe/cov.rb', line 32 def activate_cov_deps dependency "simplecov", "~> 0.21", :development end |
#define_cov_tasks ⇒ Object
Define tasks for plugin.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/hoe/cov.rb', line 39 def define_cov_tasks task :isolate # ensure it exists self.clean_globs << "coverage" desc "Run tests and analyze code coverage" task :cov => :isolate do extra = cov_branches && "; enable_coverage :branch" test_task.test_prelude = %(require "simplecov"; SimpleCov.start { add_filter %p%s }) % [cov_filter, extra] Rake::Task[:test].invoke end rescue LoadError warn "simplecov not found" end |
#initialize_cov ⇒ Object
:nodoc:
24 25 26 27 |
# File 'lib/hoe/cov.rb', line 24 def initialize_cov # :nodoc: self.cov_filter = %w[tmp test] self.cov_branches = nil end |