xcpretty-travis-formatter 0.0.4 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/travis_formatter.rb +79 -30
  3. metadata +17 -17
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42629b4e569a3e9fcf3530378dfe41a44e3267a9
4
- data.tar.gz: 1288925d85a2f7d24c853395802f08cf0054462b
3
+ metadata.gz: 520104ac372ce268399eb26b9878e0f68f9e9c16
4
+ data.tar.gz: c77fbec3c87a9d12be1fbc8b1ccc1c26a315882f
5
5
  SHA512:
6
- metadata.gz: 5a54e62bdd69e01f9293197b0dca7dba098ccb0c6eed7f3f379dd90cf16eec772ee06dc406c84b591bb17ccae6963e4c28b6e15cda32641ac88a20a332f72eea
7
- data.tar.gz: 4ec1c8f2805cbdff9959b9b7a1c770b8ac1ca05a335d1901de16a8b604758422ea04a3f44da178b7249263a45b7e460a7bae535aeb083e483d8f39afbe2a4ce8
6
+ metadata.gz: a9fd2e9a624fd59bc8ddb8ccba6cbd0f0f9233f8acecb46502c43ca6f1866aa3bbadf709385aeff4590c3ab5e9a3d5439c56573bb679d2aa2acf135296e5dd39
7
+ data.tar.gz: fb2d1d3a99831621b9fafcbaefdaad6877b853fd72b16f4dffe6e61046e9f0b482ccd112627a73d335ad15bcac7e3c4c79d60d0a1511c77aa828c1275efb648f
@@ -1,46 +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
- print "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
- print "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")
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_analyze_target(target, project, configuration)
22
- open_fold("Analyze")
23
- super
24
- end
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
25
40
 
26
- def format_clean_target(target, project, configuration)
27
- open_fold("Clean")
28
- super
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}"
29
47
  end
30
48
 
31
- def format_test_run_started(name)
32
- open_fold("Tests-#{scrub(name)}")
33
- super
49
+ def close_fold()
50
+ return if not @travis or @currentGroup == nil
51
+ STDOUT.puts "travis_fold:end:#{@currentGroup}\n"
52
+ @currentGroup = nil
34
53
  end
35
54
 
36
- def format_test_run_finished(name, time)
37
- close_fold("Tests-#{scrub(name)}")
38
- super
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"
39
62
  end
40
63
 
41
- def scrub(text)
42
- text.gsub(/\s/,"_").split(".").first
43
- end
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
+
44
93
  end
45
94
 
46
- TravisFormatter
95
+ TravisFormatter
metadata CHANGED
@@ -1,75 +1,75 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcpretty-travis-formatter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delisa Mason
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-30 00:00:00.000000000 Z
11
+ date: 2017-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: xcpretty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.2'
20
- - - '>='
20
+ - - ">="
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.0.7
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ~>
27
+ - - "~>"
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0.2'
30
- - - '>='
30
+ - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 0.0.7
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: bundler
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - ~>
37
+ - - "~>"
38
38
  - !ruby/object:Gem::Version
39
39
  version: '1.3'
40
40
  type: :development
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - ~>
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '1.3'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - '>='
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: '0'
54
54
  type: :development
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: '0'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: bacon
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ~>
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '1.2'
68
68
  type: :development
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ~>
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '1.2'
75
75
  description: "\n Formatter for xcpretty customized to provide pretty output on TravisCI\n
@@ -81,10 +81,10 @@ executables:
81
81
  extensions: []
82
82
  extra_rdoc_files: []
83
83
  files:
84
- - README.md
85
84
  - LICENSE
86
- - lib/travis_formatter.rb
85
+ - README.md
87
86
  - bin/xcpretty-travis-formatter
87
+ - lib/travis_formatter.rb
88
88
  homepage: https://github.com/kattrali/xcpretty-travis-formatter
89
89
  licenses:
90
90
  - MIT
@@ -95,17 +95,17 @@ require_paths:
95
95
  - lib
96
96
  required_ruby_version: !ruby/object:Gem::Requirement
97
97
  requirements:
98
- - - ~>
98
+ - - "~>"
99
99
  - !ruby/object:Gem::Version
100
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
107
  rubyforge_project:
108
- rubygems_version: 2.0.14
108
+ rubygems_version: 2.4.5
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: xcpretty custom formatter for TravisCI