CocoaPods publication - bonkey/zalando-commerce-ios GitHub Wiki
In short: CocoaPods is a centralized repository consist of library specifications. They're defined in .podspec files. This has implications for the way how is it used.
Naming
Names of pod subcommands could be a little bit obnoxious, so
calypso.rb uses different naming. Hopefully, it doesn't make the
things more complex. Let's compare:
calypso.rb command |
pod equivalent |
|---|---|
./calypso.rb pod validate --local |
pod lib lint ZalandoCommerceUI.spec \ ZalandoCommerceAPI.spec |
./calypso.rb pod validate |
pod spec lint ZalandoCommerceAPI.specpod spec lint ZalandoCommerceUI.spec |
./calypso.rb pod publish |
pod trunk push ZalandoCommerceAPI.specpod trunk push ZalandoCommerceUI.spec |
Validation / linting
NOTE: Don't bump version number before the validation, as it will
fail on ZalandoCommerceUI because it requires ZalandoCommerceAPI with same version
published.
Pods could be validated in two ways:
-
What's in the working directory - to briefly check changes before you commit:
pod lib lint ... -
What's in the repo - to check changes before you publish:
pod spec lint ...It's always called internally by
poditself insidepod trunk push.
Calypso distinguishes them only by --local parameter. When it exists,
it runs pod lib lint internally. Otherwise, it runs pod spec lint.
See Naming for details.
Publication
./calypso.rb pod publish [--silent] [--verbose]
Runs pod trunk push for ZalandoCommerceAPI.podspec and ZalandoCommerceUI.podspec, which updates podspecs in CocoaPods repository.
Support for pod try
CocoaPods allows to quickly try a demo project from the Pod
without any integration, setups, configurations, creating a projects or so. For end-developer it's basically enough to run pod try (or a little bit more.
To provide such seamless integration ZalandoCommerceDemoApp project contains Podfile,
which is utilized internally by pod try command only.
Podfile does not contain dependencies only, but also have code to modify ZalandoCommerceDemoApp project to remove manual dependencies that are used on daily basis during the development. It's correct, as it happen only in local
copy of the project prepared by pod try.
Additionally, Podfile conflicts with behaviour of Buddybuild, which automatically runs pod install, when the file is found, but it's handled – see more about it in Buddybuild#cocoapods-and-carthage
Cheatsheet
Registration
Any new collaborator needs to register themselves in Cocoapods repository (once):
pod trunk register YOUR_EMAIL 'YOUR_NAME' --description='YOUR_WORKSTATION'
And click confirmation email.
Adding collaborators
To allow other developers publish podspecs you need to add them as owners:
pod trunk add-owner ZalandoCommerceAPI COLLABOLATOR_EMAIL
pod trunk add-owner ZalandoCommerceUI COLLABOLATOR_EMAIL