coverband 0.0.18 → 0.0.19

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,7 +6,7 @@ A gem to measure production code coverage. Coverband allows easy configuration t
6
6
  * Ignore directories to avoid overhead data collection on vendor, lib, etc.
7
7
  * Take a baseline to get inital app loading coverage.
8
8
 
9
- At the momement, Coverband relies on Ruby's `set_trace_func` hook. I attempted to use the standard lib's `Coverage` support but it proved buggy when stampling or stoping and starting collection. When [Coverage is patched](https://www.ruby-forum.com/topic/1811306) in future Ruby versions it would likely be better. Using `set_trace_func` has some limitations where it doesn't collect covered lines, but I have been impressed with the coverage it shows for both Sinatra and Rails applications.
9
+ At the moment, Coverband relies on Ruby's `set_trace_func` hook. I attempted to use the standard lib's `Coverage` support but it proved buggy when sampling or stoping and starting collection. When [Coverage is patched](https://www.ruby-forum.com/topic/1811306) in future Ruby versions it would likely be better. Using `set_trace_func` has some limitations where it doesn't collect covered lines, but I have been impressed with the coverage it shows for both Sinatra and Rails applications.
10
10
 
11
11
  ###### Success:
12
12
  After running in production for 30 minutes, we were able very easily delete 2000 LOC after looking through the data. We expect to be able to clean up much more after it has collected more data.
data/lib/coverband.rb CHANGED
@@ -2,37 +2,25 @@ require 'redis'
2
2
  require 'logger'
3
3
 
4
4
  require 'coverband/version'
5
+ require 'coverband/configuration'
5
6
  require 'coverband/redis_store'
6
7
  require 'coverband/base'
7
8
  require 'coverband/reporter'
8
9
  require 'coverband/middleware'
9
10
 
10
11
  module Coverband
11
-
12
+
12
13
  class << self
13
14
  attr_accessor :configuration
14
15
  end
15
16
 
16
- def self.configure
17
+ def self.configure(file = nil)
17
18
  self.configuration ||= Configuration.new
18
- yield(configuration)
19
- end
20
-
21
- class Configuration
22
- attr_accessor :redis, :coverage_baseline, :root_paths, :root, :ignore, :percentage, :verbose, :reporter, :stats, :logger, :startup_delay
23
-
24
- def initialize
25
- @root = Dir.pwd
26
- @redis = nil
27
- @stats = nil
28
- @coverage_baseline = {}
29
- @root_paths = []
30
- @ignore = []
31
- @percentage = 0.0
32
- @verbose = false
33
- @reporter = 'scov'
34
- @logger = nil
35
- @startup_delay = 0
19
+ if block_given?
20
+ yield(configuration)
21
+ else
22
+ file ||= './config/coverband.rb'
23
+ require file
36
24
  end
37
25
  end
38
26
 
@@ -0,0 +1,19 @@
1
+ module Coverband
2
+ class Configuration
3
+ attr_accessor :redis, :coverage_baseline, :root_paths, :root, :ignore, :percentage, :verbose, :reporter, :stats, :logger, :startup_delay
4
+
5
+ def initialize
6
+ @root = Dir.pwd
7
+ @redis = nil
8
+ @stats = nil
9
+ @coverage_baseline = {}
10
+ @root_paths = []
11
+ @ignore = []
12
+ @percentage = 0.0
13
+ @verbose = false
14
+ @reporter = 'scov'
15
+ @logger = nil
16
+ @startup_delay = 0
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,20 @@
1
+ namespace :coverband do
2
+
3
+ desc "record coverband coverage baseline"
4
+ task :baseline do
5
+ Coverband::Reporter.baseline {
6
+ require File.expand_path("../config/environment", __FILE__)
7
+ }
8
+ end
9
+
10
+ desc "report runtime coverband code coverage"
11
+ task :coverage => :environment do
12
+ Coverband::Reporter.report
13
+ end
14
+
15
+ desc "reset coverband coverage data"
16
+ task :clear => :environment do
17
+ Coverband::Reporter.clear_coverage
18
+ end
19
+
20
+ end
@@ -1,3 +1,3 @@
1
1
  module Coverband
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coverband
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-12 00:00:00.000000000 Z
12
+ date: 2014-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -157,9 +157,11 @@ files:
157
157
  - docs/coverband_index.png
158
158
  - lib/coverband.rb
159
159
  - lib/coverband/base.rb
160
+ - lib/coverband/configuration.rb
160
161
  - lib/coverband/middleware.rb
161
162
  - lib/coverband/redis_store.rb
162
163
  - lib/coverband/reporter.rb
164
+ - lib/coverband/tasks.rb
163
165
  - lib/coverband/version.rb
164
166
  - test/fake_app/basic_rack.rb
165
167
  - test/test_helper.rb
@@ -182,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
184
  version: '0'
183
185
  segments:
184
186
  - 0
185
- hash: -2542793412293765317
187
+ hash: 4134366731001694755
186
188
  required_rubygems_version: !ruby/object:Gem::Requirement
187
189
  none: false
188
190
  requirements:
@@ -191,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
193
  version: '0'
192
194
  segments:
193
195
  - 0
194
- hash: -2542793412293765317
196
+ hash: 4134366731001694755
195
197
  requirements: []
196
198
  rubyforge_project:
197
199
  rubygems_version: 1.8.23