Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a private CocoaPod as a dependency in another pod .podspec file?

I am working on a private pod and that is dependent on other private pod. So i just want to mention it in my pod .podspec file.

Its looks like this in .podspec file of pod2.

s.dependency 'Pod1', '~> 0.0.1' , :git => 'https://github.com/MY_COMPANY/pod1.git', :commit => '9f9f4fe5b5959e0f2ea89e472eccf7aea6f37eea'

And i came to know that "there is no :git and :commit options in podspec dependency specifier" so if not then how to achieve that thing?

like image 262
kidsid49 Avatar asked Sep 10 '14 07:09

kidsid49


People also ask

What is private pod?

CocoaPods is a great tool not only for adding open source code to your project, but also for sharing components across projects. You can use a private Spec Repo to do this.

How to specify the source of dependencies in CocoaPods?

According to this CocoaPods/issues/2485, CocoaPods/issues/922, the podspecs cannot specify the source of dependencies now. Just use s.dependency 'Apollo/WebSocket', '~> 0.0.1' directly. Free feel to follow this blog's step to create ( pod repo push) a private library.

How do I add a private spec to my CocoaPods Repo?

Add your Private Spec Repo to your CocoaPods installation $ cd ~/.cocoapods/repos/REPO_NAME $ pod repo lint . < 3. Add your Pod's Podspec to your repo Make sure you've tagged and versioned your source appropriately, then run: This will run pod spec lint, and take care of all the little details for setting up the spec in your private repo.

How to get dependencies from a podspec?

NEXT: Podspec's don't tell you where to get the dependencies, just that your pod has them. BUT...the pod lib lint or pod repo push validations WILL look for the dependency in whatever podspec repos you specify (defaulting to just the public CP one). Fine for public depedencies but for local unhosted development ones it won't be able to find them.

How do I set up private pods for my project?

There are a few steps to getting a private pods setup for your project; creating a private repository for them, letting CocoaPods know where to find it and adding the podspecs to the repository. < 1. Create a Private Spec Repo To work with your collection of private pods, we suggest creating your own Spec repo.


1 Answers

You have to maintain a repository for your private podspecs.

Add that repository to your CocoaPods installation:

pod repo add MyPrivateSpecs [email protected]:MyPrivateSpecs

Add your private dependency pod to it:

pod repo push MyPrivateSpecs Pod1

Now you can simply reference that pod like you normally would:

s.dependency 'Pod1', '~> 0.0.1'
like image 56
Tom Erik Støwer Avatar answered Oct 21 '22 05:10

Tom Erik Støwer