covered 0.15.1 → 0.15.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b53c13ab215d5a93f7a092321dc70b8538909a76da3e841b8ce6c2f8a7fcdc3
4
- data.tar.gz: 6f01972bf2729eb4549612acfe8dc7ad37bb8aaf927460257ae4a060cee8e001
3
+ metadata.gz: 112c85633150c4f05435b29a2867a51a711a9f216fdbe850c0356b0371ab4e49
4
+ data.tar.gz: 2efa0d7a7d07ca3125237c55b4e1d34fd4835e5f9d963344f1c7b4b9405d37eb
5
5
  SHA512:
6
- metadata.gz: bde94163994801bf64fd7a61014361c754f7c18be4f766eb2728d93b8ff01c83ffc1bcc0917346d10ec720d95aa3c15eae208e3ebbec56c97ca394843dc715f3
7
- data.tar.gz: 3ccfcc2ae535e65a6ca0de483c5a150104f1e414f9a5679d9e0d9b63420b9416db28df6e24cf5aaeb6d2a964d70af3d3828823eb35523b4ea240fd4b3872b66c
6
+ metadata.gz: 054c6dca966431d180da1ff4e98afadea19400ec2ea28a2f7b4a3096ae6affdcc0082f939bb612cc3440861b4e1bd55e1b88dc03b7a93205ec19d2e3935fb5fd
7
+ data.tar.gz: f9ea6aacbb0993749c4e808f09c8b6bcccfa5d7f6c640fcdf83a79a7432fffd893008ccb6aed9314801f1c79446dcb82bdfc919e55c1564ca5691920a6371073
checksums.yaml.gz.sig CHANGED
Binary file
@@ -10,13 +10,14 @@ end
10
10
  # @parameter minumum [Float] The minimum required coverage in order to pass.
11
11
  def validate(paths: nil, minimum: 1.0)
12
12
  paths&.each do |path|
13
- Covered::Persist.new($covered.output, path).load!
13
+ # It would be nice to have a better algorithm here than just ignoring mtime - perhaps using checksums?
14
+ Covered::Persist.new($covered.output, path).load!(ignore_mtime: true)
14
15
  end
15
16
 
16
17
  $covered.flush
17
18
 
18
19
  statistics = Covered::Statistics.new
19
-
20
+
20
21
  $covered.each do |coverage|
21
22
  statistics << coverage
22
23
  end
@@ -36,14 +36,24 @@ module Covered
36
36
  @touched = Set.new
37
37
  end
38
38
 
39
- def apply(record)
39
+ def apply(record, ignore_mtime: false)
40
40
  # The file must still exist:
41
41
  return unless path = expand_path(record[:path])
42
- return unless File.exist? path
42
+
43
+ unless File.exist?(path)
44
+ Console.logger.debug(self) {"Ignoring coverage, path #{path} does not exist!"}
45
+ return
46
+ end
43
47
 
44
48
  # If the file has been modified since... we can't use the coverage.
45
49
  return unless mtime = record[:mtime]
46
- return if File.mtime(path).to_f > record[:mtime]
50
+
51
+ unless ignore_mtime
52
+ if File.mtime(path).to_f > record[:mtime]
53
+ Console.logger.debug(self) {"Ignoring coverage, path #{path} has been updated: #{File.mtime(path).to_f} > #{record[:mtime]}!"}
54
+ return
55
+ end
56
+ end
47
57
 
48
58
  record[:coverage].each_with_index do |count, index|
49
59
  @output.mark(path, index, count) if count
@@ -59,20 +69,22 @@ module Covered
59
69
  }
60
70
  end
61
71
 
62
- def load!(path = @path)
72
+ def load!(**options)
63
73
  return unless File.exist?(@path)
64
74
 
65
75
  # Load existing coverage information and mark all files:
66
76
  File.open(@path, "rb") do |file|
67
77
  file.flock(File::LOCK_SH)
68
78
 
69
- Console.logger.debug(self) {"Loading from #{@path}..."}
79
+ Console.logger.debug(self) {"Loading from #{@path} with #{options}..."}
70
80
 
71
- make_unpacker(file).each(&self.method(:apply))
81
+ make_unpacker(file).each do |record|
82
+ self.apply(record, **options)
83
+ end
72
84
  end
73
85
  end
74
86
 
75
- def save!(path = @path)
87
+ def save!
76
88
  # Dump all coverage:
77
89
  File.open(@path, "wb") do |file|
78
90
  file.flock(File::LOCK_EX)
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Covered
22
- VERSION = "0.15.1"
22
+ VERSION = "0.15.2"
23
23
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: covered
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.1
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file