xcpretty-json-formatter 0.0.2 → 0.1.0
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 +8 -0
- data/lib/json_formatter.rb +34 -31
- metadata +16 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb549e9507a51d5de8499d4a423ecc0f028827ec
|
4
|
+
data.tar.gz: 6a5518ad63045b2145a623b9834b2cc14c9b898a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 914416aee794745662ab1b3b987b6717598550d27f2516e6e70c97d0576fc1d51b3b18a086846b209863a8a6225566ee2394948d39f4e6f4cf641565d4337e71
|
7
|
+
data.tar.gz: d566897e9da6d0a6d2b54759e87046cb881c15dc0aea8249ad577059f20b1eb87b1bce7c90dabac6ebdf7ae1919e2957a0bd77b4d9158667fd3936de00dc6c62
|
data/README.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# XCPretty JSON Formatter
|
2
2
|
|
3
|
+
[](LICENSE.txt)
|
4
|
+
[](http://rubygems.org/gems/xcpretty-json-formatter)
|
5
|
+
[](https://travis-ci.org/marcelofabri/xcpretty-json-formatter)
|
6
|
+
|
3
7
|
Custom formatter for [xcpretty](https://github.com/supermarin/xcpretty) that saves on a JSON file all the errors, warnings and test failures, so you can process them easily later.
|
4
8
|
|
5
9
|
## Installation
|
@@ -26,6 +30,10 @@ By default, `xcpretty-json-formatter` writes the result in `build/reports/errors
|
|
26
30
|
xcodebuild | XCPRETTY_JSON_FILE_OUTPUT=result.json xcpretty -f `xcpretty-json-formatter`
|
27
31
|
```
|
28
32
|
|
33
|
+
## Output format
|
34
|
+
|
35
|
+
You can check some example JSONs in the [fixtures folder](spec/fixtures).
|
36
|
+
|
29
37
|
## Thanks
|
30
38
|
|
31
39
|
* [Marin Usalj](http://github.com/supermarin) and [Delisa Mason](http://github.com/kattrali) for creating [xcpretty](https://github.com/supermarin/xcpretty).
|
data/lib/json_formatter.rb
CHANGED
@@ -2,7 +2,7 @@ require 'fileutils'
|
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
class JSONFormatter < XCPretty::Simple
|
5
|
-
FILE_PATH = 'build/reports/errors.json'
|
5
|
+
FILE_PATH = 'build/reports/errors.json'.freeze
|
6
6
|
|
7
7
|
def initialize(use_unicode, colorize)
|
8
8
|
super
|
@@ -15,6 +15,7 @@ class JSONFormatter < XCPretty::Simple
|
|
15
15
|
@undefined_symbols_errors = []
|
16
16
|
@duplicate_symbols_errors = []
|
17
17
|
@failures = {}
|
18
|
+
@tests_summary_messages = []
|
18
19
|
end
|
19
20
|
|
20
21
|
def format_ld_warning(message)
|
@@ -31,11 +32,11 @@ class JSONFormatter < XCPretty::Simple
|
|
31
32
|
|
32
33
|
def format_compile_warning(file_name, file_path, reason, line, cursor)
|
33
34
|
@compile_warnings << {
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
35
|
+
file_name: file_name,
|
36
|
+
file_path: file_path,
|
37
|
+
reason: reason,
|
38
|
+
line: line,
|
39
|
+
cursor: cursor
|
39
40
|
}
|
40
41
|
write_to_file_if_needed
|
41
42
|
super
|
@@ -49,11 +50,11 @@ class JSONFormatter < XCPretty::Simple
|
|
49
50
|
|
50
51
|
def format_compile_error(file, file_path, reason, line, cursor)
|
51
52
|
@compile_errors << {
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
53
|
+
file_name: file,
|
54
|
+
file_path: file_path,
|
55
|
+
reason: reason,
|
56
|
+
line: line,
|
57
|
+
cursor: cursor
|
57
58
|
}
|
58
59
|
write_to_file_if_needed
|
59
60
|
super
|
@@ -61,8 +62,8 @@ class JSONFormatter < XCPretty::Simple
|
|
61
62
|
|
62
63
|
def format_file_missing_error(reason, file_path)
|
63
64
|
@file_missing_errors << {
|
64
|
-
:
|
65
|
-
:
|
65
|
+
file_path: file_path,
|
66
|
+
reason: reason
|
66
67
|
}
|
67
68
|
write_to_file_if_needed
|
68
69
|
super
|
@@ -70,9 +71,9 @@ class JSONFormatter < XCPretty::Simple
|
|
70
71
|
|
71
72
|
def format_undefined_symbols(message, symbol, reference)
|
72
73
|
@undefined_symbols_errors = {
|
73
|
-
:
|
74
|
-
:
|
75
|
-
:
|
74
|
+
message: message,
|
75
|
+
symbol: symbol,
|
76
|
+
reference: reference
|
76
77
|
}
|
77
78
|
write_to_file_if_needed
|
78
79
|
super
|
@@ -80,8 +81,8 @@ class JSONFormatter < XCPretty::Simple
|
|
80
81
|
|
81
82
|
def format_duplicate_symbols(message, file_paths)
|
82
83
|
@duplicate_symbols_errors = {
|
83
|
-
:
|
84
|
-
:
|
84
|
+
message: message,
|
85
|
+
file_paths: file_paths
|
85
86
|
}
|
86
87
|
write_to_file_if_needed
|
87
88
|
super
|
@@ -89,6 +90,7 @@ class JSONFormatter < XCPretty::Simple
|
|
89
90
|
|
90
91
|
def format_test_summary(message, failures_per_suite)
|
91
92
|
@failures = failures_per_suite
|
93
|
+
@tests_summary_messages << message
|
92
94
|
write_to_file_if_needed
|
93
95
|
super
|
94
96
|
end
|
@@ -100,18 +102,19 @@ class JSONFormatter < XCPretty::Simple
|
|
100
102
|
|
101
103
|
def json_output
|
102
104
|
{
|
103
|
-
:
|
104
|
-
:
|
105
|
-
:
|
106
|
-
:
|
107
|
-
:
|
108
|
-
:
|
109
|
-
:
|
110
|
-
:
|
111
|
-
:
|
105
|
+
warnings: @warnings,
|
106
|
+
ld_warnings: @ld_warnings,
|
107
|
+
compile_warnings: @compile_warnings,
|
108
|
+
errors: @errors,
|
109
|
+
compile_errors: @compile_errors,
|
110
|
+
file_missing_errors: @file_missing_errors,
|
111
|
+
undefined_symbols_errors: @undefined_symbols_errors,
|
112
|
+
duplicate_symbols_errors: @duplicate_symbols_errors,
|
113
|
+
tests_failures: @failures,
|
114
|
+
tests_summary_messages: @tests_summary_messages
|
112
115
|
}
|
113
116
|
end
|
114
|
-
|
117
|
+
|
115
118
|
def write_to_file_if_needed
|
116
119
|
write_to_file unless XCPretty::Formatter.method_defined? :finish
|
117
120
|
end
|
@@ -119,11 +122,11 @@ class JSONFormatter < XCPretty::Simple
|
|
119
122
|
def write_to_file
|
120
123
|
file_name = ENV['XCPRETTY_JSON_FILE_OUTPUT'] || FILE_PATH
|
121
124
|
dirname = File.dirname(file_name)
|
122
|
-
FileUtils
|
125
|
+
FileUtils.mkdir_p dirname
|
123
126
|
|
124
|
-
File.open(file_name, 'w')
|
127
|
+
File.open(file_name, 'w') do |io|
|
125
128
|
io.write(JSON.pretty_generate(json_output))
|
126
|
-
|
129
|
+
end
|
127
130
|
end
|
128
131
|
end
|
129
132
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcpretty-json-formatter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcelo Fabri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xcpretty
|
@@ -72,6 +72,20 @@ dependencies:
|
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '3.0'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rubocop
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0.38'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0.38'
|
75
89
|
description: Custom formatter for xcpretty that saves on a JSON file all the errors,
|
76
90
|
warnings and test failures, so you can process them easily later.
|
77
91
|
email:
|
@@ -110,4 +124,3 @@ signing_key:
|
|
110
124
|
specification_version: 4
|
111
125
|
summary: xcpretty custom formatter for JSON output
|
112
126
|
test_files: []
|
113
|
-
has_rdoc:
|