xcpretty-bb 0.1.12.bb1

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.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.hound.yml +2 -0
  4. data/.kick +17 -0
  5. data/.rubocop.yml +239 -0
  6. data/.travis.yml +11 -0
  7. data/CHANGELOG.md +200 -0
  8. data/CONTRIBUTING.md +64 -0
  9. data/Gemfile +9 -0
  10. data/LICENSE.txt +61 -0
  11. data/README.md +93 -0
  12. data/Rakefile +26 -0
  13. data/assets/report.html.erb +172 -0
  14. data/bin/xcpretty +85 -0
  15. data/features/assets/RACCommandSpec, line 80, hello xcpretty.png +0 -0
  16. data/features/assets/apple_raw.png +0 -0
  17. data/features/custom_formatter.feature +15 -0
  18. data/features/fixtures/xcodebuild.log +5963 -0
  19. data/features/html_report.feature +54 -0
  20. data/features/json_compilation_database_report.feature +21 -0
  21. data/features/junit_report.feature +44 -0
  22. data/features/knock_format.feature +11 -0
  23. data/features/simple_format.feature +204 -0
  24. data/features/steps/formatting_steps.rb +330 -0
  25. data/features/steps/html_steps.rb +32 -0
  26. data/features/steps/json_steps.rb +37 -0
  27. data/features/steps/junit_steps.rb +39 -0
  28. data/features/steps/report_steps.rb +22 -0
  29. data/features/steps/xcpretty_steps.rb +31 -0
  30. data/features/support/env.rb +117 -0
  31. data/features/tap_format.feature +31 -0
  32. data/features/test_format.feature +49 -0
  33. data/features/xcpretty.feature +14 -0
  34. data/lib/xcpretty/ansi.rb +72 -0
  35. data/lib/xcpretty/formatters/formatter.rb +177 -0
  36. data/lib/xcpretty/formatters/knock.rb +35 -0
  37. data/lib/xcpretty/formatters/rspec.rb +33 -0
  38. data/lib/xcpretty/formatters/simple.rb +200 -0
  39. data/lib/xcpretty/formatters/tap.rb +40 -0
  40. data/lib/xcpretty/parser.rb +591 -0
  41. data/lib/xcpretty/printer.rb +24 -0
  42. data/lib/xcpretty/reporters/html.rb +98 -0
  43. data/lib/xcpretty/reporters/json_compilation_database.rb +62 -0
  44. data/lib/xcpretty/reporters/junit.rb +102 -0
  45. data/lib/xcpretty/snippet.rb +38 -0
  46. data/lib/xcpretty/syntax.rb +51 -0
  47. data/lib/xcpretty/term.rb +14 -0
  48. data/lib/xcpretty/version.rb +4 -0
  49. data/lib/xcpretty.rb +37 -0
  50. data/spec/fixtures/NSStringTests.m +64 -0
  51. data/spec/fixtures/constants.rb +600 -0
  52. data/spec/fixtures/custom_formatter.rb +18 -0
  53. data/spec/fixtures/oneliner.m +1 -0
  54. data/spec/fixtures/raw_kiwi_compilation_fail.txt +24 -0
  55. data/spec/fixtures/raw_kiwi_fail.txt +1896 -0
  56. data/spec/fixtures/raw_specta_fail.txt +3110 -0
  57. data/spec/spec_helper.rb +7 -0
  58. data/spec/support/matchers/colors.rb +21 -0
  59. data/spec/xcpretty/ansi_spec.rb +47 -0
  60. data/spec/xcpretty/formatters/formatter_spec.rb +140 -0
  61. data/spec/xcpretty/formatters/rspec_spec.rb +56 -0
  62. data/spec/xcpretty/formatters/simple_spec.rb +173 -0
  63. data/spec/xcpretty/parser_spec.rb +542 -0
  64. data/spec/xcpretty/printer_spec.rb +55 -0
  65. data/spec/xcpretty/snippet_spec.rb +46 -0
  66. data/spec/xcpretty/syntax_spec.rb +39 -0
  67. data/spec/xcpretty/term_spec.rb +26 -0
  68. data/xcpretty.gemspec +37 -0
  69. metadata +237 -0
@@ -0,0 +1,200 @@
1
+ # encoding: utf-8
2
+ require 'shellwords'
3
+
4
+ module XCPretty
5
+
6
+ class Simple < Formatter
7
+
8
+ PASS = "✓"
9
+ FAIL = "✗"
10
+ PENDING = "⧖"
11
+ COMPLETION = "▸"
12
+ MEASURE = '◷'
13
+
14
+ ASCII_PASS = "."
15
+ ASCII_FAIL = "x"
16
+ ASCII_PENDING = "P"
17
+ ASCII_COMPLETION = ">"
18
+ ASCII_MEASURE = 'T'
19
+
20
+ INDENT = " "
21
+
22
+ def format_analyze(file_name, file_path)
23
+ format("Analyzing", file_name)
24
+ end
25
+
26
+ def format_build_target(target, project, configuration)
27
+ format("Building", "#{project}/#{target} [#{configuration}]")
28
+ end
29
+
30
+ def format_analyze_target(target, project, configuration)
31
+ format("Analyzing", "#{project}/#{target} [#{configuration}]")
32
+ end
33
+
34
+ def format_clean_target(target, project, configuration)
35
+ format("Cleaning", "#{project}/#{target} [#{configuration}]")
36
+ end
37
+
38
+ def format_compile(file_name, file_path)
39
+ format("Compiling", file_name)
40
+ end
41
+
42
+ def format_compile_xib(file_name, file_path)
43
+ format("Compiling", file_name)
44
+ end
45
+
46
+ def format_compile_storyboard(file_name, file_path)
47
+ format("Compiling", file_name)
48
+ end
49
+
50
+ def format_copy_header_file(source, target)
51
+ format("Copying", File.basename(source))
52
+ end
53
+
54
+ def format_copy_plist_file(source, target)
55
+ format("Copying", File.basename(source))
56
+ end
57
+
58
+ def format_copy_strings_file(file)
59
+ format("Copying", file)
60
+ end
61
+
62
+ def format_cpresource(resource)
63
+ format("Copying", resource)
64
+ end
65
+
66
+ def format_generate_dsym(dsym)
67
+ format("Generating '#{dsym}'")
68
+ end
69
+
70
+ def format_libtool(library)
71
+ format("Building library", library)
72
+ end
73
+
74
+ def format_linking(target, build_variants, arch)
75
+ format("Linking", target)
76
+ end
77
+
78
+ def format_failing_test(suite, test_case, reason, file)
79
+ INDENT + format_test("#{test_case}, #{reason}", :fail)
80
+ end
81
+
82
+ def format_passing_test(suite, test_case, time)
83
+ INDENT + format_test("#{test_case} (#{colored_time(time)} seconds)",
84
+ :pass)
85
+ end
86
+
87
+ def format_pending_test(suite, test_case)
88
+ INDENT + format_test("#{test_case} [PENDING]", :pending)
89
+ end
90
+
91
+ def format_measuring_test(suite, test_case, time)
92
+ INDENT + format_test(
93
+ "#{test_case} measured (#{colored_time(time)} seconds)", :measure
94
+ )
95
+ end
96
+
97
+ def format_phase_success(phase_name)
98
+ format(phase_name.capitalize, "Succeeded")
99
+ end
100
+
101
+ def format_phase_script_execution(phase_name)
102
+ format("Running phase", "'#{phase_name}'")
103
+ end
104
+
105
+ def format_phase_script_error(error, text)
106
+ INDENT + red(text)
107
+ end
108
+
109
+ def format_process_info_plist(file_name, file_path)
110
+ format("Processing", file_name)
111
+ end
112
+
113
+ def format_process_pch(file)
114
+ format("Precompiling", file)
115
+ end
116
+
117
+ def format_codesign(file)
118
+ format("Signing", file)
119
+ end
120
+
121
+ def format_preprocess(file)
122
+ format("Preprocessing", file)
123
+ end
124
+
125
+ def format_pbxcp(file)
126
+ format("Copying", file)
127
+ end
128
+
129
+ def format_test_run_started(name)
130
+ heading("Test Suite", name, "started")
131
+ end
132
+
133
+ def format_test_suite_started(name)
134
+ heading("", name, "")
135
+ end
136
+
137
+ def format_touch(file_path, file_name)
138
+ format("Touching", file_name)
139
+ end
140
+
141
+ def format_tiffutil(file_name)
142
+ format("Validating", file_name)
143
+ end
144
+
145
+ def format_warning(message)
146
+ INDENT + yellow(message)
147
+ end
148
+
149
+ def format_check_dependencies
150
+ format('Check Dependencies')
151
+ end
152
+
153
+ private
154
+
155
+ def heading(prefix, text, description)
156
+ [prefix, white(text), description].join(" ").strip
157
+ end
158
+
159
+ def format(command, argument_text="", success=true)
160
+ symbol = status_symbol(success ? :completion : :fail)
161
+ [symbol, white(command), argument_text].join(" ").strip
162
+ end
163
+
164
+ def format_test(test_case, status)
165
+ [status_symbol(status), test_case].join(" ").strip
166
+ end
167
+
168
+ def status_symbol(status)
169
+ case status
170
+ when :pass
171
+ green(use_unicode? ? PASS : ASCII_PASS)
172
+ when :fail
173
+ red(use_unicode? ? FAIL : ASCII_FAIL)
174
+ when :pending
175
+ yellow(use_unicode? ? PENDING : ASCII_PENDING)
176
+ when :error
177
+ red(use_unicode? ? ERROR : ASCII_ERROR)
178
+ when :completion
179
+ yellow(use_unicode? ? COMPLETION : ASCII_COMPLETION)
180
+ when :measure
181
+ yellow(use_unicode? ? MEASURE : ASCII_MEASURE)
182
+ else
183
+ ""
184
+ end
185
+ end
186
+
187
+ def colored_time(time)
188
+ case time.to_f
189
+ when 0..0.025
190
+ time
191
+ when 0.026..0.100
192
+ yellow(time)
193
+ else
194
+ red(time)
195
+ end
196
+ end
197
+
198
+ end
199
+ end
200
+
@@ -0,0 +1,40 @@
1
+ module XCPretty
2
+
3
+ class TestAnything < Knock
4
+
5
+ attr_reader :counter
6
+
7
+ def initialize(unicode, color)
8
+ super
9
+ @counter = 0
10
+ end
11
+
12
+ def format_passing_test(suite, test_case, time)
13
+ increment_counter
14
+ "#{PASS} #{counter} - #{test_case}"
15
+ end
16
+
17
+ def format_failing_test(test_suite, test_case, reason, file)
18
+ increment_counter
19
+ "#{FAIL} #{counter} - #{test_case}" +
20
+ format_failure_diagnostics(test_suite, test_case, reason, file)
21
+ end
22
+
23
+ def format_pending_test(test_suite, test_case)
24
+ increment_counter
25
+ "#{FAIL} #{counter} - #{test_case} # TODO Not written yet"
26
+ end
27
+
28
+ def format_test_summary(executed_message, failures_per_suite)
29
+ counter > 0 ? "1..#{counter}" : ''
30
+ end
31
+
32
+ private
33
+
34
+ def increment_counter
35
+ @counter += 1
36
+ end
37
+ end
38
+
39
+ end
40
+