xcpretty-warning-counter 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 87aaa4c20f8a5610f3b3841c11bf8c2bc5fce978
4
+ data.tar.gz: ce7dd045e02b86a0e465babaceba75f5c25a0e26
5
+ SHA512:
6
+ metadata.gz: bfc55762fcc211ef70d953b0b4e0d283729edf46f133783a8c26b468a20cd69eff95ef9b080e79932b5ace659166b10ca6d2dd731b004dd7f6917bc8f71cd7f8
7
+ data.tar.gz: 60fe1cf34ed2ea313bb7477a6f742ece59963ab0a3be8fc234fc117add8ab5304e093737a491d883f91b8b5738a85668ae6b38826a06a2d5b653a3a2702961d0
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 John Lyon-Smith
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # XCPretty Warning Counter
2
+
3
+ A custom formatter for [xcpretty](https://github.com/supermarin/xcpretty) that counts warnings and outputs them in JSON format in a file named `warning-counts.json`
4
+
5
+ ## Installation
6
+
7
+ This formatter is distributed via RubyGems, and depends on a version of `xcpretty` >= 0.0.7 (when custom formatters were introduced). Run:
8
+
9
+ gem install xcpretty-warning-counter
10
+
11
+ ## Usage
12
+
13
+ Specify `xcpretty-warning-counter` as a custom formatter to `xcpretty`:
14
+
15
+ ```bash
16
+ #!/bin/bash
17
+
18
+ xcodebuild | xcpretty -f `xcpretty-warning-counter`
19
+ ```
20
+
21
+ ## How it works
22
+
23
+ The `--formatter` option takes a file path as an argument, so the `xcpretty-warning-counter` script returns the location of the installed Ruby formatter class. It must be evaluated before the xcpretty arguments are evaluated, hence the backtick wrapping. The Ruby script must return a Ruby class that is a subclass of `XCPretty::Formatter`. This then receives `formatter_*` method invocations as the build output is parsed.
24
+
25
+ I use the start of the tests as the indicator for when to write the warning file, so this formatter only works for with the `tests` argument of `xcodebuild`.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ print File.expand_path('../../lib/warning_counter.rb', __FILE__)
@@ -0,0 +1,32 @@
1
+ require 'json'
2
+
3
+ class WarningCounter < XCPretty::Simple
4
+ def initialize(use_unicode, colorize)
5
+ super
6
+ @warning_count = 0
7
+ end
8
+
9
+ def format_ld_warning(message)
10
+ @warning_count += 1
11
+ super
12
+ end
13
+
14
+ def format_warning(message)
15
+ @warning_count += 1
16
+ super
17
+ end
18
+
19
+ def format_compile_warning(file_name, file_path, reason, line, cursor)
20
+ @warning_count += 1
21
+ super
22
+ end
23
+
24
+ def format_test_summary(message, failures_per_suite)
25
+ File.open('warning-count.json', 'w') { |io|
26
+ io.write JSON.generate(:warning_count => @warning_count)
27
+ }
28
+ super
29
+ end
30
+ end
31
+
32
+ WarningCounter
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xcpretty-warning-counter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - John Lyon-Smith
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: xcpretty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.0.7
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '0.2'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 0.0.7
33
+ - !ruby/object:Gem::Dependency
34
+ name: json
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.8'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.8'
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '1.3'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '1.3'
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ name: code-tools
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '5.0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '5.0'
89
+ description: "\n Formatter which counts warnings in an XcodeBuild\n "
90
+ email:
91
+ - john@jamoki.com
92
+ executables:
93
+ - xcpretty-warning-counter
94
+ extensions: []
95
+ extra_rdoc_files: []
96
+ files:
97
+ - README.md
98
+ - LICENSE.md
99
+ - lib/warning_counter.rb
100
+ - bin/xcpretty-warning-counter
101
+ homepage: https://github.com/jlyonsmith/xcpretty-warning-counter
102
+ licenses:
103
+ - MIT
104
+ metadata: {}
105
+ post_install_message:
106
+ rdoc_options: []
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: '2.0'
114
+ required_rubygems_version: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ requirements: []
120
+ rubyforge_project:
121
+ rubygems_version: 2.0.14
122
+ signing_key:
123
+ specification_version: 4
124
+ summary: xcpretty custom formatter for TravisCI
125
+ test_files: []
126
+ has_rdoc: