Git Product home page Git Product logo

xcodebuild-rb's Introduction

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'

XcodeBuild::Tasks::BuildTask.new

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:

XcodeBuild::Tasks::BuildTask.new do |t|
  t.target = "MyApp"
  t.configuration = "Release"
end

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.

XcodeBuild::Tasks::BuildTask.new do |t|
  t.formatter = XcodeBuild::Formatters::ProgressFormatter.new
end

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.

License

This library is licensed under the MIT license.

xcodebuild-rb's People

Contributors

alloy avatar lukeredpath avatar walm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.