Skip to content

Lightricks/xcpretty

 
 

Repository files navigation

Note from Lightricks:

This is a fork of xcpretty which we use at Lightricks.
We allow outside contributions, as long as they are well documented and well tested.

logo

xcpretty is a fast and flexible formatter for xcodebuild.
It does one thing, and it should do it well.

Build Status

Installation

Since this fork isn't pushed to RubyGems, you can't install it normally from RubyGems.
You'll have to install it using this repository as the source.

With bundler, add the following line to your Gemfile:

gem "xcpretty", git:"https://github.com/Lightricks/xcpretty"

and run bundle or bundle install.
You can also install a specific branch or revision using branch: <BRANCH> and ref: <REF>.

With specific_install gem, run the following command:

$ gem specific_install https://github.com/Lightricks/xcpretty

You can also install a specific branch or revision using --ref <REF> and --branch <BRANCH>.

Usage

$ xcodebuild [flags] | xcpretty

xcpretty is designed to be piped with xcodebuild and thus keeping 100% compatibility with it. It's even a bit faster than xcodebuild itself, since it saves your terminal some prints.

Important: If you're running xcpretty on a CI like Travis or Jenkins, you may want to exit with same status code as xcodebuild. CI systems usually use status codes to determine if the build has failed.

$ set -o pipefail && xcodebuild [flags] | xcpretty
#
# OR
#
$ xcodebuild [flags] | xcpretty && exit ${PIPESTATUS[0]}

Raw xcodebuild output

You might want to use xcpretty together with tee to store the raw log in a file, and get the pretty output in the terminal. This might be useful if you want to inspect a failure in detail and aren't able to tell from the pretty output.

Here's a way of doing it:

$ xcodebuild [flags] | tee xcodebuild.log | xcpretty

Formats

ANSI / UTF-8

  • --[no-]color: Show build icons in color. (you can add it to --simple or --test format). Defaults to auto-detecting color availability.
  • --[no-]utf: Use unicode characters in build output or only ASCII. Defaults to auto-detecting the current locale.

Reporters

  • --report junit, -r junit: Creates a JUnit-style XML report at build/reports/junit.xml, compatible with Jenkins and TeamCity CI.

  • --report html, -r html: Creates a simple HTML report at build/reports/tests.html. xcpretty html

  • --report json-compilation-database, -r json-compilation-database: Creates a JSON compilation database at build/reports/compilation_db.json. This is a format to replay single compilations independently of the build system.

Writing a report to a custom path can be specified using --output PATH.

Known extensions

The recommended format is a gem containing the formatter and named with an xcpretty- prefix, for easier discovery.

Team

About

Flexible and fast xcodebuild formatter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 83.4%
  • Gherkin 11.6%
  • HTML 5.0%