Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 62 lines (37 sloc) 3.285 kb
3d5b426 @lukeredpath Update README and add LICENSE
authored
1 # xcodebuild-rb: Building Xcode projects with Rake
307a902 @lukeredpath Everything needs a README
authored
2
9d7bff5 @lukeredpath Repository has been renamed
authored
3 [![Build Status](https://secure.travis-ci.org/lukeredpath/xcodebuild-rb.png)](http://travis-ci.org/lukeredpath/xcodebuild-rb])
b40ed77 @lukeredpath Add a Travis build status badge to the README
authored
4
3d5b426 @lukeredpath Update README and add LICENSE
authored
5 xcodebuild-rb is a RubyGem that provides a Ruby interface to the `xcodebuild` utility that ships with Xcode in the form of a series of Rake tasks. This gem only supports Xcode 4 (you can try it with 3.x, but YMMV). It makes it simple to run your builds from the command line, especially on remote machines such as Continuous Integration servers.
307a902 @lukeredpath Everything needs a README
authored
6
3d5b426 @lukeredpath Update README and add LICENSE
authored
7 In addition, it provides configurable output parsing that enables better formatting of Xcode build results and eventually, test results. This is done through a series of output translations, reporters and formatters. All of this can be extended with a bit of Ruby knowledge (more on that soon).
307a902 @lukeredpath Everything needs a README
authored
8
3d5b426 @lukeredpath Update README and add LICENSE
authored
9 This library is still under development but it should be more or less usable out of the box.
307a902 @lukeredpath Everything needs a README
authored
10
3d5b426 @lukeredpath Update README and add LICENSE
authored
11 ## Getting started
b40ed77 @lukeredpath Add a Travis build status badge to the README
authored
12
3d5b426 @lukeredpath Update README and add LICENSE
authored
13 After installing the gem, you need to create a `Rakefile` in the root of your project if you don't already have one. If you aren't familiar with `rake`, you can think of it as a Ruby equivalent to `make`. You can find out more about `rake` [here](http://rake.rubyforge.org/).
14
15 A simple Rakefile will look like this:
16
17 require 'rubygems'
a4ac71b @lukeredpath Fixed this require
authored
18 require 'xcodebuild'
3d5b426 @lukeredpath Update README and add LICENSE
authored
19
20 XcodeBuild::Tasks::BuildTask.new
21
22 With only those three lines, you will now have access to a variety of tasks such as clean and build. A full list of tasks can be viewed by running `rake -T`:
23
24 $ rake -T
25 rake xcode:build # Builds the specified target(s).
26 rake xcode:clean # Cleans the build using the same build settings.
27 rake xcode:cleanbuild # Builds the specified target(s) from a clean slate.
28
29 ## Configuring your tasks
30
31 When you run `rake xcode:build`, `xcodebuild` will be invoked without any arguments, which will in turn cause the default build to run. For this to be more useful, we need to configure the task. We could, for instance, configure the target and configuration:
32
33 XcodeBuild::Tasks::BuildTask.new do |t|
34 t.target = "MyApp"
35 t.configuration = "Release"
36 end
37
37fa59a @alloy Add note to README
alloy authored
38 _Note that in order to be able to use the `xcode:archive` task, a scheme **has** to be provided_
39
3d5b426 @lukeredpath Update README and add LICENSE
authored
40 When you run the rake tasks provided, the default behaviour is to simply output the exact output from `xcodebuild`. However, `xcodebuild-rb` can go one better and allow you to configure custom formatters that change the way the build output is displayed. Some formatters are built-in, or you can write your own.
41
42 For instance, we could use the "progress" formatter that ships with `xcodebuild-rb`. Anybody who is used to the output of Ruby's Test::Unit library or RSpec library will be familiar with this.
43
44 XcodeBuild::Tasks::BuildTask.new do |t|
45 t.formatter = XcodeBuild::Formatters::ProgressFormatter.new
46 end
47
48 Now when you run your build, your output will look something like this:
49
50 Building target: ExampleProject (in ExampleProject.xcproject)
51 =============================================================
52
53 Configuration: Release
54 ..............
55
56 Finished in 2.226883 seconds.
57 Build succeeded.
58
59 ## License
60
0daa143 @lukeredpath Missing new line
authored
61 This library is licensed under the [MIT license](http://en.wikipedia.org/wiki/MIT_License).
Something went wrong with that request. Please try again.