ios_build_kit 0.0.1 → 0.0.3

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: 0f79d49883926329cab313795c0b2117054e131a
4
- data.tar.gz: 715043655abfdac1e8d4a07b165cc56f2e7342f1
3
+ metadata.gz: 291c94122b7227db6200ca3440374ef77b629c3e
4
+ data.tar.gz: cbc7e1119a5ac1ac08f3720f4222d55d79c37beb
5
5
  SHA512:
6
- metadata.gz: 09c60c8b413cf0538f9ac75933aaa3a9b1bac63de9375efe258d7204e01760bdf68674c9ffa909b854882c1da46d3c51cd981fc51e87599c7275911b2c735d3d
7
- data.tar.gz: b291a043aa85897a81af74ec4fc64c7445e7a03baf6abc0ec715dfd747c0c1752092df848ac08e9900ebc1f8eed42c80bfa37c0a0db7b410feff5470fe1269ea
6
+ metadata.gz: 926c4fa488def042c03e0dc7ea3d187715a217644b38f3edd6d4397920f48db78e4b40ee61d13b2bfaf68e0acd9f96308a6b5371516bd110b2080a425bf0d563
7
+ data.tar.gz: 9fddc72696d167c577e8363cbb6d30398dfd240130e58cf22b05898be4f58bbbb427ac6823e50577b95afab687fdaab96f0d635c0925eefe1bae780e38b746cd
data/Gemfile.lock CHANGED
@@ -1,12 +1,13 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ios_build_kit (0.0.1)
4
+ ios_build_kit (0.0.2)
5
5
  commander (~> 4.1)
6
6
  json (~> 1.8)
7
7
  nomad-cli (~> 0.0.2)
8
8
  paint (~> 0.8)
9
9
  rmagick (~> 2.13)
10
+ xcpretty (~> 0.1.3)
10
11
 
11
12
  GEM
12
13
  remote: http://rubygems.org/
@@ -109,6 +110,7 @@ GEM
109
110
  json
110
111
  terminal-table (~> 1.4)
111
112
  webrobots (0.1.1)
113
+ xcpretty (0.1.3)
112
114
 
113
115
  PLATFORMS
114
116
  ruby
data/README.md CHANGED
@@ -6,22 +6,19 @@ BuildKit is a modular command line interface for automating iOS project builds.
6
6
  Bundled build tasks include:
7
7
 
8
8
  - Increment the build number
9
- - Draw the build number on the app icon
9
+ - Draw the version number on the app icon
10
10
  - Build the app
11
11
  - Run unit tests
12
12
  - Generate an .ipa artefact
13
13
 
14
- BuildKit is distributed as a Ruby gem with an executable that can be launched either in a continous integration server environment or on your development machine. The process is configured with a simple YAML file that describes the tasks to run and your project-specific options. This means that you can tailor the build process to meet your requirements.
14
+ BuildKit is distributed as a [Ruby gem](https://rubygems.org/gems/ios_build_kit) with an executable that can be launched either in a continous integration server environment or on your development machine. The process is configured with a simple YAML file that describes the tasks to run and your project-specific options. This means that you can tailor the build process to meet your requirements.
15
15
 
16
- **Note**
17
-
18
- This repository was previosly known as Xcode-Project. It previously contained a project generator as well as a less developed build toolkit. The generator was removed due to the rapid advances in iOS technology. If you would like to continue using the previous version it's available [here](https://github.com/adamwaite/iOS-Build-Kit/releases).
16
+ *Note: This repository was previosly known as Xcode-Project. It previously contained a project generator as well as a less developed build toolkit. The generator was removed due to the rapid advances in iOS technology. If you would like to continue using the previous version it's available [here](https://github.com/adamwaite/iOS-Build-Kit/releases).*
19
17
 
20
18
  ## Requirements
21
19
 
22
- - **Ruby 2.0+**: BuildKit is written and run with Ruby, you'll need a version higher than 2.0 because of the modern syntax. Check your Ruby version with `ruby -v`. [RVM](http://rvm.io/) makes it easy should you need to update.
20
+ - **Ruby > 2.0**: BuildKit is written and run with Ruby, you'll need a version higher than 2.0 because of the modern syntax. Check your Ruby version with `ruby -v`. [RVM](http://rvm.io/) makes it easy should you need to update.
23
21
  - **Xcode command line tools**: `xcode-select --install`
24
- - xctool: BuildKit uses [Facebook's xctool](https://github.com/facebook/xctool) to translate the standard Xcode CLI output from computer garbage to human readable form. Install with: `brew install xctool`
25
22
  - **ImageMagick**: Command line graphics library used to draw on the app icon. Install with: `brew install imagemagick`.
26
23
  - **GhostScript**: Command line text rendering library used to draw the version number on the app icon. Install with: `brew install ghostscript`.
27
24
 
@@ -29,7 +26,7 @@ This repository was previosly known as Xcode-Project. It previously contained a
29
26
 
30
27
  After the requirments have been met, BuildKit can be installed with:
31
28
 
32
- `gem install buildkit`
29
+ `gem install ios_build_kit`
33
30
 
34
31
  ## Usage
35
32
 
@@ -66,7 +63,8 @@ An example configuration file:
66
63
  :xcode_build:
67
64
  :run: true
68
65
  :options:
69
- :log: true
66
+ :log: true
67
+ :clean: true
70
68
  :run_tests:
71
69
  :run: false
72
70
  :options:
@@ -108,12 +106,12 @@ To run the task modules successfully requires some project-specific configuratio
108
106
 
109
107
  - `:app_name:`: Your app's name!
110
108
  - `:workspace:`: The path to your workspace (note that single Xcode project files aren't supported).
111
- - `:info_plist:`: The path to your workspace (note that single Xcode project files aren't supported).
109
+ - `:info_plist:`: The path to your app's main info-plist file.
112
110
  - `:build_configuration:`: Your build configuration (normally "Release" or suchlike)
113
111
  - `:scheme:`: Project scheme to build
114
112
  - `:sdk:`: SDK to build with (example: "iphoneos")
115
113
  - `:provisioning_profile:`: Path to a provisioning profile to sign the app with.
116
- - `:code_sign:`: The code signature, this is found in Xcode next to a selected provisioning profile (example: "iPhone Distribution: Alpaca Labs"). I recommend this incredible [Quick Look plug in](https://github.com/chockenberry/Provisioning) if you want to inspect profiles.
114
+ - `:code_sign:`: The code signature, this is found in Xcode next to a selected provisioning profile (example: "iPhone Distribution: Alpaca Labs"). I recommend this [OSX quick look plug in](https://github.com/chockenberry/Provisioning) if you want to inspect profiles.
117
115
  - `:icon_dir:`: The path to a directory containing you icon image files. More on this in the Tasks `decorate_icon` section of this README.
118
116
  - `:build_dir:`: The path to drop any build and ipa files after they have been created.
119
117
 
@@ -128,7 +126,7 @@ BuildKit can be configured to suit your own preference too. This is done under t
128
126
  BuildKit comes packaged with the following task modules:
129
127
 
130
128
  - `increment_version`: Increment the build number
131
- - `decorate_icon`: Overlay the build number on the application icon
129
+ - `decorate_icon`: Overlay the version number on the app icon
132
130
  - `xcode_build`: Build the app
133
131
  - `run_tests`: Run unit tests
134
132
  - `create_ipa`: Generate an .ipa artefact
@@ -149,7 +147,7 @@ Duplicates you app icon files and aints the version number on top (incremented w
149
147
  ![decorate_icon](resources/decorate_icon.png)
150
148
  ![decorate_icon](resources/decorate_icon2.png)
151
149
 
152
- *Decorate icon requires some convention to be followed*: Your app icon files should be contained in a dedicated directory of their own. To have the icon version number appear on top of a generated ipa requires you to drop the icon directory in to Xcode as a folder reference rather than a group. Then set the icon files in your Info-plist as:
150
+ **Decorate icon requires some convention to be followed**: Your app icon files should be contained in a dedicated directory of their own. To have the icon version number appear on top of a generated ipa requires you to drop the icon directory in to Xcode as a folder reference rather than a group. Then set the icon files in your Info-plist as:
153
151
 
154
152
  ```
155
153
  <key>CFBundleIcons</key>
@@ -178,6 +176,10 @@ Builds the project:
178
176
 
179
177
  ![xcode_build](resources/xcode_build.png)
180
178
 
179
+ Options:
180
+ - `log`: logs the output to the console
181
+ - `clean`: clean before build
182
+
181
183
  Requires configuration:
182
184
  - `:app_name:`
183
185
  - `:workspace:`
@@ -192,7 +194,10 @@ Runs unit tests:
192
194
 
193
195
  ![run_tests](resources/run_tests.png)
194
196
 
195
- *Note regarding Kiwi*: As of present you need to use 'edge Kiwi' due to [Kiwi issue 390](https://github.com/allending/Kiwi/issues/390). To used the latest Kiwi put `pod 'Kiwi/XCTest', git: 'https://github.com/allending/Kiwi'` in your Podfile.
197
+ *Note regarding Kiwi: As of present you need to use 'edge Kiwi' due to [Kiwi issue 390](https://github.com/allending/Kiwi/issues/390). To used the latest Kiwi put `pod 'Kiwi/XCTest', git: 'https://github.com/allending/Kiwi'` in your Podfile.*
198
+
199
+ Options:
200
+ - `log`: logs the output to the console
196
201
 
197
202
  Requires configuration:
198
203
  - `:workspace:`
@@ -200,26 +205,28 @@ Requires configuration:
200
205
 
201
206
  ### create_ipa
202
207
 
203
- Creates an .ipa build artefact.
208
+ Creates an .ipa build artefact and drops it in build directory specified in the config file.
204
209
 
205
210
  ![create_ipa](resources/create_ipa.png)
206
211
 
212
+ Options:
213
+ - `log`: logs the output to the console
214
+
207
215
  Requires previous tasks:
208
216
  - `xcode_build`
209
217
 
210
218
  Requires configuration:
211
- - `:workspace:`
212
- - `:scheme:`
219
+ - Everything required for `xcode_build`
213
220
 
214
221
  ## User Preferences
215
222
 
216
- BuildKit includes features that can be enabled under the `:preferences:` symbol of a config file. This is a space to customise your build process.
223
+ BuildKit includes some user preferences that can be enabled under the `:preferences:` symbol of a config file.
217
224
 
218
225
  ### User Preferences: Create Reports
219
226
 
220
227
  Set `:reports:` to a directory in your config file to create a JSON report containing the project configuration, build time, build outputs and test outputs after a BuildKit run has completed.
221
228
 
222
- Leaving the :reports:` preference blank will skip report generation.
229
+ Leaving the `:reports:` preference blank will skip report generation.
223
230
 
224
231
  ## Examples
225
232
 
@@ -229,8 +236,8 @@ An example workspace has been included in the repo if you want to try it out. Yo
229
236
 
230
237
  Lots of plans for BuildKit:
231
238
 
232
- - Cover with RSpec specs (in progress)
233
- - Create a build task module to enable artefact distribution by wrapping [Shenzhen](https://github.com/nomad/shenzhen).
239
+ - Cover with RSpec specs (in progress).
240
+ - Create a build task module to enable artefact distribution by wrapping [Shenzhen](https://github.com/nomad/shenzhen) (next up).
234
241
  - Add a means to allow custom task modules to be added to the process.
235
242
  - Add a task to email build reports.
236
243
  - Make `decorate_icon` compatible with Xcode 5 asset catalogues.
@@ -242,6 +249,11 @@ Lots of plans for BuildKit:
242
249
 
243
250
  All pull requests welcome! Please update the README with any new features.
244
251
 
252
+ ### Contributors
253
+
254
+ - [@adamwaite](https://github.com/adamwaite/)
255
+ - [@garnett](https://github.com/garnett)
256
+
245
257
  ## Contact
246
258
 
247
259
  [@adamwaite](https://twitter.com/AdamWaite)
@@ -266,4 +278,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
266
278
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
267
279
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
268
280
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
269
- THE SOFTWARE.
281
+ THE SOFTWARE.
Binary file
@@ -16,8 +16,9 @@ Gem::Specification.new do |s|
16
16
  s.add_dependency "commander", "~> 4.1"
17
17
  s.add_dependency "json", "~> 1.8"
18
18
  s.add_dependency "paint", "~> 0.8"
19
- s.add_dependency "nomad-cli", "~> 0.0.2"
19
+ s.add_dependency "nomad-cli", "~> 0.0.3"
20
20
  s.add_dependency "rmagick", '~> 2.13'
21
+ s.add_dependency "xcpretty", '~> 0.1.3'
21
22
 
22
23
  s.add_development_dependency "bundler"
23
24
  s.add_development_dependency "rspec"
@@ -5,7 +5,9 @@ module BuildKit
5
5
  module Runner
6
6
 
7
7
  class TaskRunnerConfig < OpenStruct
8
-
8
+ def absolute_build_dir
9
+ File.expand_path(build_dir)
10
+ end
9
11
  end
10
12
 
11
13
  end
@@ -43,7 +43,9 @@ module BuildKit
43
43
  private
44
44
 
45
45
  def hash_from_yaml file
46
- YAML.load_file(file)
46
+ hash = YAML.load_file(file)
47
+ BuildKit::Utilities::Assertions.assert_symbol_hash_keys hash
48
+ hash
47
49
  end
48
50
 
49
51
  def prepare_task_queue! tasks
@@ -54,7 +54,7 @@ module BuildKit
54
54
 
55
55
  def artefact_full_path
56
56
  build_artefact_filename! if @artefact_filename.nil?
57
- @config.build_dir + @artefact_filename
57
+ File.join(@config.absolute_build_dir, @artefact_filename)
58
58
  end
59
59
 
60
60
  def existing_ipa_count
@@ -64,7 +64,7 @@ module BuildKit
64
64
  def build_command
65
65
  workspace_arg = "-workspace \"#{@config.workspace}\""
66
66
  sdk_arg = "-sdk #{@config.sdk}"
67
- build_file_arg = "-v \"#{@config.build_dir}#{@config.app_name}.app\""
67
+ build_file_arg = "-v \"#{File.join(@config.absolute_build_dir, @config.app_name)}.app\""
68
68
  output_file_arg = "-o \"#{artefact_full_path}\""
69
69
  code_sign_arg = "--sign #{@config.code_sign}"
70
70
  provisioning_arg = "--embed \"#{@config.provisioning_profile}\""
@@ -28,7 +28,7 @@ module BuildKit
28
28
  def build_command
29
29
  workspace_arg = "-workspace \"#{@config.workspace}\""
30
30
  scheme_arg = "-scheme \"#{@config.scheme}\""
31
- "xctool #{workspace_arg} #{scheme_arg} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO test -freshSimulator -parallelize"
31
+ "xcodebuild #{workspace_arg} #{scheme_arg} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO test | xcpretty -c; echo EXIT CODE: ${PIPESTATUS}"
32
32
  end
33
33
 
34
34
  def run_command!
@@ -38,7 +38,7 @@ module BuildKit
38
38
  end
39
39
 
40
40
  def tests_passed?
41
- @output.include? "TEST SUCCEEDED"
41
+ @output.include? "EXIT CODE: 0"
42
42
  end
43
43
 
44
44
  def complete_task!
@@ -14,7 +14,8 @@ module BuildKit
14
14
  attr_reader :output
15
15
 
16
16
  def run!
17
- run_command!
17
+ run_command! "clean" if @task_options[:clean]
18
+ run_command! "build"
18
19
  complete_task!
19
20
  end
20
21
 
@@ -22,26 +23,31 @@ module BuildKit
22
23
 
23
24
  def assert_requirements
24
25
  BuildKit::Utilities::Assertions.assert_required_config [:app_name, :workspace, :sdk, :build_configuration, :build_dir, :scheme], @runner
25
- BuildKit::Utilities::Assertions.assert_files_exist [@config.workspace, @config.build_dir]
26
+ BuildKit::Utilities::Assertions.assert_files_exist [@config.workspace, @config.absolute_build_dir]
26
27
  end
27
28
 
28
- def build_command
29
+ def build_command cmd
29
30
  workspace_arg = "-workspace \"#{@config.workspace}\""
30
31
  sdk_arg = "-sdk \"#{@config.sdk}\""
31
32
  scheme_arg = "-scheme \"#{@config.scheme}\""
32
33
  configuration_arg = "-configuration \"#{@config.build_configuration}\""
33
- build_dir_arg = "CONFIGURATION_BUILD_DIR=\"#{@config.build_dir}\""
34
- "xctool #{workspace_arg} #{sdk_arg} #{scheme_arg} #{configuration_arg} #{build_dir_arg} build"
34
+ build_dir_arg = "CONFIGURATION_BUILD_DIR=\"#{@config.absolute_build_dir}\""
35
+ "xcodebuild #{workspace_arg} #{sdk_arg} #{scheme_arg} #{configuration_arg} #{build_dir_arg} #{cmd} | xcpretty -c; echo EXIT CODE: ${PIPESTATUS}"
35
36
  end
36
37
 
37
- def run_command!
38
- command = build_command
39
- @output = %x[#{command}]
40
- puts @output if @task_options[:log]
38
+ def run_command! cmd
39
+ command = build_command cmd
40
+ cmd_output = %x[#{command}]
41
+ @output = cmd_output if is_build? cmd
42
+ puts cmd_output if @task_options[:log]
43
+ end
44
+
45
+ def is_build? cmd
46
+ cmd == "build"
41
47
  end
42
48
 
43
49
  def build_succeeded?
44
- @output.include? "BUILD SUCCEEDED"
50
+ @output.include? "EXIT CODE: 0"
45
51
  end
46
52
 
47
53
  def complete_task!
@@ -12,13 +12,23 @@ module BuildKit
12
12
 
13
13
  def self.assert_required_config req_keys, runner
14
14
  req_keys.each do |k|
15
- runner.terminate_with_err "Missing Configuration: #{k} is required to run #{runner.tasks[:running]}" if runner.config[k].nil?
15
+ BuildKit::Utilities::Console.terminate_with_err "Missing Configuration: #{k} is required to run #{runner.tasks[:running]}" if runner.config[k].nil?
16
16
  end
17
17
  end
18
18
 
19
19
  def self.assert_tasks_completed req_tasks, runner
20
20
  req_tasks.each do |t|
21
- runner.terminate_with_err "Task Required: #{t.to_s} should be completed to run #{runner.tasks[:running]}" unless runner.has_completed_task? t
21
+ BuildKit::Utilities::Console.terminate_with_err "Task Required: #{t.to_s} should be completed to run #{runner.tasks[:running]}" unless runner.has_completed_task? t
22
+ end
23
+ end
24
+
25
+ def self.assert_symbol_hash_keys hash
26
+ hash.each do |key, val|
27
+ if val.is_a? Hash
28
+ BuildKit::Utilities::Assertions.assert_symbol_hash_keys val
29
+ else
30
+ BuildKit::Utilities::Console.terminate_with_err "Invalid config file: config file keys should be in Symbol form (:key:). Failed on: #{key}." unless key.is_a? Symbol
31
+ end
22
32
  end
23
33
  end
24
34
 
@@ -9,7 +9,7 @@ module BuildKit
9
9
  def self.create_report runner
10
10
  to_write = { time: Time.now.to_s, config: runner.config.to_h, preferences: runner.preferences.to_h, runtime_store: runner.store, outputs: {} }
11
11
  runner.tasks[:run].each { |task| to_write[:outputs][task.keys.first] = runner.outputs[task.keys.first] }
12
- file_name = "#{runner.preferences.reports}report-#{Time.now.to_i}.json"
12
+ file_name = File.join(runner.preferences.reports, "report-#{Time.now.to_i}.json")
13
13
  File.open(file_name, 'w') { |f| f.write to_write.to_json }
14
14
  file_name
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module BuildKit
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -0,0 +1,26 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe "decorate_icon task" do
4
+
5
+ describe "invalid config handling" do
6
+
7
+ context "missing previous tasks" do
8
+
9
+ context "xcode_build" do
10
+ pending "raise exception"
11
+ end
12
+
13
+ end
14
+
15
+ end
16
+
17
+ describe "ipa creation" do
18
+ pending "the build dir has a new ipa file"
19
+ end
20
+
21
+ describe "task completion" do
22
+ pending "runner.tasks[:completed].include?(:create_ipa).should be_true"
23
+ pending "runner.outputs[:create_ipa].should_not be_nil"
24
+ end
25
+
26
+ end
@@ -0,0 +1,34 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe "decorate_icon task" do
4
+
5
+ describe "invalid config handling" do
6
+
7
+ context "missing configuration" do
8
+
9
+ context "icon_dir" do
10
+ pending "raise exception"
11
+ end
12
+
13
+ end
14
+
15
+ context "non-existent files" do
16
+
17
+ context "icon_dir" do
18
+ pending "raise exception"
19
+ end
20
+
21
+ end
22
+
23
+ end
24
+
25
+ describe "new icons" do
26
+ pending "the icon dir has as many new files of type png as there was beforehand"
27
+ end
28
+
29
+ describe "task completion" do
30
+ pending "runner.tasks[:completed].include?(:decorate_icon).should be_true"
31
+ pending "runner.outputs[:decorate_icon].should_not be_nil"
32
+ end
33
+
34
+ end
@@ -0,0 +1,48 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe "xcode_build task" do
4
+
5
+ describe "invalid config handling" do
6
+
7
+ context "missing configuration" do
8
+
9
+ context "info_plist" do
10
+ pending "raise exception"
11
+ end
12
+
13
+ end
14
+
15
+ context "non-existent files" do
16
+
17
+ context "info_plist" do
18
+ pending "raise exception"
19
+ end
20
+
21
+ end
22
+
23
+ end
24
+
25
+ describe "plist reading" do
26
+ pending "it reads major, minor, build version"
27
+ pending "it reads revision version"
28
+ end
29
+
30
+ describe "existing version" do
31
+ pending "it stores the existing version"
32
+ end
33
+
34
+ describe "new version" do
35
+ pending "it stores the existing version"
36
+ end
37
+
38
+ describe "writing the new version to the plist" do
39
+ pending "it increments the existing version"
40
+ pending "it stores the new version"
41
+ end
42
+
43
+ describe "task completion" do
44
+ pending "runner.tasks[:completed].include?(:increment_version).should be_true"
45
+ pending "runner.outputs[:increment_version].should_not be_nil"
46
+ end
47
+
48
+ end
@@ -0,0 +1,13 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe "report generation" do
4
+
5
+ context "user switches reports on" do
6
+ pending "reports appear"
7
+ end
8
+
9
+ context "user swicthes reports off" do
10
+ pending "reports don't appear"
11
+ end
12
+
13
+ end
@@ -0,0 +1,42 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe "run_tests task" do
4
+
5
+ describe "invalid config handling" do
6
+
7
+ context "missing configuration" do
8
+
9
+ context "workspace" do
10
+ pending "raise exception"
11
+ end
12
+
13
+ context "scheme" do
14
+ pending "raise exception"
15
+ end
16
+
17
+ end
18
+
19
+ context "non-existent files" do
20
+
21
+ context "workspace" do
22
+ pending "raise exception"
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+
29
+ describe "passing tests" do
30
+ pending "runner.store[:tests_passed].should be_true"
31
+ end
32
+
33
+ describe "failing tests" do
34
+ pending "runner.store[:tests_passed].should_not be_true <- need to create a failing test target. compare YES to NO or something"
35
+ end
36
+
37
+ describe "task completion" do
38
+ pending "runner.tasks[:completed].include?(:run_tests).should be_true"
39
+ pending "runner.outputs[:run_tests].should_not be_nil"
40
+ end
41
+
42
+ end
@@ -0,0 +1,17 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe "Runner" do
4
+
5
+ describe "Runner instance" do
6
+
7
+ context "no configuration file" do
8
+ specify { expect { BuildKit::Runner::TaskRunner.new }.to raise_error }
9
+ end
10
+
11
+ context "invalid configuration file" do
12
+ specify { expect { BuildKit::Runner::TaskRunner.new({ config_file: "/does/not/exist/" }) }.to raise_error }
13
+ end
14
+
15
+ end
16
+
17
+ end
@@ -0,0 +1,20 @@
1
+ require 'rake'
2
+
3
+ $:.push File.expand_path("../lib", __FILE__)
4
+
5
+ Dir["lib/ios_build_kit/**/*.rb"].reject { |file| file.include? "lib/ios_build_kit/version.rb" }.each { |f| load(f) }
6
+
7
+ require_relative 'support/config_mocker.rb'
8
+ require_relative 'support/temp_dir.rb'
9
+
10
+ RSpec.configure do |config|
11
+
12
+ config.color_enabled = true
13
+ config.tty = true
14
+ config.formatter = :documentation
15
+ config.fail_fast = true
16
+
17
+ config.before(:each) { create_spec_temp_dir }
18
+ config.after(:each) { destroy_spec_temp_dir }
19
+
20
+ end
@@ -0,0 +1,94 @@
1
+ require 'yaml'
2
+
3
+ class Hash
4
+
5
+ def enable_increment_version
6
+ self[:tasks][:increment_version][:run] = true
7
+ end
8
+
9
+ def enable_decorate_icon
10
+ self[:tasks][:decorate_icon][:run] = true
11
+ end
12
+
13
+ def enable_xcode_build
14
+ self[:tasks][:xcode_build][:run] = true
15
+ end
16
+
17
+ def enable_run_tests
18
+ self[:tasks][:run_tests][:run] = true
19
+ end
20
+
21
+ def enable_create_ipa
22
+ self[:tasks][:create_ipa][:run] = true
23
+ end
24
+
25
+ end
26
+
27
+ def mock_runner config_file_data
28
+ mock_conf_file = create_mock_config_file config_file_data
29
+ runner = BuildKit::Runner::TaskRunner.new({ config_file: mock_conf_file })
30
+ runner
31
+ end
32
+
33
+ def vc
34
+ valid_config_file_data
35
+ end
36
+
37
+ def valid_config_file_data
38
+
39
+ {
40
+ tasks: {
41
+
42
+ increment_version: {
43
+ run: false,
44
+ options: nil
45
+ },
46
+
47
+ decorate_icon: {
48
+ run: false,
49
+ options: nil
50
+ },
51
+
52
+ xcode_build: {
53
+ run: false,
54
+ options: { log: false }
55
+ },
56
+
57
+ run_tests: {
58
+ run: false,
59
+ options: { log: false }
60
+ },
61
+
62
+ create_ipa: {
63
+ run: false,
64
+ options: { log: false }
65
+ }
66
+
67
+ },
68
+
69
+ configuration: {
70
+ app_name: "BuildKit",
71
+ workspace: "/Users/adamwaite/iOS/Lib/BuildKit/iOS-Build-Kit/example/BuildKit.xcworkspace",
72
+ info_plist: "/Users/adamwaite/iOS/Lib/BuildKit/iOS-Build-Kit/example/BuildKit/BuildKit-Info.plist",
73
+ build_configuration: "Release",
74
+ scheme: "BuildKit",
75
+ sdk: "iphoneos",
76
+ provisioning_profile: "/Users/adamwaite/iOS/Lib/BuildKit/iOS-Build-Kit/example/Provisioning/BuildKitTest.mobileprovision",
77
+ code_sign: "iPhone Distribution: Alpaca Labs",
78
+ icon_dir: "/Users/adamwaite/iOS/Lib/BuildKit/iOS-Build-Kit/example/BuildKit/Icon/",
79
+ build_dir: "/Users/adamwaite/iOS/Lib/BuildKit/iOS-Build-Kit/spec/temp/",
80
+ },
81
+
82
+ preferences: {
83
+ reports: "/Users/adamwaite/iOS/Lib/BuildKit/iOS-Build-Kit/spec/temp/",
84
+ }
85
+
86
+ }
87
+
88
+ end
89
+
90
+ def create_mock_config_file hash
91
+ path = "spec/temp/mock_config_file.yml"
92
+ File.open("spec/temp/mock_config_file.yml", 'w') { |f| f.write hash.to_yaml }
93
+ path
94
+ end
@@ -0,0 +1,9 @@
1
+ require 'fileutils'
2
+
3
+ def create_spec_temp_dir
4
+ FileUtils.mkdir_p "spec/temp"
5
+ end
6
+
7
+ def destroy_spec_temp_dir
8
+ FileUtils.rm_rf "spec/temp"
9
+ end
@@ -0,0 +1,58 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe "xcode_build task" do
4
+
5
+ describe "invalid config handling" do
6
+
7
+ context "missing configuration" do
8
+
9
+ context "app_name" do
10
+ pending "raise exception"
11
+ end
12
+
13
+ context "workspace" do
14
+ pending "raise exception"
15
+ end
16
+
17
+ context "build_configuration" do
18
+ pending "raise exception"
19
+ end
20
+
21
+ context "build_dir" do
22
+ pending "raise exception"
23
+ end
24
+
25
+ context "scheme" do
26
+ pending "raise exception"
27
+ end
28
+
29
+ end
30
+
31
+ context "non-existent files" do
32
+
33
+ context "workspace" do
34
+ pending "raise exception"
35
+ end
36
+
37
+ context "build_dir" do
38
+ pending "raise exception"
39
+ end
40
+
41
+ end
42
+
43
+ end
44
+
45
+ describe "successful build" do
46
+ pending "runner.store[:xcode_build_succeeded].should be_true"
47
+ end
48
+
49
+ describe "failing build" do
50
+ pending "runner.store[:xcode_build_succeeded].should_not be_true <- need to create a target that fails to build, spelling mistake or something"
51
+ end
52
+
53
+ describe "task completion" do
54
+ pending "runner.tasks[:completed].include?(:xcode_build).should be_true"
55
+ pending "runner.outputs[:xcode_build].should_not be_nil"
56
+ end
57
+
58
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ios_build_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Waite
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-12 00:00:00.000000000 Z
11
+ date: 2014-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 0.0.2
61
+ version: 0.0.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: 0.0.2
68
+ version: 0.0.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rmagick
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.13'
83
+ - !ruby/object:Gem::Dependency
84
+ name: xcpretty
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 0.1.3
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 0.1.3
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: bundler
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -132,7 +146,7 @@ extra_rdoc_files: []
132
146
  files:
133
147
  - ./Gemfile
134
148
  - ./Gemfile.lock
135
- - ./ios_build_kit-0.0.1.gem
149
+ - ./ios_build_kit-0.0.2.gem
136
150
  - ./ios_build_kit.gemspec
137
151
  - ./lib/ios_build_kit/task.rb
138
152
  - ./lib/ios_build_kit/task_configuration.rb
@@ -153,6 +167,16 @@ files:
153
167
  - ./Rakefile
154
168
  - ./README.md
155
169
  - ./README.rdoc
170
+ - spec/create_ipa_spec.rb
171
+ - spec/decorate_icon_spec.rb
172
+ - spec/increment_version_spec.rb
173
+ - spec/reports_spec.rb
174
+ - spec/run_tests_spec.rb
175
+ - spec/runner_spec.rb
176
+ - spec/spec_helper.rb
177
+ - spec/support/config_mocker.rb
178
+ - spec/support/temp_dir.rb
179
+ - spec/xcode_build_spec.rb
156
180
  - bin/buildkit
157
181
  homepage: https://github.com/adamwaite/iOS-Build-Kit
158
182
  licenses: []
@@ -177,5 +201,15 @@ rubygems_version: 2.0.8
177
201
  signing_key:
178
202
  specification_version: 4
179
203
  summary: iOS Build Kit
180
- test_files: []
204
+ test_files:
205
+ - spec/create_ipa_spec.rb
206
+ - spec/decorate_icon_spec.rb
207
+ - spec/increment_version_spec.rb
208
+ - spec/reports_spec.rb
209
+ - spec/run_tests_spec.rb
210
+ - spec/runner_spec.rb
211
+ - spec/spec_helper.rb
212
+ - spec/support/config_mocker.rb
213
+ - spec/support/temp_dir.rb
214
+ - spec/xcode_build_spec.rb
181
215
  has_rdoc:
Binary file