xctasks 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b26a1a32a4e137483845cb383e346ccee81628d2
4
- data.tar.gz: cd8f55173880471e1b16c6614f3e883fb1e5a1cc
3
+ metadata.gz: 6b5e17c017baddd3b1950ae2fc75dec14dcbaf16
4
+ data.tar.gz: bf2a96d113244d0e97cd637df8dcc01d361d27fe
5
5
  SHA512:
6
- metadata.gz: 251b519b886dde9cc1050db9c2d50ad097f87d7b081d6cc8714ad5d4d03da357a2310532114cfdb2b53b6c5ad9aca374574554612d487fe274be439e7897e8f4
7
- data.tar.gz: b02d1353020d477aebd2ae8fa07d1470c155740eba2452a9f72e8d1bc35d74bc7dd3fd07b189c232394b2afd4cb14c5522e06c77f03680ce357d6df92911140b
6
+ metadata.gz: ab29b2b90d38db843938ea0a153ef5be79392f9c38a4a8aa5ff3d135b4acf3d82db79b4be306035cac4f8553df918b06aed653c7cfdad2a5ea38490a4429702e
7
+ data.tar.gz: 0fea3e3734f8258131ac3901a11a39d139cd3a9e2ecdb4243aef946a10c17a5805305b9d702e9fe480e916a65e0e346887dee9c3ea52f21cbf825e456971abf3
data/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # XCTasks Changelog
2
+
3
+ ## v0.2.0
4
+
5
+ * Further refinements to shell escaping [@tayhalla]
6
+ * Added `output_log` option.
7
+ * Added support for passing options to runner commands.
8
+
9
+ ## v0.1.1
10
+
11
+ * Add explicit require of forwardable to fix load error under certain Ruby environments.
12
+
13
+ ## v0.1.0
14
+
15
+ * Internal refactoring and cleanups.
16
+
17
+ ## v0.0.2
18
+
19
+ * Expanded SDK configuration support.
20
+ * Improved issues with shell escaping.
21
+
22
+ ## v0.0.1
23
+
24
+ * Initial public release.
25
+ * Supports execution of test suites.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xctasks (0.1.1)
4
+ xctasks (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -19,7 +19,8 @@ require 'xctasks/test_task'
19
19
  XCTasks::TestTask.new(test: 'server:autostart') do |t|
20
20
  t.workspace = 'LayerKit.xcworkspace'
21
21
  t.schemes_dir = 'Tests/Schemes' # Location where you store your shared schemes, will copy into workspace
22
- t.runner = :xctool # or :xcodebuild/:xcpretty
22
+ t.runner = :xctool # or :xcodebuild/:xcpretty. Can also pass options as string, i.e. 'xcpretty -s'
23
+ t.output_log = 'output.log' # Save the build log to a file. Export as Jenkins build artifact for CI build auditing
23
24
 
24
25
  t.subtask(unit: 'LayerKit Tests') do |s|
25
26
  s.ios_versions = %w{7.0 7.1}
@@ -85,8 +85,8 @@ module XCTasks
85
85
  end
86
86
 
87
87
  def to_s
88
- keys = [:platform, :name, :arch, :id, :os].reject { |k| self[k].nil? }
89
- keys.map { |k| "#{key_name(k)}='#{self[k].to_s.shellescape}'" }.join(',')
88
+ keys = [:platform, :name, :arch, :id, :os].reject { |k| self[k].nil? }
89
+ keys.map { |k| "#{key_name(k)}='#{self[k].to_s}'" }.join(',')
90
90
  end
91
91
 
92
92
  private
@@ -99,7 +99,7 @@ module XCTasks
99
99
  class Configuration
100
100
  SETTINGS = [:workspace, :schemes_dir, :sdk, :runner, :xctool_path,
101
101
  :xcodebuild_path, :settings, :destinations, :actions,
102
- :scheme, :ios_versions]
102
+ :scheme, :ios_versions, :output_log]
103
103
  HELPERS = [:destination, :xctool?, :xcpretty?, :xcodebuild?]
104
104
 
105
105
  # Configures delegations to pass through configuration accessor when extended
@@ -126,8 +126,9 @@ module XCTasks
126
126
  end
127
127
 
128
128
  def runner=(runner)
129
- raise ConfigurationError, "Must be :xcodebuild, :xctool or :xcpretty" unless %w{xctool xcodebuild xcpretty}.include?(runner.to_s)
130
- @runner = runner.to_sym
129
+ runner_bin = runner.to_s.split(' ')[0]
130
+ raise ConfigurationError, "Must be :xcodebuild, :xctool or :xcpretty" unless %w{xctool xcodebuild xcpretty}.include?(runner_bin)
131
+ @runner = runner
131
132
  end
132
133
 
133
134
  def sdk=(sdk)
@@ -153,15 +154,15 @@ module XCTasks
153
154
  end
154
155
 
155
156
  def xctool?
156
- runner == :xctool
157
+ runner =~ /^xctool/
157
158
  end
158
159
 
159
160
  def xcodebuild?
160
- runner == :xcodebuild
161
+ runner =~ /^xcodebuild/
161
162
  end
162
163
 
163
164
  def xcpretty?
164
- runner == :xcpretty
165
+ runner =~ /^xcpretty/
165
166
  end
166
167
 
167
168
  # Deep copy any nested structures
@@ -221,14 +222,16 @@ module XCTasks
221
222
  def run_tests(options = {})
222
223
  ios_version = options[:ios_version]
223
224
  XCTasks::Command.run(%q{killall "iPhone Simulator"}, false) if sdk == :iphonesimulator
224
-
225
+
226
+ output_log_command = output_log ? " | tee -a #{output_log} " : ' '
225
227
  success = if xctool?
226
228
  actions_arg << " -freshSimulator" if ios_version
227
- Command.run("#{xctool_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}#{destination_arg}#{actions_arg}#{settings_arg}".strip)
229
+ Command.run("#{xctool_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}#{destination_arg}#{actions_arg}#{settings_arg}#{output_log_command}".strip)
228
230
  elsif xcodebuild?
229
- Command.run("#{xcodebuild_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}#{destination_arg}#{actions_arg}#{settings_arg}".strip)
231
+ Command.run("#{xcodebuild_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}#{destination_arg}#{actions_arg}#{settings_arg}#{output_log_command}".strip)
230
232
  elsif xcpretty?
231
- Command.run("#{xcodebuild_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}#{destination_arg}#{actions_arg}#{settings_arg} | xcpretty -c ; exit ${PIPESTATUS[0]}".strip)
233
+ xcpretty_bin = runner.is_a?(String) ? runner : "xcpretty -c"
234
+ Command.run("#{xcodebuild_path} -workspace #{workspace} -scheme '#{scheme}' -sdk #{sdk}#{ios_version}#{destination_arg}#{actions_arg}#{settings_arg}#{output_log_command}| #{xcpretty_bin} ; exit ${PIPESTATUS[0]}".strip)
232
235
  end
233
236
 
234
237
  XCTasks::TestReport.instance.add_result(self, options, success)
@@ -290,6 +293,7 @@ module XCTasks
290
293
  def define_rake_tasks
291
294
  namespace self.namespace_name do
292
295
  task (prepare_dependency ? { prepare: prepare_dependency} : :prepare ) do
296
+ File.truncate(output_log, 0) if output_log && File.exists?(output_log)
293
297
  if schemes_dir
294
298
  FileUtils::Verbose.mkdir_p "#{workspace}/xcshareddata/xcschemes"
295
299
  FileUtils::Verbose.cp Dir.glob("#{schemes_dir}/*.xcscheme"), "#{workspace}/xcshareddata/xcschemes"
@@ -1,3 +1,3 @@
1
1
  module XCTasks
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -77,6 +77,44 @@ describe XCTasks::TestTask do
77
77
  end
78
78
  end
79
79
 
80
+ describe 'task with log' do
81
+ let!(:task) do
82
+ XCTasks::TestTask.new do |t|
83
+ t.workspace = 'LayerKit.xcworkspace'
84
+ t.schemes_dir = 'Tests/Schemes'
85
+ t.runner = 'xcpretty -s'
86
+ t.output_log = 'output.log'
87
+ t.subtasks = { unit: 'Unit Tests', functional: 'Functional Tests' }
88
+ end
89
+ end
90
+
91
+ describe 'tasks' do
92
+ describe 'spec:unit' do
93
+ subject { Rake.application['test:unit'] }
94
+
95
+ it "executes the appropriate commands" do
96
+ subject.invoke
97
+ @commands.should == ["mkdir -p LayerKit.xcworkspace/xcshareddata/xcschemes",
98
+ "cp [] LayerKit.xcworkspace/xcshareddata/xcschemes",
99
+ "killall \"iPhone Simulator\"",
100
+ "/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Unit Tests' -sdk iphonesimulator clean build test | tee -a output.log | xcpretty -s ; exit ${PIPESTATUS[0]}"]
101
+ end
102
+ end
103
+
104
+ describe 'spec:functional' do
105
+ subject { Rake.application['test:functional'] }
106
+
107
+ it "executes the appropriate commands" do
108
+ subject.invoke
109
+ @commands.should == ["mkdir -p LayerKit.xcworkspace/xcshareddata/xcschemes",
110
+ "cp [] LayerKit.xcworkspace/xcshareddata/xcschemes",
111
+ "killall \"iPhone Simulator\"",
112
+ "/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Functional Tests' -sdk iphonesimulator clean build test | tee -a output.log | xcpretty -s ; exit ${PIPESTATUS[0]}"]
113
+ end
114
+ end
115
+ end
116
+ end
117
+
80
118
  describe 'advanced task' do
81
119
  let!(:task) do
82
120
  XCTasks::TestTask.new do |t|
@@ -150,7 +188,7 @@ describe XCTasks::TestTask do
150
188
  s.scheme = 'Functional Tests'
151
189
  s.destination do |d|
152
190
  d.platform = :iossimulator
153
- d.name = 'iPad'
191
+ d.name = 'iPad Retina'
154
192
  d.os = :latest
155
193
  end
156
194
  s.destination('platform=iOS Simulator,OS=7.1,name=iPhone Retina (4-inch)')
@@ -180,7 +218,7 @@ describe XCTasks::TestTask do
180
218
  subject.invoke
181
219
  @commands.should == [
182
220
  "killall \"iPhone Simulator\"",
183
- "/usr/bin/xcodebuild -workspace LayerKit.xcworkspace -scheme 'Functional Tests' -sdk iphonesimulator -destination platform='iOS\\ Simulator',name='iPad',OS='latest' -destination platform\\=iOS\\ Simulator,OS\\=7.1,name\\=iPhone\\ Retina\\ \\(4-inch\\) -destination platform='iOS',id='437750527b43cff55a46f42ae86dbf870c7591b1' clean build test"]
221
+ "/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"]
184
222
  end
185
223
  end
186
224
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xctasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Blake Watters
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-10 00:00:00.000000000 Z
11
+ date: 2014-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -131,6 +131,7 @@ extra_rdoc_files: []
131
131
  files:
132
132
  - .gitignore
133
133
  - .ruby-version
134
+ - CHANGELOG.md
134
135
  - Gemfile
135
136
  - Gemfile.lock
136
137
  - LICENSE