cover_me 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,13 @@ module CoverMe
23
23
  Configatron::Delayed.new{defined?(Rails) ? Rails.root.to_s : Dir.pwd})
24
24
  c.results.set_default(:store, Configatron::Delayed.new {File.join(CoverMe.config.project.root, 'coverage.data')})
25
25
  c.set_default(:file_pattern, Configatron::Delayed.new do
26
- /(#{CoverMe.config.project.root}\/app\/.+\.rb|#{CoverMe.config.project.root}\/lib\/.+\.rb)/i
26
+ [
27
+ /(#{CoverMe.config.project.root}\/app\/.+\.rb)/i,
28
+ /(#{CoverMe.config.project.root}\/lib\/.+\.rb)/i
29
+ ]
30
+ end)
31
+ c.set_default(:exclude_file_patterns, Configatron::Delayed.new do
32
+ []
27
33
  end)
28
34
 
29
35
  c.proximity.set_default(:near, 90)
@@ -7,9 +7,12 @@ class CoverMe::Processor
7
7
 
8
8
  def initialize(coverage_results, options = {}) # :nodoc:
9
9
  self.coverage_results = coverage_results
10
- self.options = ({:pattern => CoverMe.config.file_pattern,
10
+ self.options = ({:patterns => CoverMe.config.file_pattern,
11
+ :exclude_patterns => CoverMe.config.exclude_file_patterns,
11
12
  :formatter => CoverMe.config.formatter.new}.merge(options)).to_mash
12
13
  self.index = CoverMe::Index.new
14
+ self.options[:patterns] = [self.options[:patterns]].flatten
15
+ self.options[:exclude_patterns] = [self.options[:exclude_patterns]].flatten
13
16
  end
14
17
 
15
18
  # Processes the coverage results and then formats them.
@@ -18,11 +21,23 @@ class CoverMe::Processor
18
21
  # details.
19
22
  def process!
20
23
  self.coverage_results.map do |filename, coverage|
21
- if filename.match(self.options[:pattern])
22
- report = CoverMe::Report.new(filename, coverage)
23
- if report.exists?
24
- self.index.reports << report
25
- self.options[:formatter].format(report)
24
+ # next unless filename.match(/#{CoverMe.config.project.root}/)
25
+ exclude = false
26
+ self.options[:exclude_patterns].each do |pattern|
27
+ if filename.match(pattern)
28
+ exclude = true
29
+ break
30
+ end
31
+ end
32
+ next if exclude
33
+ self.options[:patterns].each do |pattern|
34
+ if filename.match(pattern)
35
+ report = CoverMe::Report.new(filename, coverage)
36
+ if report.exists?
37
+ self.index.reports << report
38
+ self.options[:formatter].format(report)
39
+ end
40
+ break
26
41
  end
27
42
  end
28
43
  end
@@ -113,18 +113,10 @@
113
113
  <td>
114
114
  <a href="<%= report.filename + '.html' %>"><%= report.filename %></a>
115
115
  </td>
116
- <td>
117
- <%= report.lines %>
118
- </td>
119
- <td>
120
- <%= report.lines_of_code %>
121
- </td>
122
- <td>
123
- <%= report.lines_of_code - report.lines_executed %>
124
- </td>
125
- <td>
126
- <%= report.executed_percent %>%
127
- </td>
116
+ <td><%= report.lines %></td>
117
+ <td><%= report.lines_of_code %></td>
118
+ <td><%= report.lines_of_code - report.lines_executed %></td>
119
+ <td><%= report.executed_percent %>%</td>
128
120
  </tr>
129
121
  <% end %>
130
122
  </tbody>
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cover_me
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.0
5
+ version: 1.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - markbates
@@ -10,7 +10,8 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-26 00:00:00 Z
13
+ date: 2011-06-29 00:00:00 -04:00
14
+ default_executable:
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: configatron
@@ -65,6 +66,7 @@ files:
65
66
  - lib/generators/cover_me/install/install_generator.rb
66
67
  - lib/generators/cover_me/install/templates/cover_me.rake
67
68
  - LICENSE
69
+ has_rdoc: true
68
70
  homepage: http://www.metabates.com
69
71
  licenses: []
70
72
 
@@ -104,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
106
  requirements: []
105
107
 
106
108
  rubyforge_project: magrathea
107
- rubygems_version: 1.8.2
109
+ rubygems_version: 1.6.2
108
110
  signing_key:
109
111
  specification_version: 3
110
112
  summary: CoverMe - Code Coverage for Ruby 1.9