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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf69ef556cbc606786ff1d0b49b74728cedbf0f5
4
- data.tar.gz: 28d03bf504a6a51b112a5db554b8393032f9678f
3
+ metadata.gz: ae65d228389db7462d1ddc08e950d5964e8a34f4
4
+ data.tar.gz: 8bd404ca135c010026e965953c717ca8539f1dc9
5
5
  SHA512:
6
- metadata.gz: ff7da9c529350fb7dc8b1a7b6725bd3c50c5941934a8704fe17b2db9da8f8921269e8aa520ab9c17bae0a227fd269807823ae751149a7852523089aadc5f9260
7
- data.tar.gz: 40fee47fee66304cb0610050c09beb9e08ce686e00b6012791e9dcc48c5efd3970174c3fa9d93eaf1efd28a7b61ebe5dd891be52beedb88275fc8dd1fc7a0120
6
+ metadata.gz: c29477a4e66d9521b42d58db8469bb75e891d834ab59d08ca784acde9396f65de384b6e27d822fa28bc0641a40a88776b1411191baa8fb9d115f6ca442cb3c9b
7
+ data.tar.gz: a2195997791f11c2c69433210b106631a62785bf7d9bcc68c05ce31a4bbc06ac2b67716458c3a0b36f610b39cde69c9498289fbcf724357102615426eb06c82f
@@ -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"
@@ -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 + ["internal:prelude"]
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
@@ -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)
@@ -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").sort.each { |file|
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").sort.each { |file|
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
@@ -1,3 +1,3 @@
1
1
  module Coverband
2
- VERSION = "1.5.1"
2
+ VERSION = "1.5.2"
3
3
  end
@@ -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.1
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-04-11 00:00:00.000000000 Z
11
+ date: 2017-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler