Class: TravisFormatter
- Inherits:
-
XCPretty::Simple
- Object
- XCPretty::Simple
- TravisFormatter
- Defined in:
- lib/travis_formatter.rb
Instance Method Summary collapse
- #close_fold ⇒ Object
-
#format_analyze(file_name, file_path) ⇒ Object
Analyze.
- #format_analyze_target(target, project, configuration) ⇒ Object
-
#format_build_target(target, project, configuration) ⇒ Object
Build.
-
#format_clean(project, target, configuration) ⇒ Object
Clean.
- #format_clean_remove ⇒ Object
- #format_clean_target(target, project, configuration) ⇒ Object
- #format_compile(file_name, file_path) ⇒ Object
-
#format_compile_error(file_name, file_path, reason, line, cursor) ⇒ Object
Errors and warnings.
- #format_compile_warning(file_name, file_path, reason, line, cursor) ⇒ Object
- #format_duplicate_symbols(message, file_paths) ⇒ Object
- #format_error(message) ⇒ Object
- #format_failing_test(suite, test, reason, file_path) ⇒ Object
- #format_file_missing_error(error, file_path) ⇒ Object
- #format_group(group, track = true) ⇒ Object
- #format_ld_warning(message) ⇒ Object
-
#format_test_run_started(name) ⇒ Object
Test.
- #format_test_suite_started(name) ⇒ Object
- #format_test_summary(message, failures_per_suite) ⇒ Object
- #format_undefined_symbols(message, symbol, reference) ⇒ Object
- #format_warning(message) ⇒ Object
-
#initialize(use_unicode, colorize) ⇒ TravisFormatter
constructor
A new instance of TravisFormatter.
- #open_fold(group, track = true) ⇒ Object
Constructor Details
#initialize(use_unicode, colorize) ⇒ TravisFormatter
Returns a new instance of TravisFormatter.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/travis_formatter.rb', line 4 def initialize (use_unicode, colorize) super @currentGroup = nil @errors = [] @seenGroups = {} @travis = ENV['TRAVIS'].to_s == 'true' @warnings = [] at_exit do # Ensure the last opened fold is closed. close_fold() # Print out any warnings. if !@warnings.compact.empty? open_fold("Warnings") STDOUT.puts @warnings.compact.join("\n") close_fold() end # Print out any errors. if !@errors.compact.empty? open_fold("Errors") STDOUT.puts @errors.compact.join("\n") exit(1) end end end |
Instance Method Details
#close_fold ⇒ Object
49 50 51 52 53 |
# File 'lib/travis_formatter.rb', line 49 def close_fold() return if not @travis or @currentGroup == nil STDOUT.puts "travis_fold:end:#{@currentGroup}\n" @currentGroup = nil end |
#format_analyze(file_name, file_path) ⇒ Object
Analyze.
65 |
# File 'lib/travis_formatter.rb', line 65 def format_analyze(file_name, file_path); open_fold("Analyze"); super; end |
#format_analyze_target(target, project, configuration) ⇒ Object
66 |
# File 'lib/travis_formatter.rb', line 66 def format_analyze_target(target, project, configuration); open_fold("Analyze"); super; end |
#format_build_target(target, project, configuration) ⇒ Object
Build.
69 |
# File 'lib/travis_formatter.rb', line 69 def format_build_target(target, project, configuration); open_fold("Build"); super; end |
#format_clean(project, target, configuration) ⇒ Object
Clean.
73 |
# File 'lib/travis_formatter.rb', line 73 def format_clean(project, target, configuration); open_fold("Clean"); super; end |
#format_clean_remove ⇒ Object
75 |
# File 'lib/travis_formatter.rb', line 75 def format_clean_remove; open_fold("Clean"); super; end |
#format_clean_target(target, project, configuration) ⇒ Object
74 |
# File 'lib/travis_formatter.rb', line 74 def format_clean_target(target, project, configuration); open_fold("Clean"); super; end |
#format_compile(file_name, file_path) ⇒ Object
70 |
# File 'lib/travis_formatter.rb', line 70 def format_compile(file_name, file_path); open_fold("Build"); super; end |
#format_compile_error(file_name, file_path, reason, line, cursor) ⇒ Object
Errors and warnings.
84 |
# File 'lib/travis_formatter.rb', line 84 def format_compile_error(file_name, file_path, reason, line, cursor); @errors.push(super); ""; end |
#format_compile_warning(file_name, file_path, reason, line, cursor) ⇒ Object
91 |
# File 'lib/travis_formatter.rb', line 91 def format_compile_warning(file_name, file_path, reason, line, cursor); @warnings.push(super); ""; end |
#format_duplicate_symbols(message, file_paths) ⇒ Object
89 |
# File 'lib/travis_formatter.rb', line 89 def format_duplicate_symbols(, file_paths); @warnings.push(super); ""; end |
#format_error(message) ⇒ Object
85 |
# File 'lib/travis_formatter.rb', line 85 def format_error(); @errors.push(super); ""; end |
#format_failing_test(suite, test, reason, file_path) ⇒ Object
80 |
# File 'lib/travis_formatter.rb', line 80 def format_failing_test(suite, test, reason, file_path); @errors.push(super); super; end |
#format_file_missing_error(error, file_path) ⇒ Object
86 |
# File 'lib/travis_formatter.rb', line 86 def format_file_missing_error(error, file_path); @errors.push(super); ""; end |
#format_group(group, track = true) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/travis_formatter.rb', line 31 def format_group(group, track = true) group = group.downcase.gsub(/[^a-z\d\-_.]+/, '-').gsub(/-$/, '') i = 1 parts = group.split('.') if parts.last =~ /^\d+$/ last = parts.pop() i = last ? last.to_i : 1 group = parts.join('.') end if track && @currentGroup != "#{group}.#{i}" && @seenGroups.has_key?(group) i = @seenGroups[group] + 1 end @seenGroups[group] = i "#{group}.#{i}" end |
#format_ld_warning(message) ⇒ Object
87 |
# File 'lib/travis_formatter.rb', line 87 def format_ld_warning(); @warnings.push(super); ""; end |
#format_test_run_started(name) ⇒ Object
Test.
78 |
# File 'lib/travis_formatter.rb', line 78 def format_test_run_started(name); open_fold("Test"); super; end |
#format_test_suite_started(name) ⇒ Object
79 |
# File 'lib/travis_formatter.rb', line 79 def format_test_suite_started(name); open_fold("Test"); super; end |
#format_test_summary(message, failures_per_suite) ⇒ Object
81 |
# File 'lib/travis_formatter.rb', line 81 def format_test_summary(, failures_per_suite); @errors.concat(failures_per_suite.values); super; end |
#format_undefined_symbols(message, symbol, reference) ⇒ Object
88 |
# File 'lib/travis_formatter.rb', line 88 def format_undefined_symbols(, symbol, reference); @warnings.push(super); ""; end |
#format_warning(message) ⇒ Object
90 |
# File 'lib/travis_formatter.rb', line 90 def format_warning(); @warnings.push(super); ""; end |
#open_fold(group, track = true) ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/travis_formatter.rb', line 55 def open_fold(group, track = true) description = group group = format_group(group, track) return if @currentGroup == group or not @travis close_fold() if @currentGroup != nil @currentGroup = group STDOUT.puts "travis_fold:start:#{group}\033[33;1m#{description}\033[0m\n" end |