build_log_parser 0.1.3 → 0.1.4
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/README.md +1 -0
- data/Rakefile +2 -0
- data/lib/build_log_parser/matchers/coverage_matcher.rb +20 -5
- data/lib/build_log_parser/version.rb +1 -1
- data/spec/fixtures/istanbul.txt +6 -0
- data/spec/lib/parser_spec.rb +13 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 18e824c211825c1b913f12267fb06833c031b338
|
4
|
+
data.tar.gz: 818ab53f1e1b925c91c19c7f6cb3bec7f80f34c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d85bf0c43bae1f332c8c1741134c329c9f33a69248cde1e747425b74975096e74d23ade7a97c68ecd0decf348a6d7599627d9de058175a27808fc00635f7dc81
|
7
|
+
data.tar.gz: f9c4302039e299f9f49964c5e68c33802ad25c98217aa11a40705d139ea66d3f523456b79ec77e2ee571e2c8ab380a62c6734baa7ce4806a0187938485329b6b
|
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,16 +1,21 @@
|
|
1
1
|
module BuildLogParser
|
2
2
|
module CoverageMatcher
|
3
|
-
|
3
|
+
PATTERNS = {
|
4
|
+
rspec: /\s([\d]+) \/ ([\d]+) LOC \(([\d]+\.[\d]+)%\) covered\./,
|
5
|
+
phpunit: /Lines:\s+([\d.]+)% \(([\d]+)\/([\d]+)\)/,
|
6
|
+
istanbul: /Lines\s+:\s+([\d.]+)% \(\s([\d]+)\/([\d]+)\s\)/
|
7
|
+
}
|
4
8
|
|
5
9
|
def fetch_coverage(str)
|
6
10
|
fetch_rspec_coverage(str) ||
|
7
|
-
fetch_phpunit_coverage(str)
|
11
|
+
fetch_phpunit_coverage(str) ||
|
12
|
+
fetch_istanbul_coverage(str)
|
8
13
|
end
|
9
14
|
|
10
15
|
protected
|
11
16
|
|
12
17
|
def fetch_rspec_coverage(str)
|
13
|
-
if body =~
|
18
|
+
if body =~ PATTERNS[:rspec]
|
14
19
|
{
|
15
20
|
lines_covered: $1.to_i,
|
16
21
|
lines_total: $2.to_i,
|
@@ -20,7 +25,17 @@ module BuildLogParser
|
|
20
25
|
end
|
21
26
|
|
22
27
|
def fetch_phpunit_coverage(str)
|
23
|
-
if body =~
|
28
|
+
if body =~ PATTERNS[:phpunit]
|
29
|
+
{
|
30
|
+
lines_covered: $2.to_i,
|
31
|
+
lines_total: $3.to_i,
|
32
|
+
coverage_percent: $1.to_f
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def fetch_istanbul_coverage(str)
|
38
|
+
if body =~ PATTERNS[:istanbul]
|
24
39
|
{
|
25
40
|
lines_covered: $2.to_i,
|
26
41
|
lines_total: $3.to_i,
|
@@ -29,4 +44,4 @@ module BuildLogParser
|
|
29
44
|
end
|
30
45
|
end
|
31
46
|
end
|
32
|
-
end
|
47
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
=============================== Coverage summary ===============================
|
2
|
+
Statements : 22.35% ( 245/1096 )
|
3
|
+
Branches : 13.74% ( 61/444 )
|
4
|
+
Functions : 17.29% ( 37/214 )
|
5
|
+
Lines : 22.35% ( 245/1096 )
|
6
|
+
================================================================================
|
data/spec/lib/parser_spec.rb
CHANGED
@@ -122,6 +122,18 @@ describe BuildLogParser::Parser do
|
|
122
122
|
)
|
123
123
|
end
|
124
124
|
end
|
125
|
+
|
126
|
+
context "with istanbul data" do
|
127
|
+
let(:log) { fixture "istanbul.txt" }
|
128
|
+
|
129
|
+
it "returns coverage metrics" do
|
130
|
+
expect(result).to eq Hash(
|
131
|
+
coverage_percent: 22.35,
|
132
|
+
lines_covered: 245,
|
133
|
+
lines_total: 1096
|
134
|
+
)
|
135
|
+
end
|
136
|
+
end
|
125
137
|
end
|
126
138
|
|
127
139
|
describe "#duration" do
|
@@ -180,4 +192,4 @@ describe BuildLogParser::Parser do
|
|
180
192
|
end
|
181
193
|
end
|
182
194
|
end
|
183
|
-
end
|
195
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build_log_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Sosedoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/build_log_parser/matchers/test_unit_matcher.rb
|
89
89
|
- lib/build_log_parser/parser.rb
|
90
90
|
- lib/build_log_parser/version.rb
|
91
|
+
- spec/fixtures/istanbul.txt
|
91
92
|
- spec/fixtures/js.txt
|
92
93
|
- spec/fixtures/phpunit.txt
|
93
94
|
- spec/fixtures/phpunit_failure.txt
|
@@ -125,6 +126,7 @@ signing_key:
|
|
125
126
|
specification_version: 4
|
126
127
|
summary: Parse build metrics from logs
|
127
128
|
test_files:
|
129
|
+
- spec/fixtures/istanbul.txt
|
128
130
|
- spec/fixtures/js.txt
|
129
131
|
- spec/fixtures/phpunit.txt
|
130
132
|
- spec/fixtures/phpunit_failure.txt
|