Skip to content

Instantly share code, notes, and snippets.

@pietbrauer
Created January 19, 2014 12:06
Show Gist options
  • Select an option

  • Save pietbrauer/8503935 to your computer and use it in GitHub Desktop.

Select an option

Save pietbrauer/8503935 to your computer and use it in GitHub Desktop.

CocoaPods generate command

NOTE: This doc is mainly inspired by the Rails Application Templates documentation.

1. Usage

When using CocoaPods to generate a new Xcode project you can either use our default template or provide one yourself. Templates can be specified with a path or an URL.

$ pod generate Sample http://example.com/my_cocoapods_template.rb

2. Template API

Example:

# my_cocoapods_template.rb
add_asset("Default.png")
git :init
git add: '.'
git commit: %Q{ -m 'Initial commit' }

Or see the full list of features.

2.1 pod(*args)

Adds a pod to the applications Podfile.

NOTE: this does not run pod install

pod 'AFNetworking', '~> 2.0.0'

2.2 pod_group(*targets, &block)

Wraps the pods into the sepcified targets. This can be used to add your test pods to the unit test target.

pod_group :SampleTests do
  pod 'OCMock'
end

2.3 ask(questions)

prefix = ask('What prefix should be used for your files?')
prefix = prefix.uppercase

2.4 yes?(question) no?(question)

pod('install') if yes?('Run pod install ?')

2.5 git(:command)

git :init
git add: "."
git commit: "-a -m 'Initial commit'" 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment