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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/covered/validate.rb +3 -2
- data/lib/covered/persist.rb +19 -7
- data/lib/covered/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 112c85633150c4f05435b29a2867a51a711a9f216fdbe850c0356b0371ab4e49
|
4
|
+
data.tar.gz: 2efa0d7a7d07ca3125237c55b4e1d34fd4835e5f9d963344f1c7b4b9405d37eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 054c6dca966431d180da1ff4e98afadea19400ec2ea28a2f7b4a3096ae6affdcc0082f939bb612cc3440861b4e1bd55e1b88dc03b7a93205ec19d2e3935fb5fd
|
7
|
+
data.tar.gz: f9ea6aacbb0993749c4e808f09c8b6bcccfa5d7f6c640fcdf83a79a7432fffd893008ccb6aed9314801f1c79446dcb82bdfc919e55c1564ca5691920a6371073
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/covered/validate.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/covered/persist.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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!(
|
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
|
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!
|
87
|
+
def save!
|
76
88
|
# Dump all coverage:
|
77
89
|
File.open(@path, "wb") do |file|
|
78
90
|
file.flock(File::LOCK_EX)
|
data/lib/covered/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|