xctasks 0.4.0 → 0.4.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/lib/xctasks/test_task.rb +19 -9
- data/lib/xctasks/version.rb +1 -1
- data/spec/test_task_spec.rb +8 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e5d0e8565d04149c6de73c61d731fb0472c24d37
|
4
|
+
data.tar.gz: 84bff82ae95bdb2b2a2b1f0f67465fd412783aab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10038f24a8ed42d632c5a72b07a0b57a198aeea624b1f501001eb11aa55f346610d0fc800d0fda550eae13404f3ab058b4a160c5d1a5c750d358744dcb65ef56
|
7
|
+
data.tar.gz: f67207b2a07fc77b22a9f656d1371af67f98e591ab34a28ba65617e09187f92d443084ab071ecb17faec396a8a3bce41ead65f47ab8e934985becee9c6d0945c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# XCTasks Changelog
|
2
2
|
|
3
|
+
## v0.4.1
|
4
|
+
|
5
|
+
* Reworked output redirection into an optional feature.
|
6
|
+
|
7
|
+
## v0.4.0
|
8
|
+
|
9
|
+
* Added redirection of stderr to /dev/null
|
10
|
+
* Updated dependency on Nokogiri to 1.6
|
11
|
+
|
3
12
|
## v0.3.0
|
4
13
|
|
5
14
|
* Added support for writing environment variables into schemes.
|
data/Gemfile.lock
CHANGED
data/lib/xctasks/test_task.rb
CHANGED
@@ -100,7 +100,7 @@ module XCTasks
|
|
100
100
|
class Configuration
|
101
101
|
SETTINGS = [:workspace, :schemes_dir, :sdk, :runner, :xctool_path,
|
102
102
|
:xcodebuild_path, :settings, :destinations, :actions,
|
103
|
-
:scheme, :ios_versions, :output_log, :env]
|
103
|
+
:scheme, :ios_versions, :output_log, :env, :redirect_stderr]
|
104
104
|
HELPERS = [:destination, :xctool?, :xcpretty?, :xcodebuild?]
|
105
105
|
|
106
106
|
# Configures delegations to pass through configuration accessor when extended
|
@@ -125,6 +125,7 @@ module XCTasks
|
|
125
125
|
@destinations = []
|
126
126
|
@actions = %w{clean build test}
|
127
127
|
@env = {}
|
128
|
+
@redirect_stderr = false
|
128
129
|
end
|
129
130
|
|
130
131
|
def runner=(runner)
|
@@ -138,6 +139,14 @@ module XCTasks
|
|
138
139
|
@sdk = sdk.to_sym
|
139
140
|
end
|
140
141
|
|
142
|
+
def redirect_stderr=(redirect_stderr)
|
143
|
+
if redirect_stderr == true
|
144
|
+
@redirect_stderr = '/dev/null'
|
145
|
+
else
|
146
|
+
@redirect_stderr = redirect_stderr
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
141
150
|
def destination(specifier = {})
|
142
151
|
if specifier.kind_of?(String)
|
143
152
|
raise ArgumentError, "Cannot configure a destination via a block when a complete String specifier is provided" if block_given?
|
@@ -226,18 +235,19 @@ module XCTasks
|
|
226
235
|
end
|
227
236
|
|
228
237
|
def run_tests(options = {})
|
229
|
-
ios_version = options[:ios_version]
|
238
|
+
ios_version = options[:ios_version]
|
230
239
|
XCTasks::Command.run(%q{killall "iPhone Simulator"}, false) if sdk == :iphonesimulator
|
231
240
|
|
232
|
-
output_log_command = output_log ? "
|
241
|
+
output_log_command = output_log ? "| tee -a #{output_log}" : nil
|
242
|
+
redirect_suffix = redirect_stderr ? "2> #{redirect_stderr}" : nil
|
233
243
|
success = if xctool?
|
234
244
|
actions_arg << " -freshSimulator" if ios_version
|
235
|
-
Command.run("#{xctool_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}
|
245
|
+
Command.run(["#{xctool_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}", destination_arg, actions_arg, settings_arg, redirect_suffix, output_log_command].grep(String).join(' '))
|
236
246
|
elsif xcodebuild?
|
237
|
-
Command.run("#{xcodebuild_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}
|
247
|
+
Command.run(["#{xcodebuild_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}", destination_arg, actions_arg, settings_arg, redirect_suffix, output_log_command].grep(String).join(' '))
|
238
248
|
elsif xcpretty?
|
239
249
|
xcpretty_bin = runner.is_a?(String) ? runner : "xcpretty -c"
|
240
|
-
Command.run("#{xcodebuild_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}
|
250
|
+
Command.run(["#{xcodebuild_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}", destination_arg, actions_arg, settings_arg, redirect_suffix, output_log_command, "| #{xcpretty_bin} ; exit ${PIPESTATUS[0]}"].grep(String).join(' '))
|
241
251
|
end
|
242
252
|
|
243
253
|
XCTasks::TestReport.instance.add_result(self, options, success)
|
@@ -245,19 +255,19 @@ module XCTasks
|
|
245
255
|
|
246
256
|
def settings_arg
|
247
257
|
if settings.any?
|
248
|
-
|
258
|
+
settings.map { |k,v| "#{k}=#{v}"}.join(' ')
|
249
259
|
else
|
250
260
|
nil
|
251
261
|
end
|
252
262
|
end
|
253
263
|
|
254
264
|
def actions_arg
|
255
|
-
|
265
|
+
actions.join(' ')
|
256
266
|
end
|
257
267
|
|
258
268
|
def destination_arg
|
259
269
|
if destinations.any?
|
260
|
-
|
270
|
+
destinations.map { |d| "-destination #{d}" }.join(' ')
|
261
271
|
else
|
262
272
|
nil
|
263
273
|
end
|
data/lib/xctasks/version.rb
CHANGED
data/spec/test_task_spec.rb
CHANGED
@@ -81,6 +81,7 @@ describe XCTasks::TestTask do
|
|
81
81
|
t.workspace = 'LayerKit.xcworkspace'
|
82
82
|
t.schemes_dir = 'Tests/Schemes'
|
83
83
|
t.runner = :xcpretty
|
84
|
+
t.redirect_stderr = true
|
84
85
|
t.subtasks = { unit: 'Unit Tests', functional: 'Functional Tests' }
|
85
86
|
end
|
86
87
|
end
|
@@ -115,7 +116,7 @@ describe XCTasks::TestTask do
|
|
115
116
|
@commands.should == ["mkdir -p LayerKit.xcworkspace/xcshareddata/xcschemes",
|
116
117
|
"cp [] LayerKit.xcworkspace/xcshareddata/xcschemes",
|
117
118
|
"killall \"iPhone Simulator\"",
|
118
|
-
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Unit Tests' -sdk iphonesimulator clean build test 2
|
119
|
+
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Unit Tests' -sdk iphonesimulator clean build test 2> /dev/null | xcpretty -c ; exit ${PIPESTATUS[0]}"]
|
119
120
|
end
|
120
121
|
end
|
121
122
|
|
@@ -127,7 +128,7 @@ describe XCTasks::TestTask do
|
|
127
128
|
@commands.should == ["mkdir -p LayerKit.xcworkspace/xcshareddata/xcschemes",
|
128
129
|
"cp [] LayerKit.xcworkspace/xcshareddata/xcschemes",
|
129
130
|
"killall \"iPhone Simulator\"",
|
130
|
-
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Functional Tests' -sdk iphonesimulator clean build test 2
|
131
|
+
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Functional Tests' -sdk iphonesimulator clean build test 2> /dev/null | xcpretty -c ; exit ${PIPESTATUS[0]}"]
|
131
132
|
end
|
132
133
|
end
|
133
134
|
end
|
@@ -153,7 +154,7 @@ describe XCTasks::TestTask do
|
|
153
154
|
@commands.should == ["mkdir -p LayerKit.xcworkspace/xcshareddata/xcschemes",
|
154
155
|
"cp [] LayerKit.xcworkspace/xcshareddata/xcschemes",
|
155
156
|
"killall \"iPhone Simulator\"",
|
156
|
-
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Unit Tests' -sdk iphonesimulator clean build test | tee -a output.log
|
157
|
+
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Unit Tests' -sdk iphonesimulator clean build test | tee -a output.log | xcpretty -s ; exit ${PIPESTATUS[0]}"]
|
157
158
|
end
|
158
159
|
end
|
159
160
|
|
@@ -165,7 +166,7 @@ describe XCTasks::TestTask do
|
|
165
166
|
@commands.should == ["mkdir -p LayerKit.xcworkspace/xcshareddata/xcschemes",
|
166
167
|
"cp [] LayerKit.xcworkspace/xcshareddata/xcschemes",
|
167
168
|
"killall \"iPhone Simulator\"",
|
168
|
-
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Functional Tests' -sdk iphonesimulator clean build test | tee -a output.log
|
169
|
+
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Functional Tests' -sdk iphonesimulator clean build test | tee -a output.log | xcpretty -s ; exit ${PIPESTATUS[0]}"]
|
169
170
|
end
|
170
171
|
end
|
171
172
|
end
|
@@ -247,7 +248,7 @@ describe XCTasks::TestTask do
|
|
247
248
|
subject.invoke
|
248
249
|
@commands.should == [
|
249
250
|
"killall \"iPhone Simulator\"",
|
250
|
-
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Functional Tests' -sdk iphonesimulator clean build test
|
251
|
+
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Functional Tests' -sdk iphonesimulator clean build test"
|
251
252
|
]
|
252
253
|
end
|
253
254
|
end
|
@@ -267,6 +268,7 @@ describe XCTasks::TestTask do
|
|
267
268
|
t.subtask :functional do |s|
|
268
269
|
s.runner = :xcodebuild
|
269
270
|
s.scheme = 'Functional Tests'
|
271
|
+
s.redirect_stderr = 'stderr.log'
|
270
272
|
s.destination do |d|
|
271
273
|
d.platform = :iossimulator
|
272
274
|
d.name = 'iPad Retina'
|
@@ -299,7 +301,7 @@ describe XCTasks::TestTask do
|
|
299
301
|
subject.invoke
|
300
302
|
@commands.should == [
|
301
303
|
"killall \"iPhone Simulator\"",
|
302
|
-
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Functional Tests' -sdk iphonesimulator -destination platform='iOS Simulator',name='iPad Retina',OS='latest' -destination platform\\=iOS\\ Simulator,OS\\=7.1,name\\=iPhone\\ Retina\\ \\(4-inch\\) -destination platform='iOS',id='437750527b43cff55a46f42ae86dbf870c7591b1' clean build test 2
|
304
|
+
"/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Functional Tests' -sdk iphonesimulator -destination platform='iOS Simulator',name='iPad Retina',OS='latest' -destination platform\\=iOS\\ Simulator,OS\\=7.1,name\\=iPhone\\ Retina\\ \\(4-inch\\) -destination platform='iOS',id='437750527b43cff55a46f42ae86dbf870c7591b1' clean build test 2> stderr.log"]
|
303
305
|
end
|
304
306
|
end
|
305
307
|
end
|