gcov2x 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/gcov2x +3 -1
- data/lib/json_formatter.rb +43 -0
- data/lib/version.rb +1 -1
- data/spec/{file_spec.rb → gcov2x/file_spec.rb} +1 -1
- data/spec/{line_spec.rb → gcov2x/line_spec.rb} +1 -1
- data/spec/{project_spec.rb → gcov2x/project_spec.rb} +1 -1
- metadata +9 -8
- /data/spec/{data → gcov2x/data}/data2/test3.cpp.gcov +0 -0
- /data/spec/{data → gcov2x/data}/test.cpp.gcov +0 -0
- /data/spec/{data → gcov2x/data}/test1.cpp.gcov +0 -0
- /data/spec/{data → gcov2x/data}/test2.cpp.gcov +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50fa0a8dd61420208012101bda3b0af01c7938d4
|
4
|
+
data.tar.gz: f69ce2235ed8de8a7033f4a8127cb8928e401ae2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27f6b3d1b9d6061dedf03a394befb2eaa679ede1965bc332f069be3a5b8335fe448b30245290a0917bc9517955c6e4085c0064fb7f1c23ad420f814259106459
|
7
|
+
data.tar.gz: dd9335ac6eb775306d23e513d7600c53c9fdb807a647c2edde217a28e34dccacc0b81bd39ff2b594f18fb2363440573204c7710dca4c4b7c24fbe3d77dd8b3c7
|
data/bin/gcov2x
CHANGED
@@ -6,6 +6,7 @@ require_relative '../lib/gcov2x'
|
|
6
6
|
require_relative '../lib/ansii_formatter'
|
7
7
|
require_relative '../lib/xml_formatter'
|
8
8
|
require_relative '../lib/html_formatter'
|
9
|
+
require_relative '../lib/json_formatter'
|
9
10
|
|
10
11
|
class Util
|
11
12
|
def Util.opt_wrap(s, width=61)
|
@@ -91,7 +92,8 @@ when :xml then
|
|
91
92
|
formatter = GCOV::XMLFormatter.new( proj, :xsl => cli.config[:xsl] )
|
92
93
|
formatter.print
|
93
94
|
when :json then
|
94
|
-
|
95
|
+
formatter = GCOV::JSONFormatter.new proj
|
96
|
+
formatter.print
|
95
97
|
else
|
96
98
|
fail "Invalid format"
|
97
99
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
|
2
|
+
require_relative './project'
|
3
|
+
require_relative './file'
|
4
|
+
require_relative './line'
|
5
|
+
|
6
|
+
require 'json'
|
7
|
+
|
8
|
+
module GCOV
|
9
|
+
|
10
|
+
class JSONFormatter
|
11
|
+
|
12
|
+
def initialize project, va={}
|
13
|
+
@project = project
|
14
|
+
|
15
|
+
@json = {
|
16
|
+
'files' => []
|
17
|
+
}
|
18
|
+
|
19
|
+
@project.files.each do |file|
|
20
|
+
@json['files'] << {
|
21
|
+
'name' => file.name,
|
22
|
+
'meta' => file.meta,
|
23
|
+
'stats' => file.stats,
|
24
|
+
'lines' => []
|
25
|
+
}
|
26
|
+
|
27
|
+
file.lines.select{|line| line.number > 0}.each do |line|
|
28
|
+
@json['files'][-1]['lines'] << {
|
29
|
+
'number' => line.number,
|
30
|
+
'count' => line.count,
|
31
|
+
'text' => line.text
|
32
|
+
}
|
33
|
+
end # each line
|
34
|
+
end # each file
|
35
|
+
end # initialize
|
36
|
+
|
37
|
+
def print
|
38
|
+
puts @json.to_json
|
39
|
+
end # JSONFormatter#print
|
40
|
+
|
41
|
+
end # JSONFormatter
|
42
|
+
|
43
|
+
end # GCOV
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gcov2x
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mattias Bergbom
|
@@ -32,17 +32,18 @@ files:
|
|
32
32
|
- lib/gcov2x.rb
|
33
33
|
- lib/html_formatter.rb
|
34
34
|
- lib/html_view.html.erb
|
35
|
+
- lib/json_formatter.rb
|
35
36
|
- lib/line.rb
|
36
37
|
- lib/project.rb
|
37
38
|
- lib/version.rb
|
38
39
|
- lib/xml_formatter.rb
|
39
|
-
- spec/data/data2/test3.cpp.gcov
|
40
|
-
- spec/data/test.cpp.gcov
|
41
|
-
- spec/data/test1.cpp.gcov
|
42
|
-
- spec/data/test2.cpp.gcov
|
43
|
-
- spec/file_spec.rb
|
44
|
-
- spec/line_spec.rb
|
45
|
-
- spec/project_spec.rb
|
40
|
+
- spec/gcov2x/data/data2/test3.cpp.gcov
|
41
|
+
- spec/gcov2x/data/test.cpp.gcov
|
42
|
+
- spec/gcov2x/data/test1.cpp.gcov
|
43
|
+
- spec/gcov2x/data/test2.cpp.gcov
|
44
|
+
- spec/gcov2x/file_spec.rb
|
45
|
+
- spec/gcov2x/line_spec.rb
|
46
|
+
- spec/gcov2x/project_spec.rb
|
46
47
|
- spec/spec_helper.rb
|
47
48
|
- src/Makefile
|
48
49
|
- src/test.cpp
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|