No description or website provided.
Ruby Objective-C
Failed to load latest commit information.
lib At some point xcodebuild started using export instead of setenv. Jul 10, 2014
resources Move warnings before the "finished" line. Feb 10, 2012
.rspec init rspec Jan 28, 2012
.travis.yml Updated changes and gem spec. Feb 7, 2012
Gemfile Update gems. Jul 10, 2014
Gemfile.lock Update gems. Jul 10, 2014
Guardfile Started to implement failure handling, including reporting of errors. Jan 29, 2012
LICENSE Update README and add LICENSE Jan 30, 2012
Rakefile See if we can make this test a bit more deterministic and reliable Feb 10, 2012
xcodebuild-rb.gemspec See if we can make this test a bit more deterministic and reliable Feb 10, 2012

xcodebuild-rb: Building Xcode projects with Rake

Build Status

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.

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).

This library is still under development but it should be more or less usable out of the box.

Getting started

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.

A simple Rakefile will look like this:

require 'rubygems'
require 'xcodebuild'

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:

$ rake -T
rake xcode:build       # Builds the specified target(s).
rake xcode:clean       # Cleans the build using the same build settings.
rake xcode:cleanbuild  # Builds the specified target(s) from a clean slate.

Configuring your tasks

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: do |t| = "MyApp"
  t.configuration = "Release"

Note that in order to be able to use the xcode:archive task, a scheme has to be provided

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.

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. do |t|
  t.formatter =

Now when you run your build, your output will look something like this:

Building target: ExampleProject (in ExampleProject.xcproject)

Configuration: Release

Finished in 2.226883 seconds.
Build succeeded.


This library is licensed under the MIT license.