build_log_parser 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: e463edec3b7d150221fffb7bbcb9bf699399376d
4
- data.tar.gz: e45dc28cf52c686954d03d279d9963dad359a2ad
3
+ metadata.gz: 18e824c211825c1b913f12267fb06833c031b338
4
+ data.tar.gz: 818ab53f1e1b925c91c19c7f6cb3bec7f80f34c6
5
5
  SHA512:
6
- metadata.gz: c4e047dc2b80909f84d712d9b0a1cafacc9a3d982f8d9438fb579d8da08f46d88f35508ec5db5c5bfb08ef60a7e89bdc3fc545e282680b6b0fd8dbb1d5b6398d
7
- data.tar.gz: 8ff89d1b8614ef3f24cf2561b848f227fb5b58438b2d1a0740b214bd2fa6be3f478fee1da7d8593a6748fe262152730844cdb70bcf1ae6cf81ad9574a14326a0
6
+ metadata.gz: d85bf0c43bae1f332c8c1741134c329c9f33a69248cde1e747425b74975096e74d23ade7a97c68ecd0decf348a6d7599627d9de058175a27808fc00635f7dc81
7
+ data.tar.gz: f9c4302039e299f9f49964c5e68c33802ad25c98217aa11a40705d139ea66d3f523456b79ec77e2ee571e2c8ab380a62c6734baa7ce4806a0187938485329b6b
data/README.md CHANGED
@@ -28,6 +28,7 @@ logs. Supports tests, coverage and duration metrics from frameworks:
28
28
  - Test::Unit (Ruby)
29
29
  - NPM (Node.js)
30
30
  - PHPUnit (PHP)
31
+ - Istanbul (Javascript)
31
32
 
32
33
  Example log output:
33
34
 
data/Rakefile CHANGED
@@ -8,6 +8,8 @@ RSpec::Core::RakeTask.new(:test) do |t|
8
8
  end
9
9
 
10
10
  task :console do
11
+ $LOAD_PATH << "./lib"
12
+
11
13
  require "irb"
12
14
  require "irb/completion"
13
15
  require "build_log_parser"
@@ -1,16 +1,21 @@
1
1
  module BuildLogParser
2
2
  module CoverageMatcher
3
- PATTERN = /\s([\d]+) \/ ([\d]+) LOC \(([\d]+\.[\d]+)%\) covered\./
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 =~ PATTERN
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 =~ /Lines:\s+([\d.]+)% \(([\d]+)\/([\d]+)\)/
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
@@ -1,3 +1,3 @@
1
1
  module BuildLogParser
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  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
+ ================================================================================
@@ -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.3
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-04-10 00:00:00.000000000 Z
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