xcpretty 0.0.6 → 0.0.7

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 (43) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +3 -1
  4. data/CHANGELOG.md +24 -0
  5. data/README.md +3 -1
  6. data/Rakefile +6 -1
  7. data/bin/xcpretty +51 -16
  8. data/features/custom_formatter.feature +15 -0
  9. data/features/junit_report.feature +9 -1
  10. data/features/simple_format.feature +68 -4
  11. data/features/steps/formatting_steps.rb +87 -4
  12. data/features/steps/junit_steps.rb +18 -6
  13. data/features/steps/xcpretty_steps.rb +7 -0
  14. data/features/support/env.rb +18 -15
  15. data/features/test_format.feature +1 -0
  16. data/features/xcpretty.feature +12 -0
  17. data/lib/xcpretty.rb +25 -3
  18. data/lib/xcpretty/ansi.rb +1 -0
  19. data/lib/xcpretty/formatters/formatter.rb +90 -0
  20. data/lib/xcpretty/formatters/rspec.rb +22 -0
  21. data/lib/xcpretty/formatters/simple.rb +137 -0
  22. data/lib/xcpretty/parser.rb +283 -0
  23. data/lib/xcpretty/printer.rb +7 -112
  24. data/lib/xcpretty/reporters/junit.rb +53 -45
  25. data/lib/xcpretty/syntax.rb +22 -0
  26. data/lib/xcpretty/version.rb +1 -1
  27. data/spec/fixtures/constants.rb +63 -15
  28. data/spec/fixtures/custom_formatter.rb +17 -0
  29. data/spec/spec_helper.rb +1 -1
  30. data/spec/support/matchers/colors.rb +1 -1
  31. data/spec/xcpretty/formatters/formatter_spec.rb +56 -0
  32. data/spec/xcpretty/formatters/rspec_spec.rb +46 -0
  33. data/spec/xcpretty/formatters/simple_spec.rb +132 -0
  34. data/spec/xcpretty/parser_spec.rb +258 -0
  35. data/spec/xcpretty/printer_spec.rb +39 -74
  36. data/spec/xcpretty/syntax_spec.rb +35 -0
  37. data/xcpretty.gemspec +1 -1
  38. metadata +40 -25
  39. data/lib/xcpretty/printers/rspec.rb +0 -23
  40. data/lib/xcpretty/printers/simple.rb +0 -153
  41. data/spec/xcpretty/printers/printer_spec.rb +0 -117
  42. data/spec/xcpretty/printers/rspec_spec.rb +0 -52
  43. data/spec/xcpretty/printers/simple_spec.rb +0 -125
@@ -0,0 +1,35 @@
1
+ require 'xcpretty/syntax'
2
+
3
+ module XCPretty
4
+
5
+ describe Syntax do
6
+
7
+ before(:each) do
8
+ Syntax.instance_variable_set(:@available, nil)
9
+ end
10
+
11
+ it "caches the pygments availability" do
12
+ Syntax.should_receive(:system).once.and_return(false)
13
+ 4.times { Syntax.highlight('meh') }
14
+ end
15
+
16
+ context "pygments are installed" do
17
+
18
+ it "highlights code" do
19
+ Syntax.stub(:system).and_return(true)
20
+ Syntax.highlight('int a = 5;').should include("\e[36mint\e[39;49;00m")
21
+ end
22
+
23
+ end
24
+
25
+ context "pygments are not installed" do
26
+
27
+ it "prints plain code" do
28
+ Syntax.stub(:system).and_return(false)
29
+ Syntax.highlight('int a = 5;').should == 'int a = 5;'
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+
data/xcpretty.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
7
7
  spec.name = "xcpretty"
8
8
  spec.version = XCPretty::VERSION
9
9
  spec.authors = ["Marin Usalj", "Delisa Mason"]
10
- spec.email = ["mneorr@gmail.com", "kattrali@gmail.com"]
10
+ spec.email = ["mneorr@gmail.com", "iskanamagus@gmail.com"]
11
11
  spec.required_ruby_version = '>= 1.8.7'
12
12
  spec.description =
13
13
  %q{
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcpretty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marin Usalj
@@ -9,62 +9,62 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-12-13 00:00:00.000000000 Z
12
+ date: 2013-12-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '1.3'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.3'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: cucumber
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  description: "\n Xcodebuild formatter designed to be piped with `xcodebuild`,\n and
@@ -72,15 +72,15 @@ description: "\n Xcodebuild formatter designed to be piped with `xcodebuild`,\n
72
72
  dot-style),\n and it can also mine Bitcoins.\n "
73
73
  email:
74
74
  - mneorr@gmail.com
75
- - kattrali@gmail.com
75
+ - iskanamagus@gmail.com
76
76
  executables:
77
77
  - xcpretty
78
78
  extensions: []
79
79
  extra_rdoc_files: []
80
80
  files:
81
- - .gitignore
82
- - .kick
83
- - .travis.yml
81
+ - ".gitignore"
82
+ - ".kick"
83
+ - ".travis.yml"
84
84
  - CHANGELOG.md
85
85
  - CONTRIBUTING.md
86
86
  - Gemfile
@@ -88,30 +88,39 @@ files:
88
88
  - README.md
89
89
  - Rakefile
90
90
  - bin/xcpretty
91
+ - features/custom_formatter.feature
91
92
  - features/junit_report.feature
92
93
  - features/simple_format.feature
93
94
  - features/steps/formatting_steps.rb
94
95
  - features/steps/junit_steps.rb
96
+ - features/steps/xcpretty_steps.rb
95
97
  - features/support/env.rb
96
98
  - features/test_format.feature
99
+ - features/xcpretty.feature
97
100
  - lib/xcpretty.rb
98
101
  - lib/xcpretty/ansi.rb
102
+ - lib/xcpretty/formatters/formatter.rb
103
+ - lib/xcpretty/formatters/rspec.rb
104
+ - lib/xcpretty/formatters/simple.rb
105
+ - lib/xcpretty/parser.rb
99
106
  - lib/xcpretty/printer.rb
100
- - lib/xcpretty/printers/rspec.rb
101
- - lib/xcpretty/printers/simple.rb
102
107
  - lib/xcpretty/reporters/junit.rb
108
+ - lib/xcpretty/syntax.rb
103
109
  - lib/xcpretty/version.rb
104
110
  - spec/fixtures/constants.rb
111
+ - spec/fixtures/custom_formatter.rb
105
112
  - spec/fixtures/raw_kiwi_compilation_fail.txt
106
113
  - spec/fixtures/raw_kiwi_fail.txt
107
114
  - spec/fixtures/raw_specta_fail.txt
108
115
  - spec/spec_helper.rb
109
116
  - spec/support/matchers/colors.rb
110
117
  - spec/xcpretty/ansi_spec.rb
118
+ - spec/xcpretty/formatters/formatter_spec.rb
119
+ - spec/xcpretty/formatters/rspec_spec.rb
120
+ - spec/xcpretty/formatters/simple_spec.rb
121
+ - spec/xcpretty/parser_spec.rb
111
122
  - spec/xcpretty/printer_spec.rb
112
- - spec/xcpretty/printers/printer_spec.rb
113
- - spec/xcpretty/printers/rspec_spec.rb
114
- - spec/xcpretty/printers/simple_spec.rb
123
+ - spec/xcpretty/syntax_spec.rb
115
124
  - xcpretty.gemspec
116
125
  homepage: https://github.com/mneorr/xcpretty
117
126
  licenses:
@@ -123,35 +132,41 @@ require_paths:
123
132
  - lib
124
133
  required_ruby_version: !ruby/object:Gem::Requirement
125
134
  requirements:
126
- - - '>='
135
+ - - ">="
127
136
  - !ruby/object:Gem::Version
128
137
  version: 1.8.7
129
138
  required_rubygems_version: !ruby/object:Gem::Requirement
130
139
  requirements:
131
- - - '>='
140
+ - - ">="
132
141
  - !ruby/object:Gem::Version
133
142
  version: '0'
134
143
  requirements: []
135
144
  rubyforge_project:
136
- rubygems_version: 2.0.3
145
+ rubygems_version: 2.2.0
137
146
  signing_key:
138
147
  specification_version: 4
139
148
  summary: xcodebuild formatter done right
140
149
  test_files:
150
+ - features/custom_formatter.feature
141
151
  - features/junit_report.feature
142
152
  - features/simple_format.feature
143
153
  - features/steps/formatting_steps.rb
144
154
  - features/steps/junit_steps.rb
155
+ - features/steps/xcpretty_steps.rb
145
156
  - features/support/env.rb
146
157
  - features/test_format.feature
158
+ - features/xcpretty.feature
147
159
  - spec/fixtures/constants.rb
160
+ - spec/fixtures/custom_formatter.rb
148
161
  - spec/fixtures/raw_kiwi_compilation_fail.txt
149
162
  - spec/fixtures/raw_kiwi_fail.txt
150
163
  - spec/fixtures/raw_specta_fail.txt
151
164
  - spec/spec_helper.rb
152
165
  - spec/support/matchers/colors.rb
153
166
  - spec/xcpretty/ansi_spec.rb
167
+ - spec/xcpretty/formatters/formatter_spec.rb
168
+ - spec/xcpretty/formatters/rspec_spec.rb
169
+ - spec/xcpretty/formatters/simple_spec.rb
170
+ - spec/xcpretty/parser_spec.rb
154
171
  - spec/xcpretty/printer_spec.rb
155
- - spec/xcpretty/printers/printer_spec.rb
156
- - spec/xcpretty/printers/rspec_spec.rb
157
- - spec/xcpretty/printers/simple_spec.rb
172
+ - spec/xcpretty/syntax_spec.rb
@@ -1,23 +0,0 @@
1
- module XCPretty
2
- module Printer
3
-
4
- class RSpec
5
-
6
- include Printer
7
-
8
- FAIL = "F"
9
- PASS = "."
10
-
11
- def pretty_format(text)
12
- case text
13
- when PASSING_TEST_MATCHER
14
- green(PASS)
15
- when FAILING_TEST_MATCHER
16
- red(FAIL)
17
- else
18
- ""
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,153 +0,0 @@
1
- # encoding: utf-8
2
- require 'shellwords'
3
-
4
- module XCPretty
5
- module Printer
6
-
7
- class Simple
8
-
9
- include Printer
10
-
11
- PASS = "✓"
12
- FAIL = "✗"
13
- ASCII_PASS = "."
14
- ASCII_FAIL = "x"
15
- COMPLETION = "▸"
16
- ASCII_COMPLETION = ">"
17
-
18
- def pretty_format(text)
19
- case text
20
- when /^ProcessPCH/
21
- print_pch(text)
22
- when /^CompileC/
23
- print_compiling(text)
24
- when /^Clean.Remove/
25
- ""
26
- when /^Check dependencies/
27
- ""
28
- when /^=== CLEAN TARGET/
29
- print_clean_target(text)
30
- when /^=== BUILD TARGET/
31
- print_build_target(text)
32
- when /^PhaseScriptExecution/
33
- print_run_script(text)
34
- when /^Libtool/
35
- print_libtool(text)
36
- when /^CpResource/
37
- print_cpresource(text)
38
- when /^CopyStringsFile/
39
- print_copy_strings_file(text)
40
- when /^GenerateDSYMFile/
41
- print_generating_dsym(text)
42
- when /^ProcessInfoPlistFile/
43
- print_processing_info_plist(text)
44
- when /^Ld/
45
- print_linking(text)
46
- when PASSING_TEST_MATCHER
47
- print_passing_test($2, $3)
48
- when FAILING_TEST_MATCHER
49
- print_failing_test($3, $4)
50
- when TESTS_RUN_START_MATCHER
51
- print_test_run_start($1)
52
- when TEST_SUITE_START_MATCHER
53
- print_suite_start($1)
54
- else
55
- ""
56
- end
57
- end
58
-
59
- def optional_newline
60
- "\n"
61
- end
62
-
63
- def print_failing_test(test_case, reason)
64
- format_test("#{test_case}, #{reason}", false)
65
- end
66
-
67
- def print_passing_test(test_case, time)
68
- format_test("#{test_case} (#{time} seconds)")
69
- end
70
-
71
- def print_linking(text)
72
- format("Linking", text.shellsplit[1].split('/').last)
73
- end
74
-
75
- def print_pch(text)
76
- format("Precompiling", Shellwords.shellsplit(text)[2])
77
- end
78
-
79
- def print_processing_info_plist(text)
80
- format("Processing", text.lines.first.shellsplit.last.split('/').last)
81
- end
82
-
83
- def print_compiling(text)
84
- format("Compiling", text.shellsplit[2].split('/').last)
85
- end
86
-
87
- def print_clean_target(text)
88
- info = project_build_info(text)
89
- format("Cleaning", "#{info[:project]}/#{info[:target]} [#{info[:configuration]}]")
90
- end
91
-
92
- def print_build_target(text)
93
- info = project_build_info(text)
94
- format("Building", "#{info[:project]}/#{info[:target]} [#{info[:configuration]}]")
95
- end
96
-
97
- def print_run_script(text)
98
- format("Running script", "'#{text.lines.first.shellsplit[1..-2].join(' ').gsub('\ ',' ')}'")
99
- end
100
-
101
- def print_libtool(text)
102
- format("Building library", text.shellsplit[1].split('/').last)
103
- end
104
-
105
- def print_cpresource(text)
106
- format("Copying", text.shellsplit[1])
107
- end
108
-
109
- def print_copy_strings_file(text)
110
- format("Copying", text.shellsplit.last.split('/').last)
111
- end
112
-
113
- def print_generating_dsym(text)
114
- format("Generating DSYM file")
115
- end
116
-
117
- def print_test_run_start(name)
118
- heading("Test Suite", name, "started")
119
- end
120
-
121
- def print_suite_start(name)
122
- heading("", name, "")
123
- end
124
-
125
- def heading(prefix, text, description)
126
- heading_text = colorize? ? white(text) : text
127
- [prefix, heading_text, description].join(" ").strip
128
- end
129
-
130
- def format(command, argument_text="", success=true)
131
- command_text = colorize? ? white(command) : command
132
- [status_symbol(success ? :completion : :fail), command_text, argument_text].join(" ").strip
133
- end
134
-
135
- def format_test(test_case, success=true)
136
- [status_symbol(success ? :pass : :fail), test_case].join(" ").strip
137
- end
138
-
139
- def status_symbol(status)
140
- case status
141
- when :pass
142
- green(use_unicode? ? PASS : ASCII_PASS)
143
- when :fail
144
- red(use_unicode? ? FAIL : ASCII_FAIL)
145
- when :completion
146
- yellow(use_unicode? ? COMPLETION : ASCII_COMPLETION)
147
- else
148
- ""
149
- end
150
- end
151
- end
152
- end
153
- end
@@ -1,117 +0,0 @@
1
- require "spec_helper"
2
- require "xcpretty/printer"
3
-
4
- module XCPretty
5
-
6
- module Printer
7
-
8
- describe Printer do
9
-
10
- include Printer
11
-
12
- def pretty_format(text)
13
- ""
14
- end
15
-
16
- def executed_tests_message
17
- format_test_summary(SAMPLE_EXECUTED_TESTS)
18
- end
19
-
20
- def given_tests_are_done(reporter = SAMPLE_XCTEST_SUITE_COMPLETION)
21
- pretty_print(reporter)
22
- end
23
-
24
- def given_tests_have_started(reporter = SAMPLE_OCUNIT_TEST_RUN_BEGINNING)
25
- pretty_print(reporter)
26
- end
27
-
28
- def given_kiwi_tests_are_done
29
- pretty_print(SAMPLE_KIWI_TEST_RUN_COMPLETION)
30
- pretty_print(SAMPLE_EXECUTED_TESTS)
31
- pretty_print(SAMPLE_KIWI_SUITE_COMPLETION)
32
- end
33
-
34
- before(:each) do
35
- STDOUT.stub(:print) { |text| text }
36
- end
37
-
38
- it "knows when the test suite is done for OCunit / Specta" do
39
- executed_tests_message.should == ""
40
-
41
- given_tests_are_done
42
- executed_tests_message.should == "\n\n#{SAMPLE_EXECUTED_TESTS}"
43
- end
44
-
45
- it "knows when the test suite is done for XCtest" do
46
- executed_tests_message.should == ""
47
-
48
- given_tests_are_done
49
- executed_tests_message.should == "\n\n#{SAMPLE_EXECUTED_TESTS}"
50
- end
51
-
52
- it "prints out Kiwi failures nicely" do
53
- pretty_print(SAMPLE_KIWI_FAILURE)
54
- pretty_print(SAMPLE_KIWI_FAILURE)
55
- given_tests_are_done(SAMPLE_KIWI_TEST_RUN_COMPLETION)
56
- executed_tests_message.should include(%Q(
57
- NumberAdditions
58
- Iterators_TimesIteratesTheExactNumberOfTimes, expected subject to equal 4, got 5
59
- /Users/musalj/code/OSS/ObjectiveSugar/Example/ObjectiveSugarTests/NSNumberTests.m:49
60
-
61
- Iterators_TimesIteratesTheExactNumberOfTimes, expected subject to equal 4, got 5
62
- /Users/musalj/code/OSS/ObjectiveSugar/Example/ObjectiveSugarTests/NSNumberTests.m:49
63
-
64
-
65
- #{SAMPLE_EXECUTED_TESTS}))
66
- end
67
-
68
- it "prints out specta failures nicely" do
69
- pretty_print(SAMPLE_SPECTA_FAILURE)
70
- pretty_print(SAMPLE_SPECTA_FAILURE)
71
- given_tests_are_done
72
- executed_tests_message.should include(%Q(
73
- RACCommandSpec
74
- enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES, expected: 1, got: 0
75
- /Users/musalj/code/OSS/ReactiveCocoa/ReactiveCocoaFramework/ReactiveCocoaTests/RACCommandSpec.m:458
76
-
77
- enabled_signal_should_send_YES_while_executing_is_YES_and_allowsConcurrentExecution_is_YES, expected: 1, got: 0
78
- /Users/musalj/code/OSS/ReactiveCocoa/ReactiveCocoaFramework/ReactiveCocoaTests/RACCommandSpec.m:458
79
-
80
-
81
- #{SAMPLE_EXECUTED_TESTS}))
82
- end
83
-
84
- it "doesn't print executed message twice for Kiwi tests" do
85
- given_tests_have_started(SAMPLE_KIWI_TEST_RUN_BEGINNING)
86
- given_tests_are_done(SAMPLE_KIWI_TEST_RUN_COMPLETION)
87
- executed_tests_message.should == "\n\n#{SAMPLE_EXECUTED_TESTS}"
88
-
89
- given_tests_are_done(SAMPLE_KIWI_SUITE_COMPLETION)
90
- executed_tests_message.should == ""
91
- end
92
-
93
- it "prints OCunit / XCTest summary twice if tests executed twice" do
94
- 2.times do
95
- given_tests_have_started
96
- given_tests_are_done
97
- executed_tests_message.should == "\n\n#{SAMPLE_EXECUTED_TESTS}"
98
-
99
- given_tests_are_done(SAMPLE_XCTEST_SUITE_COMPLETION)
100
- executed_tests_message.should == ""
101
- end
102
- end
103
-
104
- it "prints Kiwi summary twice if tests executed twice" do
105
- 2.times do
106
- given_tests_have_started(SAMPLE_KIWI_TEST_RUN_BEGINNING)
107
- given_tests_are_done(SAMPLE_KIWI_TEST_RUN_COMPLETION)
108
- executed_tests_message.should == "\n\n#{SAMPLE_EXECUTED_TESTS}"
109
-
110
- given_tests_are_done(SAMPLE_KIWI_SUITE_COMPLETION)
111
- executed_tests_message.should == ""
112
- end
113
- end
114
-
115
- end
116
- end
117
- end