Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing a private cocoapod with the same name of a public cocoapod

We have a private spec repo. One of our private pods has a dependency to another internal pod called CWFoundation (s.dependency 'CWFoundation', '~> 0.0.1'). The podspec of CWFoundation is only a way of using CWFoundation from jayway (https://github.com/jayway/CWFoundation) as a pod (as it doesn't exist podspec file for it).

Everything was working fine until someone else created a new project in github with the same name, CWFoundation (https://github.com/guojiubo/CWFoundation) and added it to the public repo of cocoapods.

Now our internal pod, when resolves the dependencies, instead of downloading CWFoundation from our private spec repo, downloads the one from the public repo and nothing works.

I read at cocoapods.org that

If you plan on forking a library that is already part of the Master Spec repo, for now we suggest choosing a name that starts with a letter before M

But we're following this rule, the pod is called CWFoundation and starts with 'C' and it doesn't work.

What can I do to retrieve our private podspec file for CWFoundation?

like image 328
Carlos Avatar asked Nov 15 '25 06:11

Carlos


2 Answers

This comment of 'a letter before M' is referring to the name of your private specs repo in ~/.cocoapods/repos. Since ~/.cocoapods/repos/master is the default you want something like ~/.cocoapods/repos/alpha as opposed to ~/.cocoapods/repos/zeta. As long as this is true it should use the first spec that it finds which will be yours before the one in the master specs repo.

EDIT

Based on the comments to my answer this looks like a bug in CocoaPods. Please submit an issue. In the meantime, just renaming your podspec will fix the issue.

like image 110
Keith Smiley Avatar answered Nov 17 '25 22:11

Keith Smiley


Try this:

pod "NameConflictedPod", :source => MY_OWN_SPEC_REPOSITORY, :tag => '0.1'

That works for me.

MY_OWN_SPEC_REPOSITORY is the git URL for your private specs repo. As we know the official default specs repo is https://github.com/CocoaPods/Specs.git.

Hope I described MY_OWN_SPEC_REPOSITORY well.

Warning: This solution specifies the version of the pod. It cannot use version like '~> 0.0.1' which automatically update minor bug fixed version. But...It's kind of not a big deal as the pod is developed by yourself :P

like image 24
ManuQiao Avatar answered Nov 17 '25 22:11

ManuQiao