xcpretty-yoomoney-formatter 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: b3b01683e5ce79241e17aad87da8eda6c76c1be4b51883dd6d29e89a514d3e6f
4
+ data.tar.gz: 7ab58122ffa1ea93105b7ce7b83a109fb62fdeb0020508db2adbe9fa9b97265d
5
+ SHA512:
6
+ metadata.gz: 212be6a4bdd3da458628293bb56fd1341ee8848a7ae987d18a3cd8889f09a05e4e422f1aa6926713c88ae74d66f1c8eef3e2f2c5a15fc21183ac9f2b01e8326b
7
+ data.tar.gz: 13dac56c7142d11caffe35fb361e3df69654c3c8cce531b7df0ad11b96aefcd4524078bb5ac74a6efef3661f5005011c8e76f6a4092303a16e1b1dfba3a2f35a
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Delisa Mason
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.
@@ -0,0 +1,23 @@
1
+ # XCPretty TeamCity Formatter
2
+
3
+ Custom formatter for [xcpretty](https://github.com/supermarin/xcpretty) with some syntactic sugar for presentation on TeamCity.
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-yoomoney-formatter
10
+
11
+ ## Usage
12
+
13
+ Specify `xcpretty-yoomoney-formatter` as a custom formatter to `xcpretty`:
14
+
15
+ ```bash
16
+ #!/bin/bash
17
+
18
+ xcodebuild | xcpretty -f `xcpretty-yoomoney-formatter`
19
+ ```
20
+
21
+ ## How it works
22
+
23
+ The `--formatter` option takes a file path as an argument, which is returned by the `xcpretty-yoomoney-formatter` binary. It must be evaluated before the xcpretty arguments are evaluated, hence the backtick wrapping. The specified file must return a Ruby subclass of `XCPretty::Formatter`, which will then receive `formatter_*` method invocations as the build output is parsed.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ print File.expand_path('../../lib/yoomoney_formatter.rb', __FILE__)
@@ -0,0 +1,90 @@
1
+ class TeamCityFormatter < XCPretty::Simple
2
+ def initialize(use_unicode, colorize)
3
+ super
4
+ log compile_group(false)
5
+ at_exit do
6
+ log compile_group(true)
7
+ end
8
+ end
9
+
10
+ # Errors and warnings.
11
+ def format_compile_error(_, file_path, reason, line, cursor)
12
+ details = "#{file_path}: #{reason}\n#{line}\n#{cursor}"
13
+ compile_error('Compile error', details)
14
+ end
15
+
16
+ def format_error(message)
17
+ compile_error('Error', super)
18
+ end
19
+
20
+ def format_file_missing_error(error, file_path)
21
+ compile_error('Error', "#{file_path}: #{error}")
22
+ end
23
+
24
+ def format_ld_warning(message)
25
+ compile_error('LD warning', super)
26
+ end
27
+
28
+ def format_undefined_symbols(message, symbol, reference)
29
+ details = "#{message}\n" \
30
+ "> Symbol: #{symbol}\n" \
31
+ "> Referenced from: #{reference}"
32
+ compile_error('Undefined symbols', details)
33
+ end
34
+
35
+ def format_duplicate_symbols(message, file_paths)
36
+ details = "#{message}" \
37
+ "> #{file_paths.join("\n> ")}"
38
+ compile_error('Duplicate symbols', details)
39
+ end
40
+
41
+ def format_warning(message)
42
+ compile_error('Warning', message)
43
+ end
44
+
45
+ def format_compile_warning(_, file_path, reason, line, cursor)
46
+ details = "#{file_path}: #{reason}\n#{line}\n#{cursor}"
47
+ compile_error('Compile warning', details)
48
+ end
49
+
50
+ private
51
+
52
+ # @param [String] str
53
+ def log(str)
54
+ STDOUT.puts str
55
+ end
56
+
57
+ # @param [String] message
58
+ # @param [String] unformatted_details
59
+ # @param [Bool] warning
60
+ # @return [String]
61
+ def compile_error(message, unformatted_details, warning = false)
62
+ status = warning ? 'WARNING' : 'ERROR'
63
+ str = "##teamcity[message text='#{message}' "
64
+ unless warning
65
+ error_details = format_error_details(unformatted_details)
66
+ str += "errorDetails='#{error_details}' "
67
+ end
68
+ str + "status='#{status}']\n"
69
+ end
70
+
71
+ # @param [Bool] finished
72
+ # @return [String]
73
+ def compile_group(finished)
74
+ command = finished ? 'compilationFinished' : 'compilationStarted'
75
+ "##teamcity[#{command} compiler='xcodebuild']"
76
+ end
77
+
78
+ # @param [String] str
79
+ # @return [String]
80
+ def format_error_details(str)
81
+ str.gsub('|', '||')
82
+ .gsub("\n", '|n')
83
+ .gsub("'", "|'")
84
+ .gsub('[', '|[')
85
+ .gsub(']', '|]')
86
+
87
+ end
88
+ end
89
+
90
+ TeamCityFormatter
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xcpretty-yoomoney-formatter
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.8
5
+ platform: ruby
6
+ authors:
7
+ - Alxander Zalutskiy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-12-15 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.0.7
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '0.2'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.0.7
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '0.2'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bacon
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.2'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.2'
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
+ description: "\n Formatter for xcpretty customized to provide pretty output on
76
+ TeamCity\n "
77
+ email:
78
+ - zalutskii@yoomoney.ru
79
+ executables:
80
+ - xcpretty-yoomoney-formatter
81
+ extensions: []
82
+ extra_rdoc_files: []
83
+ files:
84
+ - LICENSE
85
+ - README.md
86
+ - bin/xcpretty-yoomoney-formatter
87
+ - lib/yoomoney_formatter.rb
88
+ homepage: https://github.com/yoomoney/xcpretty-teamcity-formatter
89
+ licenses:
90
+ - MIT
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - "~>"
99
+ - !ruby/object:Gem::Version
100
+ version: '2.2'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ requirements: []
107
+ rubygems_version: 3.0.6
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: xcpretty custom formatter for TeamCity
111
+ test_files: []