covered 0.15.0 → 0.15.3
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 +28 -0
- data/lib/covered/persist.rb +19 -7
- data/lib/covered/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -11
- metadata.gz.sig +5 -4
- data/.github/workflows/development.yml +0 -45
- data/.github/workflows/documentation.yml +0 -34
- data/examples/coverage/covered.rb +0 -11
- data/examples/coverage/erb/coverage.rb +0 -21
- data/examples/coverage/erb/template.erb +0 -7
- data/examples/coverage/parser.rb +0 -23
- data/examples/coverage/simplecov.rb +0 -7
- data/examples/coverage/test.rb +0 -16
- data/examples/coverage/tracepoint.rb +0 -8
- data/media/example.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 005b3a56275c6e1e796e3b12a76addd19e78675be9ae6cc773102f1a905cfdf1
|
4
|
+
data.tar.gz: a2218c1566644a8ecdacc85f964712e59cf3b968067c1e44e66fd5e54319f5da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00d1fae46afb3f1d25bd5b7b7d121547a584d35479a4d16e0cd4a2a0d99f0f4cd35c2f0ccb8d90871d498a9dec4521accd31494d54532fd57af88ab645a6de1f
|
7
|
+
data.tar.gz: 0df096a51adbaf5982cf5b738d311b43a8eccf7057df14e9eacf36640ad61316ca39bc25ca81603ab93379c6e1afac17126b1cd19833f3786ee0359d6d32e7b4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
def initialize(context)
|
3
|
+
super
|
4
|
+
|
5
|
+
require_relative '../../lib/covered/policy/default'
|
6
|
+
end
|
7
|
+
|
8
|
+
# Validate the coverage of multiple test runs.
|
9
|
+
# @parameter paths [Array(String)] The coverage database paths.
|
10
|
+
# @parameter minumum [Float] The minimum required coverage in order to pass.
|
11
|
+
def validate(paths: nil, minimum: 1.0)
|
12
|
+
paths&.each do |path|
|
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)
|
15
|
+
end
|
16
|
+
|
17
|
+
$covered.flush
|
18
|
+
|
19
|
+
statistics = Covered::Statistics.new
|
20
|
+
|
21
|
+
$covered.each do |coverage|
|
22
|
+
statistics << coverage
|
23
|
+
end
|
24
|
+
|
25
|
+
statistics.print($stderr)
|
26
|
+
|
27
|
+
statistics.validate!(minimum)
|
28
|
+
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
@@ -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.
|
4
|
+
version: 0.15.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -159,15 +159,7 @@ executables: []
|
|
159
159
|
extensions: []
|
160
160
|
extra_rdoc_files: []
|
161
161
|
files:
|
162
|
-
-
|
163
|
-
- ".github/workflows/documentation.yml"
|
164
|
-
- examples/coverage/covered.rb
|
165
|
-
- examples/coverage/erb/coverage.rb
|
166
|
-
- examples/coverage/erb/template.erb
|
167
|
-
- examples/coverage/parser.rb
|
168
|
-
- examples/coverage/simplecov.rb
|
169
|
-
- examples/coverage/test.rb
|
170
|
-
- examples/coverage/tracepoint.rb
|
162
|
+
- bake/covered/validate.rb
|
171
163
|
- lib/covered.rb
|
172
164
|
- lib/covered/cache.rb
|
173
165
|
- lib/covered/capture.rb
|
@@ -185,7 +177,6 @@ files:
|
|
185
177
|
- lib/covered/summary.rb
|
186
178
|
- lib/covered/version.rb
|
187
179
|
- lib/covered/wrapper.rb
|
188
|
-
- media/example.png
|
189
180
|
homepage: https://github.com/ioquatix/covered
|
190
181
|
licenses:
|
191
182
|
- MIT
|
metadata.gz.sig
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
������
|
2
|
-
|
3
|
-
|
4
|
-
�}
|
1
|
+
��Q��;��A������M�
|
2
|
+
��i\l
|
3
|
+
'��`ڍ�I�uJw�<`��y
|
4
|
+
��HM_.����4��uX�)W>��3e���qh\���MՑ鬫�P�:0����4糵����h�1�I�/�xC���^�M?i\��[�I}�3\W���Vk���1�Q�RN�{�������5�W��4�Ei�?;��)���%�)\���5��6k�T��FfS9w��OEU!��0�-.
|
5
|
+
-��TT�, ����;����=�+D>K��{�p��W��pA�o�!u���̆1u�=��d��!� cku���_���)�~�\8ذ�$����o`�Q�c�\�f^f��إV�E=uPفD��[?�e;?ܝ�
|
@@ -1,45 +0,0 @@
|
|
1
|
-
name: Development
|
2
|
-
|
3
|
-
on: [push, pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
test:
|
7
|
-
name: ${{matrix.ruby}} on ${{matrix.os}}
|
8
|
-
runs-on: ${{matrix.os}}-latest
|
9
|
-
continue-on-error: ${{matrix.experimental}}
|
10
|
-
|
11
|
-
strategy:
|
12
|
-
matrix:
|
13
|
-
os:
|
14
|
-
- ubuntu
|
15
|
-
- macos
|
16
|
-
|
17
|
-
ruby:
|
18
|
-
- "2.6"
|
19
|
-
- "2.7"
|
20
|
-
- "3.0"
|
21
|
-
|
22
|
-
experimental: [false]
|
23
|
-
env: [""]
|
24
|
-
|
25
|
-
include:
|
26
|
-
- os: ubuntu
|
27
|
-
ruby: truffleruby
|
28
|
-
experimental: true
|
29
|
-
- os: ubuntu
|
30
|
-
ruby: jruby
|
31
|
-
experimental: true
|
32
|
-
- os: ubuntu
|
33
|
-
ruby: head
|
34
|
-
experimental: true
|
35
|
-
|
36
|
-
steps:
|
37
|
-
- uses: actions/checkout@v2
|
38
|
-
- uses: ruby/setup-ruby@v1
|
39
|
-
with:
|
40
|
-
ruby-version: ${{matrix.ruby}}
|
41
|
-
bundler-cache: true
|
42
|
-
|
43
|
-
- name: Run tests
|
44
|
-
timeout-minutes: 5
|
45
|
-
run: ${{matrix.env}} bundle exec rspec
|
@@ -1,34 +0,0 @@
|
|
1
|
-
name: Documentation
|
2
|
-
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- main
|
7
|
-
|
8
|
-
env:
|
9
|
-
BUNDLE_WITH: maintenance
|
10
|
-
|
11
|
-
jobs:
|
12
|
-
deploy:
|
13
|
-
runs-on: ubuntu-latest
|
14
|
-
|
15
|
-
steps:
|
16
|
-
- uses: actions/checkout@v3
|
17
|
-
|
18
|
-
- uses: ruby/setup-ruby@v1
|
19
|
-
with:
|
20
|
-
ruby-version: 3.1
|
21
|
-
bundler-cache: true
|
22
|
-
|
23
|
-
- name: Installing packages
|
24
|
-
run: sudo apt-get install wget
|
25
|
-
|
26
|
-
- name: Prepare GitHub Pages
|
27
|
-
run: bundle exec bake github:pages:prepare --directory docs
|
28
|
-
|
29
|
-
- name: Generate documentation
|
30
|
-
timeout-minutes: 5
|
31
|
-
run: bundle exec bake utopia:project:static --force no
|
32
|
-
|
33
|
-
- name: Deploy GitHub Pages
|
34
|
-
run: bundle exec bake github:pages:commit --directory docs
|
@@ -1,21 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'erb'
|
3
|
-
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
|
4
|
-
|
5
|
-
template_path = File.expand_path("template.erb", __dir__)
|
6
|
-
|
7
|
-
ENV['COVERAGE'] ||= 'PartialSummary'
|
8
|
-
require 'covered/policy/default'
|
9
|
-
|
10
|
-
$covered.enable
|
11
|
-
|
12
|
-
template = ERB.new(File.read(template_path)).tap do |template|
|
13
|
-
template.filename = template_path
|
14
|
-
end
|
15
|
-
|
16
|
-
@items = ["Cats", "Dogs", "Chickens"]
|
17
|
-
puts template.result(binding)
|
18
|
-
|
19
|
-
$covered.disable
|
20
|
-
|
21
|
-
$covered.call($stdout)
|
data/examples/coverage/parser.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'pry'
|
4
|
-
require 'parser/current'
|
5
|
-
|
6
|
-
ast = Parser::CurrentRuby.parse_file('test.rb')
|
7
|
-
# ast.location.expression.source
|
8
|
-
|
9
|
-
def print_methods(ast)
|
10
|
-
if ast.is_a? Parser::AST::Node
|
11
|
-
if ast.type == :send
|
12
|
-
puts "Calling #{ast.children[1]} on #{ast.location.line}"
|
13
|
-
end
|
14
|
-
|
15
|
-
ast.children.each do |child|
|
16
|
-
print_methods(child)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
print_methods(ast)
|
22
|
-
|
23
|
-
binding.pry
|
data/examples/coverage/test.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
trace_point = TracePoint.new(:call, :return, :line, :c_call, :c_return, :b_call, :b_return) do |trace|
|
2
|
-
puts [trace.path, trace.lineno].join(":")
|
3
|
-
end
|
4
|
-
|
5
|
-
trace_point.enable
|
6
|
-
|
7
|
-
values = {foo: 10}
|
8
|
-
|
9
|
-
def shell_escape(x)
|
10
|
-
x
|
11
|
-
end
|
12
|
-
|
13
|
-
values.map{|key, value| [
|
14
|
-
key.to_s.upcase,
|
15
|
-
shell_escape(value) # TracePoint is never triggered for this line.
|
16
|
-
]}
|
data/media/example.png
DELETED
Binary file
|