xcpretty-travis-formatter 0.0.1 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +2 -2
  3. data/lib/travis_formatter.rb +81 -23
  4. metadata +9 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7a71ff4b9428b55d6fa575b0eb6f4b29e1236ec9
4
- data.tar.gz: 92fc137fb5f7061308a8b4c4dd74cdcaf6e6a8d2
2
+ SHA256:
3
+ metadata.gz: 9d77050a8c2e20a5c9ae706bae08b45b1cdb1dc044fa7b39de92feac27063ec6
4
+ data.tar.gz: f0075c0df008d28565d6989a4c228fe0d0fd0c602bf41ede3623e415cbddad4d
5
5
  SHA512:
6
- metadata.gz: 8c85f84f0f0c516249201f01968dd0b4c636fcd35a6cce8f3da3335a4af888eb3843f2710d228871646f67d5d88bcb9e3fd579cb0483cb730eba8e9ae5e7027c
7
- data.tar.gz: 4e09074ef43be6ae1a12f4ed1b5e05151bdc116418570f6e7fa7c7c2785abb9ca83270f5044289d570b5fa6161de1a2b92d36fa77b5978ca09e9f5a5282a4d83
6
+ metadata.gz: 95902809d649b24479e79e05e2b6db914dd092d60fb7c6a5869c22c0e857b7df4bde7182387177f646960cefeda6b71a85c32619c75ef632b946166c977c0cab
7
+ data.tar.gz: ff6152ccceb43147f6bfdf95d557e3d044593098b3a752e63a70851d8dbf964f0768adf7cd089c42417244e17de43246dab9c32580df8c75c63eb09efad3fc1b
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # XCPretty TravisCI Formatter
2
2
 
3
- Custom formatter for [xcpretty](https://github.com/supermarin/xcpretty) with some syntactic sugar for presentation on TravisCI.
3
+ Custom formatter for [xcpretty](https://github.com/supermarin/xcpretty) with some syntactic sugar for presentation on TravisCI. [Here is some sample output](https://travis-ci.org/kattrali/xcpretty-travis-formatter/jobs/52970340). The "Build", "Clean", and test phase sections are folded separately, though the final completion message and failing tests are presented clearly, for faster scanning.
4
4
 
5
5
  ## Installation
6
6
 
@@ -20,4 +20,4 @@ xcodebuild | xcpretty -f `xcpretty-travis-formatter`
20
20
 
21
21
  ## How it works
22
22
 
23
- The `--formatter` option takes a file path as an argument, which is returned by the `xcpretty-travis-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.
23
+ The `--formatter` option takes a file path as an argument, which is returned by the `xcpretty-travis-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.
@@ -1,37 +1,95 @@
1
1
 
2
2
  class TravisFormatter < XCPretty::Simple
3
3
 
4
- def open_fold(text)
5
- return if text == @open_fold
6
- close_fold(@open_fold) if @open_fold
7
- puts "travis_fold:start:#{text}\r"
8
- @open_fold = text
9
- end
4
+ def initialize (use_unicode, colorize)
5
+ super
6
+ @currentGroup = nil
7
+ @errors = []
8
+ @seenGroups = {}
9
+ @travis = ENV['TRAVIS'].to_s == 'true'
10
+ @warnings = []
11
+ at_exit do
12
+ # Ensure the last opened fold is closed.
13
+ close_fold()
10
14
 
11
- def close_fold(text)
12
- puts "travis_fold:end:#{text}\r"
13
- @open_fold = nil
14
- end
15
+ # Print out any warnings.
16
+ if !@warnings.compact.empty?
17
+ open_fold("Warnings")
18
+ STDOUT.puts @warnings.compact.join("\n")
19
+ close_fold()
20
+ end
15
21
 
16
- def format_build_target(target, project, configuration)
17
- open_fold("Build:#{target}")
18
- super
22
+ # Print out any errors.
23
+ if !@errors.compact.empty?
24
+ open_fold("Errors")
25
+ STDOUT.puts @errors.compact.join("\n")
26
+ exit(1)
27
+ end
28
+ end
19
29
  end
20
30
 
21
- def format_clean_target(project, target, configuration)
22
- open_fold("Clean Targets")
23
- super
31
+ def format_group(group, track = true)
32
+ group = group.downcase.gsub(/[^a-z\d\-_.]+/, '-').gsub(/-$/, '')
33
+ i = 1
34
+ parts = group.split('.')
35
+ if parts.last =~ /^\d+$/
36
+ last = parts.pop()
37
+ i = last ? last.to_i : 1
38
+ group = parts.join('.')
39
+ end
40
+
41
+ if track && @currentGroup != "#{group}.#{i}" && @seenGroups.has_key?(group)
42
+ i = @seenGroups[group] + 1
43
+ end
44
+
45
+ @seenGroups[group] = i
46
+ "#{group}.#{i}"
24
47
  end
25
48
 
26
- def format_test_run_started(name)
27
- open_fold(name)
28
- super
49
+ def close_fold()
50
+ return if not @travis or @currentGroup == nil
51
+ STDOUT.puts "travis_fold:end:#{@currentGroup}\n"
52
+ @currentGroup = nil
29
53
  end
30
54
 
31
- def format_test_run_finished(name, time)
32
- super
33
- close_fold(name)
55
+ def open_fold(group, track = true)
56
+ description = group
57
+ group = format_group(group, track)
58
+ return if @currentGroup == group or not @travis
59
+ close_fold() if @currentGroup != nil
60
+ @currentGroup = group
61
+ STDOUT.puts "travis_fold:start:#{group}\033[33;1m#{description}\033[0m\n"
34
62
  end
63
+
64
+ # Analyze.
65
+ def format_analyze(file_name, file_path); open_fold("Analyze"); super; end
66
+ def format_analyze_target(target, project, configuration); open_fold("Analyze"); super; end
67
+
68
+ # Build.
69
+ def format_build_target(target, project, configuration); open_fold("Build"); super; end
70
+ def format_compile(file_name, file_path); open_fold("Build"); super; end
71
+
72
+ # Clean.
73
+ def format_clean(project, target, configuration); open_fold("Clean"); super; end
74
+ def format_clean_target(target, project, configuration); open_fold("Clean"); super; end
75
+ def format_clean_remove; open_fold("Clean"); super; end
76
+
77
+ # Test.
78
+ def format_test_run_started(name); open_fold("Test"); super; end
79
+ def format_test_suite_started(name); open_fold("Test"); super; end
80
+ def format_failing_test(suite, test, reason, file_path); @errors.push(super); super; end
81
+ def format_test_summary(message, failures_per_suite); @errors.concat(failures_per_suite.values); super; end
82
+
83
+ # Errors and warnings.
84
+ def format_compile_error(file_name, file_path, reason, line, cursor); @errors.push(super); ""; end
85
+ def format_error(message); @errors.push(super); ""; end
86
+ def format_file_missing_error(error, file_path); @errors.push(super); ""; end
87
+ def format_ld_warning(message); @warnings.push(super); ""; end
88
+ def format_undefined_symbols(message, symbol, reference); @warnings.push(super); ""; end
89
+ def format_duplicate_symbols(message, file_paths); @warnings.push(super); ""; end
90
+ def format_warning(message); @warnings.push(super); ""; end
91
+ def format_compile_warning(file_name, file_path, reason, line, cursor); @warnings.push(super); ""; end
92
+
35
93
  end
36
94
 
37
- TravisFormatter
95
+ TravisFormatter
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcpretty-travis-formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delisa Mason
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-03 00:00:00.000000000 Z
11
+ date: 2021-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcpretty
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.1'
19
+ version: '0.2'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.0.7
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.1'
29
+ version: '0.2'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 0.0.7
@@ -89,7 +89,7 @@ homepage: https://github.com/kattrali/xcpretty-travis-formatter
89
89
  licenses:
90
90
  - MIT
91
91
  metadata: {}
92
- post_install_message:
92
+ post_install_message:
93
93
  rdoc_options: []
94
94
  require_paths:
95
95
  - lib
@@ -97,16 +97,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
97
  requirements:
98
98
  - - ">="
99
99
  - !ruby/object:Gem::Version
100
- version: '0'
100
+ version: '2.0'
101
101
  required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - ">="
104
104
  - !ruby/object:Gem::Version
105
105
  version: '0'
106
106
  requirements: []
107
- rubyforge_project:
108
- rubygems_version: 2.2.2
109
- signing_key:
107
+ rubygems_version: 3.1.4
108
+ signing_key:
110
109
  specification_version: 4
111
110
  summary: xcpretty custom formatter for TravisCI
112
111
  test_files: []