Help us understand the problem. What is going on with this article?

CocoaPods で template file を使う

More than 5 years have passed since last update.

プロジェクト開始時 前回のプロジェクトから Podfile をコピーして使う場合があると思います. しかし, ~/.cocoapods/template にテンプレートファイルをおいておくことで pod init する際にこのテンプレートをもとに Podfileを作成してくれます.

手順

1. 以下の場所にPodfile.default と Podfile.test を用意します.

$ pwd
/Users/u16suzu/.cocoapods/templates

$ ls
Podfile.default Podfile.test

Podfile.default

platform :ios, '6.0'
pod 'AFNetworking'
pod 'UAModalPanel'
pod 'MBProgressHUD'
pod 'BlocksKit'
pod 'Underscore.m'
pod 'MagicalRecord'

Podfile.test

pod 'Kiwi'
pod 'KIF', '~> 2.0'

2. コマンドを実行します.

$ pod init

3. 以下のような Podfile が生成されます.

# Uncomment this line to define a global platform for your project
# platform :ios, "6.0"

target "podTemplateSpike" do
  platform :ios, '6.0'

  pod 'AFNetworking'

  pod 'UAModalPanel'

  pod 'MBProgressHUD'

  pod 'BlocksKit'

  pod 'Underscore.m'

  pod 'MagicalRecord'
end

target "podTemplateSpikeTests" do
  pod 'Kiwi'

  pod 'KIF', '~> 2.0'
end

注意点

~/ にPodfile があると pod init に失敗しますのでご注意ください.

$ pod init
[in /Users/u16suzu]
[!] Existing Podfile found in directory
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away