Skip to content

Instantly share code, notes, and snippets.

@mhaylock
Created February 7, 2013 02:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhaylock/4727993 to your computer and use it in GitHub Desktop.
Save mhaylock/4727993 to your computer and use it in GitHub Desktop.
Instructions for adding Cedar to an existing project. Cedar does exist as a CocoaPods project but that doesn't get you access to the templates, so this approach installs it as a git submodule - YMMV.

Existing project details

This document uses a project named "Example" that has an existing target "ExampleApp". This is the target you will host you tests in.

Adding Cedar as a submodule and installed templates into Xcode:

  $ mkdir Externals
  $ git submodule add git://github.com/pivotal/cedar.git Externals/Cedar
  $ cd Externals/Cedar/; ./installCodeSnippetsAndTemplates; cd -;

Setup Cedar and CocoaPods:

Including Cedar from a submodule for access to all the Cedar files, but using CocoaPods to pull it into the project. Set this up by:

  1. Add a new target of type "iOS Cedar Testing Bundle":
(File > New > Target… > Cedar > iOS Cedar Testing Bundle):

Product Name:           ExampleSpecs
Organization Name:      Mark Haylock
Company Identifier:     com.resolvedigital
Bundle Identifier:      com.resolvedigital.ExampleSpecs
Test Target:            AStoryUnfolds
Bundle Loader:          $(BUILT_PRODUCTS_DIR)/Example.app/Example
Other Settings:         ✔ Use Automatic Reference Counting
Project:                Example
  1. Edit the scheme for "Example" and add "ExampleSpecs" to the "Test" tab.

  2. Install CocoaPods using these commands:

  $ gem install cocoapods
  $ pod setup
  1. Add ./Podfile with custom exclusive "test" target to link with "ExampleSpecs":
platform :ios, '6.0'

target :test, :exclusive => true do
    link_with 'ExampleSpecs'

    pod 'Cedar', :local => 'Externals/Cedar', :podspec => 'https://raw.github.com/CocoaPods/Specs/master/Cedar/0.9.0/Cedar.podspec'
end
  1. Run:
  $ pod install
  1. Removed OTHER_LDFLAGS from the build settings for "ExampleSpecs" so that CocoaPods controls this instead.

  2. From now on opening generated ./Example.xcworkspace instead of ./Example.xcodeproj so that CocoaPods "Pods" project is included.

  3. Add ./Pods folder to .gitignore as CocoaPods can regenerate the contents of the folder (and you don't overwhelm your git history with all those dependency files).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment