xcpretty 0.1.12 → 0.2.0

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/.hound.yml +2 -10
  3. data/.rubocop.yml +239 -0
  4. data/.travis.yml +1 -8
  5. data/CHANGELOG.md +35 -0
  6. data/Gemfile +1 -0
  7. data/README.md +23 -76
  8. data/Rakefile +10 -8
  9. data/bin/xcpretty +14 -14
  10. data/features/simple_format.feature +39 -17
  11. data/features/steps/formatting_steps.rb +33 -4
  12. data/features/steps/html_steps.rb +1 -0
  13. data/features/steps/json_steps.rb +2 -1
  14. data/features/steps/junit_steps.rb +4 -3
  15. data/features/steps/report_steps.rb +1 -0
  16. data/features/support/env.rb +4 -3
  17. data/features/test_format.feature +4 -4
  18. data/lib/xcpretty/ansi.rb +14 -13
  19. data/lib/xcpretty/formatters/formatter.rb +24 -8
  20. data/lib/xcpretty/formatters/knock.rb +2 -1
  21. data/lib/xcpretty/formatters/rspec.rb +1 -0
  22. data/lib/xcpretty/formatters/simple.rb +18 -3
  23. data/lib/xcpretty/formatters/tap.rb +3 -2
  24. data/lib/xcpretty/parser.rb +38 -15
  25. data/lib/xcpretty/printer.rb +1 -0
  26. data/lib/xcpretty/reporters/html.rb +7 -5
  27. data/lib/xcpretty/reporters/json_compilation_database.rb +6 -10
  28. data/lib/xcpretty/reporters/junit.rb +6 -3
  29. data/lib/xcpretty/snippet.rb +0 -2
  30. data/lib/xcpretty/syntax.rb +38 -31
  31. data/lib/xcpretty/term.rb +14 -0
  32. data/lib/xcpretty/version.rb +2 -1
  33. data/lib/xcpretty.rb +5 -6
  34. data/spec/fixtures/constants.rb +15 -2
  35. data/spec/fixtures/custom_formatter.rb +2 -1
  36. data/spec/spec_helper.rb +2 -1
  37. data/spec/support/matchers/colors.rb +1 -0
  38. data/spec/xcpretty/ansi_spec.rb +1 -0
  39. data/spec/xcpretty/formatters/formatter_spec.rb +27 -16
  40. data/spec/xcpretty/formatters/rspec_spec.rb +1 -0
  41. data/spec/xcpretty/formatters/simple_spec.rb +22 -3
  42. data/spec/xcpretty/parser_spec.rb +39 -10
  43. data/spec/xcpretty/printer_spec.rb +15 -13
  44. data/spec/xcpretty/syntax_spec.rb +24 -48
  45. data/spec/xcpretty/term_spec.rb +26 -0
  46. data/xcpretty.gemspec +15 -11
  47. metadata +42 -14
  48. data/vendor/json_pure/COPYING +0 -57
  49. data/vendor/json_pure/LICENSE +0 -340
  50. data/vendor/json_pure/generator.rb +0 -443
  51. data/vendor/json_pure/parser.rb +0 -364
@@ -61,6 +61,11 @@ module XCPretty
61
61
  # $2 file_name (e.g. MainMenu.xib)
62
62
  COMPILE_XIB_MATCHER = /^CompileXIB\s(.*\/(.*\.xib))/
63
63
 
64
+ # @regex Captured groups
65
+ # $1 file_path
66
+ # $2 file_name (e.g. Main.storyboard)
67
+ COMPILE_STORYBOARD_MATCHER = /^CompileStoryboard\s(.*\/([^\/].*\.storyboard))/
68
+
64
69
  # @regex Captured groups
65
70
  # $1 source file
66
71
  # $2 target file
@@ -120,6 +125,8 @@ module XCPretty
120
125
  # $3 = time
121
126
  MEASURING_TEST_MATCHER = /^[^:]*:[^:]*:\sTest Case\s'-\[(.*)\s(.*)\]'\smeasured\s\[Time,\sseconds\]\saverage:\s(\d*\.\d{3}),/
122
127
 
128
+ PHASE_SUCCESS_MATCHER = /^\*\*\s(.*)\sSUCCEEDED\s\*\*/
129
+
123
130
  # @regex Captured groups
124
131
  # $1 = script_name
125
132
  PHASE_SCRIPT_EXECUTION_MATCHER = /^PhaseScriptExecution\s(.*)\s\//
@@ -165,7 +172,7 @@ module XCPretty
165
172
  # @regex Captured groups
166
173
  # $1 file_path
167
174
  # $2 file_name
168
- TOUCH_MATCHER = /^Touch\s(.*\/([\w+\.]+))/
175
+ TOUCH_MATCHER = /^Touch\s(.*\/(.+))/
169
176
 
170
177
  # @regex Captured groups
171
178
  # $1 file_path
@@ -180,6 +187,10 @@ module XCPretty
180
187
  # $3 = reason
181
188
  COMPILE_WARNING_MATCHER = /^(\/.+\/(.*):.*:.*):\swarning:\s(.*)$/
182
189
 
190
+ # $1 = ld prefix
191
+ # $2 = warning message
192
+ LD_WARNING_MATCHER = /^(ld: )warning: (.*)/
193
+
183
194
  # @regex Captured groups
184
195
  # $1 = whole warning
185
196
  GENERIC_WARNING_MATCHER = /^warning:\s(.*)$/
@@ -206,9 +217,14 @@ module XCPretty
206
217
 
207
218
  # @regex Captured groups
208
219
  # $1 = whole error.
209
- # it varies a lot, not sure if it makes sense to catch everything separately
220
+ # it varies a lot, not sure if it makes sense to catch everything separately
210
221
  FATAL_ERROR_MATCHER = /^(fatal error:.*)$/
211
222
 
223
+ # @regex Captured groups
224
+ # $1 = whole error.
225
+ # $2 = file path
226
+ FILE_MISSING_ERROR_MATCHER = /^<unknown>:0:\s(error:\s.*)\s'(\/.+\/.*\..*)'$/
227
+
212
228
  # $1 = whole error
213
229
  LD_ERROR_MATCHER = /^(ld:.*)/
214
230
 
@@ -229,7 +245,8 @@ module XCPretty
229
245
  LINKER_UNDEFINED_SYMBOLS_MATCHER = /^(Undefined symbols for architecture .*):$/
230
246
 
231
247
  # @regex Captured groups
232
- PODS_ERROR_MATCHER = /^error:\s(.*)/
248
+ # $1 reason
249
+ PODS_ERROR_MATCHER = /^(error:\s.*)/
233
250
 
234
251
  # @regex Captured groups
235
252
  # $1 = reference
@@ -288,6 +305,8 @@ module XCPretty
288
305
  formatter.format_compile_command($1, $2)
289
306
  when COMPILE_XIB_MATCHER
290
307
  formatter.format_compile_xib($2, $1)
308
+ when COMPILE_STORYBOARD_MATCHER
309
+ formatter.format_compile_storyboard($2, $1)
291
310
  when COPY_HEADER_MATCHER
292
311
  formatter.format_copy_header_file($1, $2)
293
312
  when COPY_PLIST_MATCHER
@@ -300,8 +319,12 @@ module XCPretty
300
319
  formatter.format_failing_test($2, $3, $4, $1)
301
320
  when FATAL_ERROR_MATCHER
302
321
  formatter.format_error($1)
322
+ when FILE_MISSING_ERROR_MATCHER
323
+ formatter.format_file_missing_error($1, $2)
303
324
  when GENERATE_DSYM_MATCHER
304
325
  formatter.format_generate_dsym($1)
326
+ when LD_WARNING_MATCHER
327
+ formatter.format_ld_warning($1 + $2)
305
328
  when LD_ERROR_MATCHER
306
329
  formatter.format_error($1)
307
330
  when LIBTOOL_MATCHER
@@ -320,10 +343,12 @@ module XCPretty
320
343
  formatter.format_process_info_plist(*unescaped($2, $1))
321
344
  when PHASE_SCRIPT_EXECUTION_MATCHER
322
345
  formatter.format_phase_script_execution(*unescaped($1))
346
+ when PHASE_SUCCESS_MATCHER
347
+ formatter.format_phase_success($1)
323
348
  when PROCESS_PCH_MATCHER
324
349
  formatter.format_process_pch($1)
325
- when PROCESS_PCH_COMMAND_MATCHER
326
- formatter.format_process_pch_command($1)
350
+ when PROCESS_PCH_COMMAND_MATCHER
351
+ formatter.format_process_pch_command($1)
327
352
  when PREPROCESS_MATCHER
328
353
  formatter.format_preprocess($1)
329
354
  when PBXCP_MATCHER
@@ -419,14 +444,11 @@ module XCPretty
419
444
  end
420
445
 
421
446
  def should_format_undefined_symbols?
422
- current_linker_failure[:message] &&
423
- current_linker_failure[:symbol] &&
424
- current_linker_failure[:reference]
447
+ current_linker_failure[:message] && current_linker_failure[:symbol] && current_linker_failure[:reference]
425
448
  end
426
449
 
427
450
  def should_format_duplicate_symbols?
428
- current_linker_failure[:message] &&
429
- current_linker_failure[:files].count > 1
451
+ current_linker_failure[:message] && current_linker_failure[:files].count > 1
430
452
  end
431
453
 
432
454
  def current_issue
@@ -434,7 +456,7 @@ module XCPretty
434
456
  end
435
457
 
436
458
  def current_linker_failure
437
- @linker_failure ||= { :files => [] }
459
+ @linker_failure ||= {files: []}
438
460
  end
439
461
 
440
462
  def format_compile_error
@@ -486,9 +508,9 @@ module XCPretty
486
508
  def store_failure(file, test_suite, test_case, reason)
487
509
  failures_per_suite[test_suite] ||= []
488
510
  failures_per_suite[test_suite] << {
489
- :file_path => file,
490
- :reason => reason,
491
- :test_case => test_case
511
+ file_path: file,
512
+ reason: reason,
513
+ test_case: test_case
492
514
  }
493
515
  end
494
516
 
@@ -508,8 +530,9 @@ module XCPretty
508
530
  end
509
531
 
510
532
  def unescaped(*escaped_values)
511
- escaped_values.map { |v| v.gsub('\\', '') }
533
+ escaped_values.map { |v| v.delete('\\') }
512
534
  end
513
535
 
514
536
  end
515
537
  end
538
+
@@ -21,3 +21,4 @@ module XCPretty
21
21
 
22
22
  end
23
23
  end
24
+
@@ -30,12 +30,13 @@ module XCPretty
30
30
  end
31
31
 
32
32
  def format_failing_test(suite, test_case, reason, file)
33
- add_test(suite, {:name => test_case, :failing => true,
34
- :reason => reason, :file => file, :snippet => formatted_snippet(file)})
33
+ add_test(suite, name: test_case, failing: true,
34
+ reason: reason, file: file,
35
+ snippet: formatted_snippet(file))
35
36
  end
36
37
 
37
38
  def format_passing_test(suite, test_case, time)
38
- add_test(suite, {:name => test_case, :time => time})
39
+ add_test(suite, name: test_case, time: time)
39
40
  end
40
41
 
41
42
  def finish
@@ -47,13 +48,13 @@ module XCPretty
47
48
 
48
49
  def formatted_snippet(filepath)
49
50
  snippet = Snippet.from_filepath(filepath)
50
- Syntax.highlight(snippet, "-f html -O style=colorful -O noclasses")
51
+ Syntax.highlight(snippet)
51
52
  end
52
53
 
53
54
 
54
55
  def add_test(suite_name, data)
55
56
  @test_count += 1
56
- @test_suites[suite_name] ||= {:tests => [], :screenshots => []}
57
+ @test_suites[suite_name] ||= {tests: [], screenshots: []}
57
58
  @test_suites[suite_name][:tests] << data
58
59
  if data[:failing]
59
60
  @test_suites[suite_name][:failing] = true
@@ -94,3 +95,4 @@ module XCPretty
94
95
  end
95
96
  end
96
97
  end
98
+
@@ -8,13 +8,7 @@ module XCPretty
8
8
  unless @@loaded ||= false
9
9
  require 'fileutils'
10
10
  require 'pathname'
11
- unless Object.const_defined?(:JSON)
12
- begin
13
- require 'json'
14
- rescue LoadError
15
- require File.expand_path(File.join(File.dirname(__FILE__), '../../../vendor/json_pure/generator'))
16
- end
17
- end
11
+ require 'json'
18
12
  @@loaded = true
19
13
  end
20
14
  end
@@ -45,9 +39,10 @@ module XCPretty
45
39
  def format_compile_command(compiler_command, file_path)
46
40
  directory = file_path.gsub("#{@current_path}", '').gsub(/\/$/, '')
47
41
  directory = '/' if directory.empty?
48
- @compilation_units << {:command => compiler_command.gsub(/(\-include)\s.*\.pch/, "\\1 #{@pch_path}"),
49
- :file => @current_path,
50
- :directory => directory}
42
+ cmd = compiler_command.gsub(/(\-include)\s.*\.pch/, "\\1 #{@pch_path}")
43
+ @compilation_units << {command: cmd,
44
+ file: @current_path,
45
+ directory: directory}
51
46
  end
52
47
 
53
48
  def finish
@@ -64,3 +59,4 @@ module XCPretty
64
59
  end
65
60
  end
66
61
  end
62
+
@@ -19,9 +19,9 @@ module XCPretty
19
19
  @filepath = options[:path] || FILEPATH
20
20
  @directory = `pwd`.strip
21
21
  @document = REXML::Document.new
22
- @document << REXML::XMLDecl.new('1.0','UTF-8')
22
+ @document << REXML::XMLDecl.new('1.0', 'UTF-8')
23
23
  @document.add_element('testsuites')
24
- @parser = Parser.new(self)
24
+ @parser = Parser.new(self)
25
25
  @total_tests = 0
26
26
  @total_fails = 0
27
27
  end
@@ -77,7 +77,9 @@ module XCPretty
77
77
  end
78
78
 
79
79
  def suite(classname)
80
- return @last_suite if @last_suite && @last_suite.attributes['name'] == classname
80
+ if @last_suite && @last_suite.attributes['name'] == classname
81
+ return @last_suite
82
+ end
81
83
 
82
84
  set_test_counters
83
85
  @last_suite = @document.root.add_element('testsuite')
@@ -97,3 +99,4 @@ module XCPretty
97
99
  end
98
100
  end
99
101
  end
102
+
@@ -20,8 +20,6 @@ module XCPretty
20
20
  end
21
21
 
22
22
 
23
- private
24
-
25
23
  def self.read_snippet(file, around_line)
26
24
  text = ''
27
25
  starting_position = around_line.to_i - 2
@@ -1,44 +1,51 @@
1
+ begin
2
+ require 'rouge'
3
+ rescue LoadError
4
+ # rubocop:disable Style/ConstantName
5
+ Rouge = nil
6
+ # rubocop:enable Style/ConstantName
7
+ end
8
+
1
9
  require 'xcpretty/snippet'
2
10
 
3
11
  module XCPretty
4
- class Syntax
5
- def self.register_filetype(type, extensions)
6
- @filetypes ||= {}
7
- extensions.each { |ext| @filetypes[ext] = type }
8
- end
12
+ module Syntax
13
+ def self.highlight(snippet)
14
+ return snippet.contents unless Rouge
9
15
 
10
- register_filetype 'c++', ['.cpp', '.hpp', '.c++', '.cxx', '.cc']
11
- register_filetype 'objc', ['.m', '.h']
12
- register_filetype 'objc++', ['.mm', '.hh']
13
- register_filetype 'swift', ['.swift']
14
- register_filetype 'dylan', ['.dyl', '.dylan']
15
- register_filetype 'ruby', ['.ruby', '.rb']
16
+ if snippet.file_path.include?(':')
17
+ filename = snippet.file_path.rpartition(':').first
18
+ else
19
+ filename = snippet.file_path
20
+ end
16
21
 
17
- def self.highlight(snippet, options = '')
18
- if Pygments.available?
19
- language = file_language(File.basename(snippet.file_path))
20
- Pygments.pygmentize(snippet.contents, language, options)
22
+ lexer = find_lexer(filename, snippet.contents)
23
+ if lexer
24
+ formatter = Rouge::Formatters::Terminal256.new
25
+ formatter.format(lexer.lex(snippet.contents))
21
26
  else
22
27
  snippet.contents
23
28
  end
24
29
  end
25
30
 
26
- private
27
-
28
- def self.file_language(filename)
29
- ext = File.extname(filename)
30
- @filetypes[ext] || 'objc'
31
- end
32
- end
33
-
34
- class Pygments
35
- def self.pygmentize(code, language, options)
36
- `echo '#{code}' | pygmentize -f 256 -l #{language} #{options if options}`
37
- end
38
-
39
- def self.available?
40
- @available = system('which pygmentize > /dev/null') if @available.nil?
41
- @available
31
+ # @param [String] filename The filename
32
+ # @param [String] contents The contents of the file
33
+ # @return [Rouge::Lexer]
34
+ def self.find_lexer(filename, contents)
35
+ case File.extname(filename)
36
+ when '.cpp', '.cc', '.c++', '.cxx', '.hpp', '.h++', '.hxx'
37
+ Rouge::Lexers::Cpp
38
+ when '.m', '.h' then Rouge::Lexers::ObjectiveC
39
+ when '.swift' then Rouge::Lexers::Swift
40
+ when '.ruby', '.rb' then Rouge::Lexers::Ruby
41
+ else
42
+ options = {
43
+ filename: File.basename(filename),
44
+ source: contents
45
+ }
46
+ Rouge::Lexer.guesses(options).first
47
+ end
42
48
  end
43
49
  end
44
50
  end
51
+
@@ -0,0 +1,14 @@
1
+
2
+ module XCPretty
3
+ module Term
4
+
5
+ def self.unicode?
6
+ Encoding.default_external == Encoding::UTF_8
7
+ end
8
+
9
+ def self.color?
10
+ STDOUT.tty?
11
+ end
12
+ end
13
+ end
14
+
@@ -1,3 +1,4 @@
1
1
  module XCPretty
2
- VERSION = "0.1.12"
2
+ VERSION = "0.2.0"
3
3
  end
4
+
data/lib/xcpretty.rb CHANGED
@@ -2,6 +2,7 @@ require 'xcpretty/version'
2
2
  require 'xcpretty/printer'
3
3
  require 'xcpretty/syntax'
4
4
  require 'xcpretty/snippet'
5
+ require 'xcpretty/term'
5
6
  require 'xcpretty/formatters/formatter'
6
7
  require 'xcpretty/formatters/simple'
7
8
  require 'xcpretty/formatters/rspec'
@@ -21,12 +22,10 @@ module XCPretty
21
22
  end
22
23
 
23
24
  def self.load_custom_formatter(path)
24
- begin
25
- $:.unshift File.dirname(path)
26
- class_from_path(path)
27
- rescue SyntaxError => e
28
- exit_with_error("Expected formatter source file to return a class. #{e}")
29
- end
25
+ $LOAD_PATH.unshift File.dirname(path)
26
+ class_from_path(path)
27
+ rescue SyntaxError => e
28
+ exit_with_error("Expected formatter source file to return a class. #{e}")
30
29
  end
31
30
 
32
31
  def self.exit_with_error(message)
@@ -25,6 +25,8 @@ SAMPLE_BUILD = "=== BUILD TARGET The Spacer OF PROJECT Pods WITH THE DEFAULT CON
25
25
  SAMPLE_ANALYZE_TARGET = "=== ANALYZE TARGET The Spacer OF PROJECT Pods WITH THE DEFAULT CONFIGURATION Debug ==="
26
26
  SAMPLE_CLEAN = "=== CLEAN TARGET Pods-ObjectiveSugar OF PROJECT Pods WITH CONFIGURATION Debug ==="
27
27
  SAMPLE_ANOTHER_CLEAN = "=== CLEAN TARGET Pods OF PROJECT Pods WITH CONFIGURATION Debug ==="
28
+ SAMPLE_BUILD_SUCCEEDED = "** BUILD SUCCEEDED **"
29
+ SAMPLE_CLEAN_SUCCEEDED = "** CLEAN SUCCEEDED **"
28
30
  SAMPLE_CLEAN_REMOVE = %Q(
29
31
  Clean.Remove clean /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Intermediates/ObjectiveSugar.build/Debug-iphonesimulator/ObjectiveSugarTests.build
30
32
  builtin-rm -rf /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Intermediates/ObjectiveSugar.build/Debug-iphonesimulator/ObjectiveSugarTests.build
@@ -109,9 +111,9 @@ GenerateDSYMFile /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSuga
109
111
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Products/Debug-iphonesimulator/ObjectiveSugarTests.octest/ObjectiveSugarTests -o /Users/musalj/Library/Developer/Xcode/DerivedData/ObjectiveSugar-ayzdhqmmwtqgysdpznmovjlupqjy/Build/Products/Debug-iphonesimulator/ObjectiveSugarTests.octest.dSYM
110
112
  )
111
113
  SAMPLE_TOUCH = %Q(
112
- Touch /Users/musalj/Library/Developer/Xcode/DerivedData/Alcatraz-aobuxcinaqyzjugrnxjjhfzgwaou/Build/Products/Debug/AlcatrazTests.octest
114
+ Touch /Users/musalj/Library/Developer/Xcode/DerivedData/Alcatraz-aobuxcinaqyzjugrnxjjhfzgwaou/Build/Products/Debug/Alcatraz\ Tests.octest
113
115
  cd /Users/musalj/code/OSS/Alcatraz
114
- /usr/bin/touch -c /Users/musalj/Library/Developer/Xcode/DerivedData/Alcatraz-aobuxcinaqyzjugrnxjjhfzgwaou/Build/Products/Debug/AlcatrazTests.octest
116
+ /usr/bin/touch -c /Users/musalj/Library/Developer/Xcode/DerivedData/Alcatraz-aobuxcinaqyzjugrnxjjhfzgwaou/Build/Products/Debug/Alcatraz\ Tests.octest
115
117
  )
116
118
 
117
119
  SAMPLE_WRITE_FILE = %Q(
@@ -477,6 +479,12 @@ CompileXIB CocoaChip/en.lproj/MainMenu.xib
477
479
  setenv XCODE_DEVELOPER_USR_PATH /Applications/Xcode.app/Contents/Developer/usr/bin/..
478
480
  /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --errors --warnings --notices --minimum-deployment-target 10.7 --output-format human-readable-text --compile /Users/dustin/Source/CocoaChip/build/Release/CocoaChip.app/Contents/Resources/en.lproj/MainMenu.nib /Users/dustin/Source/CocoaChip/CocoaChip/en.lproj/MainMenu.xib
479
481
  )
482
+ SAMPLE_COMPILE_STORYBOARD = %Q(
483
+ CompileStoryboard sample/Main.storyboard
484
+ cd /Users/chipp/Developer/sample
485
+ export XCODE_DEVELOPER_USR_PATH=/Applications/Xcode.app/Contents/Developer/usr/bin/..
486
+ /Applications/Xcode.app/Contents/Developer/usr/bin/ibtool --target-device iphone --target-device ipad --errors --warnings --notices --module sample --minimum-deployment-target 7.0 --output-partial-info-plist /Users/chipp/Library/Developer/Xcode/DerivedData/sample-etjztiverddwaddrudeteewjzfxw/Build/Intermediates/ArchiveIntermediates/sample/IntermediateBuildFilesPath/sample.build/Release-iphoneos/sample.build/SJMetroPickerStoryboard-SBPartialInfo.plist --auto-activate-custom-fonts --output-format human-readable-text --compilation-directory /Users/chipp/Library/Developer/Xcode/DerivedData/sample-etjztiverddwaddrudeteewjzfxw/Build/Intermediates/ArchiveIntermediates/sample/InstallationBuildProductsLocation/Applications/sample.app /Users/chipp/Developer/sample/sample/Main.storyboard
487
+ )
480
488
  SAMPLE_CODESIGN = %Q(
481
489
  CodeSign build/Release/CocoaChip.app
482
490
  cd /Users/dustin/Source/CocoaChip
@@ -518,6 +526,10 @@ SAMPLE_COMPILE_ERROR = %Q(
518
526
  ^
519
527
  )
520
528
 
529
+ SAMPLE_FILE_MISSING_ERROR = %Q(
530
+ <unknown>:0: error: no such file or directory: '/Users/travis/build/supermarin/project/Classes/Class + Category/Two Words/MissingViewController.swift'
531
+ )
532
+
521
533
  SAMPLE_CODESIGN_ERROR = %Q(
522
534
  Code Sign error: No code signing identites found: No valid signing identities (i.e. certificate and private key pair) matching the team ID ‚ÄúCAT6HF57NJ‚Äù were found.
523
535
  )
@@ -585,3 +597,4 @@ SAMPLE_FORMAT_WARNING = %Q(
585
597
  %d
586
598
  1 warning generated.
587
599
  )
600
+
@@ -14,4 +14,5 @@ class EmojiFormatter < XCPretty::Formatter
14
14
  end
15
15
  end
16
16
 
17
- EmojiFormatter
17
+ EmojiFormatter
18
+
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
- $:.unshift('.', __FILE__)
1
+ $LOAD_PATH.unshift('.', __FILE__)
2
2
  require "lib/xcpretty/ansi"
3
3
  require "support/matchers/colors"
4
4
  require "fixtures/constants"
5
5
 
6
6
  include XCPretty::ANSI
7
+
@@ -18,3 +18,4 @@ RSpec::Matchers.define :be_colored do |expected|
18
18
  "expected that #{strip(actual)} would not be colored #{expected}, but was #{effects_string(actual)}"
19
19
  end
20
20
  end
21
+
@@ -44,3 +44,4 @@ module XCPretty
44
44
  end
45
45
  end
46
46
  end
47
+
@@ -25,7 +25,7 @@ module XCPretty
25
25
 
26
26
  it "formats cocoapods errors" do
27
27
  @formatter.format_error("The sandbox is not in sync...").should ==
28
- "\n#{@formatter.red(" The sandbox is not in sync...")}\n\n"
28
+ "\n#{@formatter.red(" The sandbox is not in sync...")}\n\n"
29
29
  end
30
30
 
31
31
  it "formats compiling errors" do
@@ -33,7 +33,7 @@ module XCPretty
33
33
  "[a should",
34
34
  " ^").should ==
35
35
  %Q(
36
- #{@formatter.red(' ')}path/to/file: #{@formatter.red("expected valid syntax")}
36
+ #{@formatter.red(' ')}path/to/file: #{@formatter.red("expected valid syntax")}
37
37
 
38
38
  [a should
39
39
  #{@formatter.cyan(" ^")}
@@ -41,10 +41,18 @@ module XCPretty
41
41
  )
42
42
  end
43
43
 
44
+ it "formats file missing errors" do
45
+ @formatter.format_file_missing_error("error: no such file or directory:",
46
+ "/path/to/file.swift").should ==
47
+ "\n#{@formatter.red(
48
+ '❌ error: no such file or directory:'
49
+ )} /path/to/file.swift\n\n"
50
+ end
51
+
44
52
  it "formats compiling warnings" do
45
53
  reason = "format specifies type 'id' but the argument has type 'int' [-Wformat]"
46
54
 
47
- @formatter.format_compile_warning( "file", "path/to/file", reason,
55
+ @formatter.format_compile_warning("file", "path/to/file", reason,
48
56
  %Q( NSLog(@"alsdkflsakdj %@", 1);),
49
57
  %Q( ~~ ^)).should ==
50
58
 
@@ -57,11 +65,16 @@ module XCPretty
57
65
  )
58
66
  end
59
67
 
68
+ it "formats linker warnings" do
69
+ @formatter.format_ld_warning("ld: embedded dylibs/frameworks only run on iOS 8 or later").should ==
70
+ "#{@formatter.yellow("⚠️ ld: embedded dylibs/frameworks only run on iOS 8 or later")}"
71
+ end
72
+
60
73
  it "formats linker undefined symbols by default" do
61
74
  @formatter.format_undefined_symbols("Undefined symbols for architecture x86_64",
62
75
  '_OBJC_CLASS_$_CABasicAnimation',
63
76
  'objc-class-ref in ATZRadialProgressControl.o').should == %Q(
64
- #{@formatter.red(" Undefined symbols for architecture x86_64")}
77
+ #{@formatter.red(" Undefined symbols for architecture x86_64")}
65
78
  > Symbol: _OBJC_CLASS_$_CABasicAnimation
66
79
  > Referenced from: objc-class-ref in ATZRadialProgressControl.o
67
80
 
@@ -72,15 +85,14 @@ module XCPretty
72
85
  @formatter.format_duplicate_symbols("duplicate symbol _OBJC_IVAR_$ClassName._ivarName in",
73
86
  ['/Users/username/Library/Developer/Xcode/DerivedData/App-arcyyktezaigixbocjwfhsjllojz/Build/Intermediates/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/ClassName.o',
74
87
  '/Users/username/Library/Developer/Xcode/DerivedData/App-arcyyktezaigixbocjwfhsjllojz/Build/Products/Debug-iphonesimulator/libPods.a(DuplicateClassName.o)']).should == %Q(
75
- #{@formatter.red(" duplicate symbol _OBJC_IVAR_$ClassName._ivarName in")}
88
+ #{@formatter.red(" duplicate symbol _OBJC_IVAR_$ClassName._ivarName in")}
76
89
  > ClassName.o
77
90
  > libPods.a(DuplicateClassName.o)
78
91
  )
79
92
  end
80
93
 
81
94
 
82
- if RUBY_VERSION > '1.8.7'
83
- it "formats failures per suite" do
95
+ it "formats failures per suite" do
84
96
  Syntax.stub(:highlight) { |snippet| snippet.contents }
85
97
 
86
98
  first_path = File.expand_path('spec/fixtures/NSStringTests.m:46')
@@ -89,15 +101,15 @@ module XCPretty
89
101
  failures = {
90
102
  'CarSpec' => [
91
103
  {
92
- :file_path => first_path,
93
- :reason => "just doesn't work",
94
- :test_case => 'Starting the car'
104
+ file_path: first_path,
105
+ reason: "just doesn't work",
106
+ test_case: 'Starting the car'
95
107
  }],
96
108
  'StringSpec' => [
97
109
  {
98
- :file_path => second_path,
99
- :reason => "doesn't split",
100
- :test_case => 'Splitting the string'
110
+ file_path: second_path,
111
+ reason: "doesn't split",
112
+ test_case: 'Splitting the string'
101
113
  }]
102
114
  }
103
115
  @formatter.format_test_summary(SAMPLE_EXECUTED_TESTS, failures).should == %Q(
@@ -122,8 +134,7 @@ StringSpec
122
134
 
123
135
 
124
136
  #{@formatter.red(SAMPLE_EXECUTED_TESTS)})
125
- end
126
- end # only ruby 1.9 above because of ordered hashes
127
-
137
+ end
128
138
  end
129
139
  end
140
+
@@ -53,3 +53,4 @@ module XCPretty
53
53
  end
54
54
  end
55
55
  end
56
+
@@ -45,14 +45,19 @@ module XCPretty
45
45
  "> Compiling MainMenu.xib"
46
46
  end
47
47
 
48
+ it "formats compiling storyboard output" do
49
+ @formatter.format_compile_xib("Main.storyboard", 'path/to/file').should ==
50
+ "> Compiling Main.storyboard"
51
+ end
52
+
48
53
  it 'formats copying header files' do
49
54
  @formatter.format_copy_header_file('Source.h',
50
- 'dir/Destination.h').should == '> Copying Source.h'
55
+ 'dir/Destination.h').should == '> Copying Source.h'
51
56
  end
52
57
 
53
58
  it 'formats copying plist files' do
54
59
  @formatter.format_copy_plist_file("Source.plist",
55
- 'dir/Destination.plist').should == '> Copying Source.plist'
60
+ 'dir/Destination.plist').should == '> Copying Source.plist'
56
61
  end
57
62
 
58
63
  it "formats copy resource" do
@@ -105,6 +110,14 @@ module XCPretty
105
110
  " T _tupleByAddingObject__should_add_a_non_nil_object measured (0.001 seconds)"
106
111
  end
107
112
 
113
+ it "formats build success output" do
114
+ @formatter.format_phase_success("BUILD").should == "> Build Succeeded"
115
+ end
116
+
117
+ it "formats clean success output" do
118
+ @formatter.format_phase_success("CLEAN").should == "> Clean Succeeded"
119
+ end
120
+
108
121
  it "formats Phase Script Execution" do
109
122
  @formatter.format_phase_script_execution("Check Pods Manifest.lock").should ==
110
123
  "> Running script 'Check Pods Manifest.lock'"
@@ -141,7 +154,7 @@ module XCPretty
141
154
  end
142
155
 
143
156
  it "formats Touch" do
144
- @formatter.format_touch("/path/to/SomeFile.txt","SomeFile.txt").should ==
157
+ @formatter.format_touch("/path/to/SomeFile.txt", "SomeFile.txt").should ==
145
158
  "> Touching SomeFile.txt"
146
159
  end
147
160
 
@@ -150,5 +163,11 @@ module XCPretty
150
163
  "> Validating unbelievable.tiff"
151
164
  end
152
165
 
166
+ it 'formats Check Dependencies' do
167
+ @formatter.format_check_dependencies.should ==
168
+ '> Check Dependencies'
169
+ end
170
+
153
171
  end
154
172
  end
173
+