coverband 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/coverband.gemspec +1 -1
- data/lib/coverband/base.rb +1 -1
- data/lib/coverband/baseline.rb +9 -0
- data/lib/coverband/tasks.rb +4 -3
- data/lib/coverband/version.rb +1 -1
- data/test/unit/baseline_test.rb +15 -1
- data/test/unit/configuration_test.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae65d228389db7462d1ddc08e950d5964e8a34f4
|
4
|
+
data.tar.gz: 8bd404ca135c010026e965953c717ca8539f1dc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c29477a4e66d9521b42d58db8469bb75e891d834ab59d08ca784acde9396f65de384b6e27d822fa28bc0641a40a88776b1411191baa8fb9d115f6ca442cb3c9b
|
7
|
+
data.tar.gz: a2195997791f11c2c69433210b106631a62785bf7d9bcc68c05ce31a4bbc06ac2b67716458c3a0b36f610b39cde69c9498289fbcf724357102615426eb06c82f
|
data/coverband.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_development_dependency 'sinatra'
|
28
28
|
spec.add_development_dependency 'classifier-reborn'
|
29
29
|
spec.add_development_dependency 'aws-sdk', '~> 2'
|
30
|
-
spec.add_runtime_dependency "simplecov", '~> 0.11'
|
30
|
+
spec.add_runtime_dependency "simplecov", '~> 0.11'
|
31
31
|
spec.add_runtime_dependency "json"
|
32
32
|
# TODO make redis optional dependancy as we add additional adapters
|
33
33
|
spec.add_runtime_dependency "redis"
|
data/lib/coverband/base.rb
CHANGED
@@ -44,7 +44,7 @@ module Coverband
|
|
44
44
|
@file_line_usage = {}
|
45
45
|
@ignored_files = Set.new
|
46
46
|
@startup_delay = Coverband.configuration.startup_delay
|
47
|
-
@ignore_patterns = Coverband.configuration.ignore + [
|
47
|
+
@ignore_patterns = Coverband.configuration.ignore + ['internal:prelude', 'schema.rb']
|
48
48
|
@ignore_patterns += ['gems'] unless Coverband.configuration.include_gems
|
49
49
|
@sample_percentage = Coverband.configuration.percentage
|
50
50
|
@store = Coverband.configuration.store
|
data/lib/coverband/baseline.rb
CHANGED
@@ -17,6 +17,15 @@ module Coverband
|
|
17
17
|
Coverband.configuration.store.coverage
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.exclude_files(files)
|
21
|
+
Coverband.configuration.ignore.each do |ignore|
|
22
|
+
path = Coverband.configuration.root + "/#{ignore}"
|
23
|
+
excludes = File.directory?(path) ? Dir.glob("#{path}/**/*") : [path]
|
24
|
+
files -= excludes
|
25
|
+
end
|
26
|
+
files
|
27
|
+
end
|
28
|
+
|
20
29
|
private
|
21
30
|
|
22
31
|
def self.convert_coverage_format(results)
|
data/lib/coverband/tasks.rb
CHANGED
@@ -21,14 +21,16 @@ namespace :coverband do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
if defined? Rails
|
24
|
-
Dir.glob("#{Rails.root}/app/**/*.rb")
|
24
|
+
files = Coverband::Baseline.exclude_files(Dir.glob("#{Rails.root}/app/**/*.rb"))
|
25
|
+
files.sort.each { |file|
|
25
26
|
begin
|
26
27
|
require_dependency file
|
27
28
|
rescue Exception
|
28
29
|
#ignore
|
29
30
|
end }
|
30
31
|
if File.exists?("#{Rails.root}/lib")
|
31
|
-
Dir.glob("#{Rails.root}/lib/**/*.rb")
|
32
|
+
files = Coverband::Baseline.exclude_files(Dir.glob("#{Rails.root}/lib/**/*.rb"))
|
33
|
+
files.sort.each { |file|
|
32
34
|
begin
|
33
35
|
require_dependency file
|
34
36
|
rescue Exception
|
@@ -78,5 +80,4 @@ namespace :coverband do
|
|
78
80
|
task :clear => :environment do
|
79
81
|
Coverband.configuration.store.clear!
|
80
82
|
end
|
81
|
-
|
82
83
|
end
|
data/lib/coverband/version.rb
CHANGED
data/test/unit/baseline_test.rb
CHANGED
@@ -38,6 +38,20 @@ class ReporterTest < Test::Unit::TestCase
|
|
38
38
|
assert_equal(results, {"filename.rb" => [0,nil,1]})
|
39
39
|
end
|
40
40
|
|
41
|
+
test "exclude_files" do
|
42
|
+
Coverband.configure do |config|
|
43
|
+
config.redis = nil
|
44
|
+
config.store = nil
|
45
|
+
config.root = '/full/remote_app/path'
|
46
|
+
config.coverage_file = '/tmp/fake_file.json'
|
47
|
+
config.ignore = ['ignored_file.rb']
|
48
|
+
end
|
49
|
+
root = Coverband.configuration.root
|
50
|
+
files = [root + '/ignored_file.rb', root + '/fakefile.rb']
|
51
|
+
expected_files =[root + '/fakefile.rb']
|
52
|
+
assert_equal(expected_files, Coverband::Baseline.exclude_files(files))
|
53
|
+
end
|
54
|
+
|
41
55
|
# todo test redis and file stores baseline
|
42
56
|
|
43
57
|
test "convert_coverage_format" do
|
@@ -47,4 +61,4 @@ class ReporterTest < Test::Unit::TestCase
|
|
47
61
|
end
|
48
62
|
|
49
63
|
|
50
|
-
end
|
64
|
+
end
|
@@ -9,13 +9,13 @@ class BaseTest < Test::Unit::TestCase
|
|
9
9
|
test "defaults to ignore gems" do
|
10
10
|
assert_equal Coverband.configuration.include_gems, false
|
11
11
|
coverband = Coverband::Base.instance.reset_instance
|
12
|
-
assert_equal ['vendor', 'internal:prelude', 'gems'], coverband.instance_variable_get("@ignore_patterns")
|
12
|
+
assert_equal ['vendor', 'internal:prelude', 'schema.rb', 'gems'], coverband.instance_variable_get("@ignore_patterns")
|
13
13
|
end
|
14
14
|
|
15
15
|
test "doesn't ignore gems if include_gems = true" do
|
16
16
|
Coverband.configuration.include_gems = true
|
17
17
|
coverband = Coverband::Base.instance.reset_instance
|
18
|
-
assert_equal ['vendor', 'internal:prelude'], coverband.instance_variable_get("@ignore_patterns")
|
18
|
+
assert_equal ['vendor', 'internal:prelude', 'schema.rb'], coverband.instance_variable_get("@ignore_patterns")
|
19
19
|
end
|
20
20
|
|
21
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: coverband
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Mayer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|