xcoder 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. data/Rakefile +2 -0
  2. data/lib/xcode/builder.rb +32 -19
  3. data/lib/xcode/shell.rb +3 -1
  4. data/lib/xcode/test/parsers/ocunit_parser.rb +94 -0
  5. data/lib/xcode/test/report.rb +121 -0
  6. data/lib/xcode/test/report/suite_result.rb +67 -0
  7. data/lib/xcode/test/report/test_result.rb +49 -0
  8. data/lib/xcode/version.rb +1 -1
  9. data/lib/xcode/workspace.rb +6 -3
  10. data/spec/TestProject/{TestProjectTests/TestProjectTests-Info.plist → ApplicationTests/ApplicationTests-Info.plist} +0 -0
  11. data/spec/TestProject/ApplicationTests/ApplicationTests-Prefix.pch +8 -0
  12. data/spec/TestProject/ApplicationTests/ApplicationTests.h +13 -0
  13. data/spec/TestProject/ApplicationTests/ApplicationTests.m +32 -0
  14. data/spec/TestProject/{TestProjectTests → ApplicationTests}/en.lproj/InfoPlist.strings +0 -0
  15. data/spec/TestProject/{TestProjectTests → LogicTests}/AnotherTest.h +0 -0
  16. data/spec/TestProject/{TestProjectTests → LogicTests}/AnotherTest.m +0 -0
  17. data/spec/TestProject/LogicTests/TestProjectTests-Info.plist +22 -0
  18. data/spec/TestProject/{TestProjectTests → LogicTests}/TestProjectTests.h +0 -0
  19. data/spec/TestProject/{TestProjectTests → LogicTests}/TestProjectTests.m +0 -0
  20. data/spec/TestProject/LogicTests/en.lproj/InfoPlist.strings +2 -0
  21. data/spec/TestProject/TestProject.xcodeproj/project.pbxproj +1329 -556
  22. data/spec/TestProject/TestProject.xcodeproj/xcshareddata/xcschemes/TestProject.xcscheme +13 -2
  23. data/spec/TestWorkspace2.xcworkspace/contents.xcworkspacedata +7 -0
  24. data/spec/TestWorkspace2.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  25. data/spec/build_phase_spec.rb +2 -2
  26. data/spec/builder_spec.rb +51 -10
  27. data/spec/integration/builder_spec.rb +60 -4
  28. data/spec/ocunit_parser_spec.rb +164 -0
  29. data/spec/project_spec.rb +1 -1
  30. data/spec/workspace_spec.rb +8 -3
  31. metadata +44 -29
  32. data/lib/xcode/test/ocunit_report_parser.rb +0 -174
  33. data/lib/xcode/test/suite_result.rb +0 -39
  34. data/lib/xcode/test/test_result.rb +0 -43
  35. data/spec/test_report_spec.rb +0 -147
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcoder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-04-05 00:00:00.000000000Z
13
+ date: 2012-04-22 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
17
- requirement: &70326152915240 !ruby/object:Gem::Requirement
17
+ requirement: &70102805249640 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70326152915240
25
+ version_requirements: *70102805249640
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: plist
28
- requirement: &70326152914820 !ruby/object:Gem::Requirement
28
+ requirement: &70102805249220 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70326152914820
36
+ version_requirements: *70102805249220
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: nokogiri
39
- requirement: &70326152914400 !ruby/object:Gem::Requirement
39
+ requirement: &70102805248800 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70326152914400
47
+ version_requirements: *70102805248800
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: builder
50
- requirement: &70326152913980 !ruby/object:Gem::Requirement
50
+ requirement: &70102805248380 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70326152913980
58
+ version_requirements: *70102805248380
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rest-client
61
- requirement: &70326152913560 !ruby/object:Gem::Requirement
61
+ requirement: &70102805247960 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: '0'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *70326152913560
69
+ version_requirements: *70102805247960
70
70
  description: Provides a ruby based object-model for parsing project structures and
71
71
  invoking builds
72
72
  email:
@@ -121,9 +121,10 @@ files:
121
121
  - lib/xcode/target_dependency.rb
122
122
  - lib/xcode/test/formatters/junit_formatter.rb
123
123
  - lib/xcode/test/formatters/stdout_formatter.rb
124
- - lib/xcode/test/ocunit_report_parser.rb
125
- - lib/xcode/test/suite_result.rb
126
- - lib/xcode/test/test_result.rb
124
+ - lib/xcode/test/parsers/ocunit_parser.rb
125
+ - lib/xcode/test/report.rb
126
+ - lib/xcode/test/report/suite_result.rb
127
+ - lib/xcode/test/report/test_result.rb
127
128
  - lib/xcode/testflight.rb
128
129
  - lib/xcode/variant_group.rb
129
130
  - lib/xcode/version.rb
@@ -135,7 +136,18 @@ files:
135
136
  - spec/Provisioning/AppStore.mobileprovision
136
137
  - spec/Provisioning/Test.keychain
137
138
  - spec/Provisioning/TestUser.p12
139
+ - spec/TestProject/ApplicationTests/ApplicationTests-Info.plist
140
+ - spec/TestProject/ApplicationTests/ApplicationTests-Prefix.pch
141
+ - spec/TestProject/ApplicationTests/ApplicationTests.h
142
+ - spec/TestProject/ApplicationTests/ApplicationTests.m
143
+ - spec/TestProject/ApplicationTests/en.lproj/InfoPlist.strings
138
144
  - spec/TestProject/Buildfile
145
+ - spec/TestProject/LogicTests/AnotherTest.h
146
+ - spec/TestProject/LogicTests/AnotherTest.m
147
+ - spec/TestProject/LogicTests/TestProjectTests-Info.plist
148
+ - spec/TestProject/LogicTests/TestProjectTests.h
149
+ - spec/TestProject/LogicTests/TestProjectTests.m
150
+ - spec/TestProject/LogicTests/en.lproj/InfoPlist.strings
139
151
  - spec/TestProject/TestProject.xcodeproj/project.pbxproj
140
152
  - spec/TestProject/TestProject.xcodeproj/xcshareddata/xcschemes/TestProject.xcscheme
141
153
  - spec/TestProject/TestProject/AppDelegate.h
@@ -144,14 +156,10 @@ files:
144
156
  - spec/TestProject/TestProject/TestProject-Prefix.pch
145
157
  - spec/TestProject/TestProject/en.lproj/InfoPlist.strings
146
158
  - spec/TestProject/TestProject/main.m
147
- - spec/TestProject/TestProjectTests/AnotherTest.h
148
- - spec/TestProject/TestProjectTests/AnotherTest.m
149
- - spec/TestProject/TestProjectTests/TestProjectTests-Info.plist
150
- - spec/TestProject/TestProjectTests/TestProjectTests.h
151
- - spec/TestProject/TestProjectTests/TestProjectTests.m
152
- - spec/TestProject/TestProjectTests/en.lproj/InfoPlist.strings
153
159
  - spec/TestWorkspace.xcworkspace/contents.xcworkspacedata
154
160
  - spec/TestWorkspace.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate
161
+ - spec/TestWorkspace2.xcworkspace/contents.xcworkspacedata
162
+ - spec/TestWorkspace2.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate
155
163
  - spec/build_phase_spec.rb
156
164
  - spec/builder_spec.rb
157
165
  - spec/configuration_list_spec.rb
@@ -163,12 +171,12 @@ files:
163
171
  - spec/integration/reachability_install_spec.rb
164
172
  - spec/integration/universal_framework_spec.rb
165
173
  - spec/keychain_spec.rb
174
+ - spec/ocunit_parser_spec.rb
166
175
  - spec/project_spec.rb
167
176
  - spec/provisioning_profile_spec.rb
168
177
  - spec/scheme_spec.rb
169
178
  - spec/spec_helper.rb
170
179
  - spec/target_spec.rb
171
- - spec/test_report_spec.rb
172
180
  - spec/workspace_spec.rb
173
181
  - spec/xcode_spec.rb
174
182
  homepage: https://github.com/rayh/xcoder
@@ -200,7 +208,18 @@ test_files:
200
208
  - spec/Provisioning/AppStore.mobileprovision
201
209
  - spec/Provisioning/Test.keychain
202
210
  - spec/Provisioning/TestUser.p12
211
+ - spec/TestProject/ApplicationTests/ApplicationTests-Info.plist
212
+ - spec/TestProject/ApplicationTests/ApplicationTests-Prefix.pch
213
+ - spec/TestProject/ApplicationTests/ApplicationTests.h
214
+ - spec/TestProject/ApplicationTests/ApplicationTests.m
215
+ - spec/TestProject/ApplicationTests/en.lproj/InfoPlist.strings
203
216
  - spec/TestProject/Buildfile
217
+ - spec/TestProject/LogicTests/AnotherTest.h
218
+ - spec/TestProject/LogicTests/AnotherTest.m
219
+ - spec/TestProject/LogicTests/TestProjectTests-Info.plist
220
+ - spec/TestProject/LogicTests/TestProjectTests.h
221
+ - spec/TestProject/LogicTests/TestProjectTests.m
222
+ - spec/TestProject/LogicTests/en.lproj/InfoPlist.strings
204
223
  - spec/TestProject/TestProject.xcodeproj/project.pbxproj
205
224
  - spec/TestProject/TestProject.xcodeproj/xcshareddata/xcschemes/TestProject.xcscheme
206
225
  - spec/TestProject/TestProject/AppDelegate.h
@@ -209,14 +228,10 @@ test_files:
209
228
  - spec/TestProject/TestProject/TestProject-Prefix.pch
210
229
  - spec/TestProject/TestProject/en.lproj/InfoPlist.strings
211
230
  - spec/TestProject/TestProject/main.m
212
- - spec/TestProject/TestProjectTests/AnotherTest.h
213
- - spec/TestProject/TestProjectTests/AnotherTest.m
214
- - spec/TestProject/TestProjectTests/TestProjectTests-Info.plist
215
- - spec/TestProject/TestProjectTests/TestProjectTests.h
216
- - spec/TestProject/TestProjectTests/TestProjectTests.m
217
- - spec/TestProject/TestProjectTests/en.lproj/InfoPlist.strings
218
231
  - spec/TestWorkspace.xcworkspace/contents.xcworkspacedata
219
232
  - spec/TestWorkspace.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate
233
+ - spec/TestWorkspace2.xcworkspace/contents.xcworkspacedata
234
+ - spec/TestWorkspace2.xcworkspace/xcuserdata/ray.xcuserdatad/UserInterfaceState.xcuserstate
220
235
  - spec/build_phase_spec.rb
221
236
  - spec/builder_spec.rb
222
237
  - spec/configuration_list_spec.rb
@@ -228,12 +243,12 @@ test_files:
228
243
  - spec/integration/reachability_install_spec.rb
229
244
  - spec/integration/universal_framework_spec.rb
230
245
  - spec/keychain_spec.rb
246
+ - spec/ocunit_parser_spec.rb
231
247
  - spec/project_spec.rb
232
248
  - spec/provisioning_profile_spec.rb
233
249
  - spec/scheme_spec.rb
234
250
  - spec/spec_helper.rb
235
251
  - spec/target_spec.rb
236
- - spec/test_report_spec.rb
237
252
  - spec/workspace_spec.rb
238
253
  - spec/xcode_spec.rb
239
254
  has_rdoc:
@@ -1,174 +0,0 @@
1
- require 'time'
2
- require 'fileutils'
3
- require 'xcode/test/suite_result'
4
- require 'xcode/test/test_result'
5
-
6
- module Xcode
7
- module Test
8
-
9
- module Formatters
10
- end
11
-
12
- class OCUnitReportParser
13
-
14
- attr_reader :reports, :end_time, :start_timel
15
- attr_accessor :debug, :formatters
16
-
17
- def initialize
18
- @debug = false
19
- @exit_code = 0
20
- @reports = []
21
- @formatters = []
22
- @failed = false
23
- @start_time = nil
24
- @end_time = nil
25
- @unexpected = false
26
-
27
- add_formatter :junit, 'test-reports'
28
- add_formatter :stdout
29
- end
30
-
31
- def unexpected?
32
- @unexpected
33
- end
34
-
35
- def failed?
36
- @failed or @unexpected
37
- end
38
-
39
- def finished?
40
- !@end_time.nil?
41
- end
42
-
43
- def duration
44
- return 0 if @start_time.nil?
45
- return Time.now - @start_time if @end_time.nil?
46
- @end_time - @start_time
47
- end
48
-
49
- def add_formatter(format, *args)
50
- require "xcode/test/formatters/#{format.to_s}_formatter"
51
- formatter = Formatters.const_get("#{format.to_s.capitalize}Formatter").new(*args)
52
- @formatters << formatter
53
- end
54
-
55
- def flush
56
- return if finished?
57
-
58
- # if there is a current, unfinished test - fail it
59
- unless current_test.nil? or current_test.passed?
60
- fail_current_test(0)
61
- @failed = true
62
- end
63
-
64
- # if there is a current suite which isnt finished - finish it
65
- unless current_suite.nil? or current_suite.finished?
66
- @failed = true # It may not have failed, but we want to indicate an unexpected end
67
- current_suite.finish
68
- notify_formatters(:after_suite, current_suite)
69
- end
70
-
71
- # finish all tests
72
- @end_time = Time.now
73
- notify_formatters(:after, self)
74
- end
75
-
76
- def <<(piped_row)
77
- puts piped_row if @debug
78
-
79
- case piped_row
80
-
81
- when /Test Suite '(\S+)'.*started at\s+(.*)/
82
- name = $1
83
- time = Time.parse($2)
84
- if name=~/\//
85
- # all tests begin
86
- @start_time = Time.now
87
- notify_formatters(:before, self)
88
- else
89
- @reports << SuiteResult.new(name, time)
90
- notify_formatters(:before_suite, current_suite)
91
- end
92
-
93
- when /Test Suite '(\S+)'.*finished at\s+(.*)./
94
- time = Time.parse($2)
95
- name = $1
96
- if name=~/\//
97
- # all tests ended
98
- @end_time = Time.now
99
- notify_formatters(:after, self)
100
- else
101
- @reports.last.finish(time)
102
- notify_formatters(:after_suite, current_suite)
103
- end
104
-
105
- when /Test Case '-\[\S+\s+(\S+)\]' started./
106
- test = TestResult.new($1, current_suite)
107
- @reports.last.tests << test
108
- notify_formatters(:before_test, test)
109
-
110
- when /Test Case '-\[\S+\s+(\S+)\]' passed \((.*) seconds\)/
111
- @reports.last.tests.last.passed($2.to_f)
112
- notify_formatters(:after_test, current_test)
113
-
114
- when /(.*): error: -\[(\S+) (\S+)\] : (.*)/
115
- current_test.add_error($4,$1)
116
- @failed = true
117
- # notify_formatters(:after_test, @reports.last.tests.last)
118
-
119
- when /Test Case '-\[\S+ (\S+)\]' failed \((\S+) seconds\)/
120
- fail_current_test($2.to_f)
121
- @failed = true
122
-
123
- # when /failed with exit code (\d+)/,
124
- when /BUILD FAILED/
125
- flush
126
-
127
- when /Segmentation fault/
128
- @unexpected=true
129
-
130
- when /Run test case (\w+)/
131
- # ignore
132
- when /Run test suite (\w+)/
133
- # ignore
134
- when /Executed (\d+) test, with (\d+) failures \((\d+) unexpected\) in (\S+) \((\S+)\) seconds/
135
- # ignore
136
- else
137
- append_line_to_current_test piped_row
138
- end # case
139
-
140
- end # <<
141
-
142
- private
143
-
144
- def notify_formatters(event, obj=nil)
145
- @formatters.each do |f|
146
- f.send event, obj if f.respond_to? event
147
- end
148
- end
149
-
150
- def current_suite
151
- @reports.last
152
- end
153
-
154
- def current_test
155
- @reports.last.tests.last unless current_suite.nil?
156
- end
157
-
158
- def fail_current_test(duration=0)
159
- return if current_test.nil?
160
-
161
- current_test.failed(duration)
162
- notify_formatters(:after_test, current_test)
163
- end
164
-
165
- def append_line_to_current_test(line)
166
- return if current_suite.nil? or !current_suite.end_time.nil?
167
- return if current_test.nil?
168
- current_test << line
169
- end
170
-
171
-
172
- end # OCUnitReportParser
173
- end # Test
174
- end # Xcode
@@ -1,39 +0,0 @@
1
- module Xcode
2
- module Test
3
- class SuiteResult
4
- attr_accessor :tests, :name, :start_time, :end_time
5
-
6
- def initialize(name, start_time)
7
- @name = name
8
- @start_time = start_time
9
- @tests = []
10
- end
11
-
12
- def finish(time=Time.now)
13
- raise "Time is nil" if time.nil?
14
- @end_time = time
15
- end
16
-
17
- def finished?
18
- !@end_time.nil?
19
- end
20
-
21
- def total_errors
22
- errors = 0
23
- @tests.each do |t|
24
- errors = errors + t.errors.count if t.failed?
25
- end
26
- errors
27
- end
28
-
29
- def total_passed_tests
30
- @tests.select {|t| t.passed? }.count
31
- end
32
-
33
- def total_failed_tests
34
- @tests.select {|t| t.failed? }.count
35
- end
36
-
37
- end
38
- end
39
- end
@@ -1,43 +0,0 @@
1
- module Xcode
2
- module Test
3
- class TestResult
4
- attr_reader :name, :time, :errors, :suite, :data
5
-
6
- def initialize(name, suite)
7
- @name = name
8
- @data = []
9
- @suite = suite
10
- @errors = []
11
- end
12
-
13
- def passed?
14
- @passed
15
- end
16
-
17
- def failed?
18
- !@passed
19
- end
20
-
21
- def passed(time)
22
- @passed = true
23
- @time = time
24
- end
25
-
26
- def failed(time)
27
- @passed = false
28
- @time = time
29
- end
30
-
31
- def << (line)
32
- # puts "[#{@suite.name} #{@name}] << #{line}"
33
- return if @data.count==0 and line.strip.empty?
34
- @data << line
35
- end
36
-
37
- def add_error(error_message,error_location)
38
- @errors << {:message => error_message, :location => error_location, :data => @data}
39
- @data = []
40
- end
41
- end
42
- end
43
- end