I try to add a dependency from private repo to podspec. But it doesn't work.
After run the command > pod repo push MyLib MyLib.podspec
[!] Invalid MyLib.podspec
file: [!] Unsupported version requirements. Updating CocoaPods might fix the issue.
# from MyLib.podspec:16
# -------------------------------------------
# s.dependency 'ReachabilitySwift'
s.dependency 'MyPrivateLib', :git => 'https://bitbucket.org/nghiaphunguyen/myprivatelib'
# -------------------------------------------
P/S: MyPrivateLib posted to the cocoapod via. https://guides.cocoapods.org/making/private-cocoapods.html
Nghia,
Thanks
You can't specify source requirements in the podspec, only a version requirement.
@segiddins i see but if i do that, how the podspec understand my private repo?
I just can add a public dependency ?
Just add a normal dependency, the source used will come from the command line or the Podfile, depending on the command run.
what the format i should use to run the command > pod repo push MyLib MyLib.podspec to add another source?
the guy is asking about "private" pod. How we can add a private pod dependency into .podspec file?
pod repo push
allows you to define the private sources you want to refer to during the push - https://guides.cocoapods.org/terminal/commands.html#pod_repo_push
Adding a little more color to @orta's comment: https://guides.cocoapods.org/making/private-cocoapods.html
@orta How does using the pod repo push command work with an example project using the pod that is using relative file paths?
when you run pod lib lint you should config --sources=https://github.com/private-repo-name.git,and same when pod repo push ,like this pod lib lint name.podspec --sources=https://github.com/CocoaPods/Specs.git,192.168.0.100:Plutoy/Specs.git here is the article http://www.pluto-y.com/cocoapod-private-pods-and-module-manager/
Thanks!
I am also having this same issue,
@nghiaphunguyen did you any find the appropriate solution for this ??
Our Problem is, that the there is a private pod with the same name as a spec inside the master-spec-repo. Sure, I can pass the sources via the command line, but this does not solve the issue if you got naming conflicts.
is there any update on this?
@rahulOYO in that case, I guess we have to deploy our Podspecs to our private specs repo with pod repo push REPO [NAME.podspec]
instead of specifying dependency source in Podspec.
I just advanced my pod use to need a hierarchy of private pods. As stated above, there is no way to specify a private path in a podspec, only a version. The task of defining a path is pushed to the users of those pods, just like regular use of private pods. I feel that is a big burden once the private hierarchy gets complex.
My biggest issue is that if the pods were public, then the user wouldn't have to specify that pod relationship at all - it would just come with the pod install. Instead for private pod hierarchies, each podfile would need to know inside details of all the pods they use. That's a lot of complexity.
Obviously once a pod is uploaded to GitHub and made private or public this issues is simplified. The git lint tools would have to strip out a private path.
It sure seems this is a valid and important feature for CocoaPods to explore.
Thanks,
@segiddins this issue should be re-opened or declared as feature request.
Why specifiying podspec is allowed from Podfile:
pod "MyPrivateSDK", :podspec => "https://raw.githubusercontent.com/MyPrivateSDK/master/MyPrivateSDK.podspec"
But not from from podspec dependency :
s.dependency "MyPrivateSDK", :podspec => "https://raw.githubusercontent.com/MyPrivateSDK/master/MyPrivateSDK.podspec"
How to deal with "non-public" dependencies in podspec file ?
Most helpful comment
the guy is asking about "private" pod. How we can add a private pod dependency into .podspec file?