Delete a version from a private PodSpecs repository? - cocoapods

While creating and publishing my Pod to a private PodSpecs repository, I published several test versions. How can I delete unwanted versions from my private PodSpecs repo?
Note: I am able to delete from the Cocoapods main trunk using the following command:
$ pod trunk delete RPUpdatingLabelFramework 1.16
I am looking for a similar command to delete from my private specs repo.

git commands are the only way to do it. There is not a pod command. See the docs at https://guides.cocoapods.org/terminal/commands.html#group_repos
Feel free to send a PR to CocoaPods to add such a command.

Related

Cocoapods: force latest version download

There is a library I'm using in a project whose podspec is very outdated. As a result, my project seems to be pulling in older files. The library in question is Classy: https://github.com/ClassyKit/Classy
The podspec, which mentions version 0.2.4, has not been updated since 2014. The actual version, however, has some necessary fixes (such as https://github.com/ClassyKit/Classy/pull/97/commits) that come after the podspec update. Rather than moving things around manually, I'd prefer to have cocoapods handle it to make sure the files are in-sync. Problem is that whenever I run "pod update" it claims that the repo is up-to-date.
Simple solutions
You can automatically target latest commit for a specific branch:
pod 'Classy', git: 'https://github.com/cloudkite/Classy.git', branch: 'master'
You can automatically target latest commit with a head specifier (credit to Stalin Kay):
pod 'Classy', git: 'https://github.com/cloudkite/Classy.git', commit: 'HEAD'
You can manually target today's latest commit, in order to freeze your integration to a specific commit:
pod 'Classy', git: 'https://github.com/cloudkite/Classy.git', commit: 'c319908f8bded62e268dfd48ee5d65329b819129'
Cloning alternatives
You can clone the repo, update the .podspec (simply remove reference to tag and set version to '0.0.1'), and target your own repo in Podfile:
pod 'Classy', git: 'https://github.com/atsepkov/Classy.git'
or same thing and target your own .podspec:
pod 'Classy', podspec: 'https://github.com/atsepkov/Classy/blob/master/JSONKit.podspec'
To give you an example, this is exactly what I did here: https://github.com/Coeur/Classy/blob/master/Classy.podspec.
You can also create your own source of your .podspec files, and add the source of it:
source 'https://github.com/atsepkov/Specs.git'
pod 'Classy'
Or you can push your .podspec to CocoaPods trunk under a new name:
pod trunk push ClassyByAlexanderTsepkov.podspec
Old CocoaPods
If you are using CocoaPods 0.39.0 (but it will not work for 1.0.0+ anymore), you can directly use the head command:
pod 'Classy', :head
What will not work
If you target the repo directly, you will be using the latest .podspec of that repo (but that's not enough for your case):
pod 'Classy', git: 'https://github.com/cloudkite/Classy.git'
Contact author
Finally, consider contacting the podspec owner https://twitter.com/cloudkite

Is there a way I can specify a different repository for the CocoaPods master repo?

At my work, we have a private cocoapods repository that we use to host whitelisted libraries for developers, and I am trying to validate a library I wrote.
Whenever i do a pod spec lint MYPODNAME --verbose, CocoaPods tries to validate my spec against the master repo instead of my private repo.
Is there any way to get around this behavior?
I have tried completely removing the master repo, but it still attempts to validate my pod's dependencies against master
EDIT: This issue seems to describe what I am experiencing.
Answering my own question. You have to manually specify the --sources for what CocoaPods will validate the spec against.
pod spec lint MYPODNAME --verbose --sources=git#<DOMAIN>:<REPO>.git

Removing Versions from CocoaPods Specs Repo

I've just published a Beta version of a Pod in the Specs Repo, using pod trunk push. I would like to know if is there any way of removing this version Spec from the Spec Repo. I didn't find any way of doing this via the pod command.
CocoaPods now provides a CLI for deleting pods, it can be done with:
pod trunk delete PODNAME VERSION
Original answer:
Removing specs is highly discouraged. If you push a spec intending to remove it later you shouldn't push it in the first place. This is because if any users are using your spec as soon as you remove it their project will break. If this was an accident you can submit a pull request to the specs repo removing your version. Also worth noting after removing this version you can never again push a spec with the same version number.
You can now delete specific versions of a Pod to correct an accidental push.
pod trunk delete PODNAME VERSION
You can also deprecate an entire Pod and all versions
pod trunk deprecate PODNAME
Reference: https://github.com/CocoaPods/cocoapods-trunk/blob/master/CHANGELOG.md#100beta1-2015-12-30
Note that you need to be using pod version 1.0.0.beta.2 or greater. Run pod --version to check. To install the beta, run sudo gem install pod -v 1.0.0.beta.3 (get the latest version from the ChangeLog)
This is what worked for me:
On GitHub, navigate to the main page of the repository.
Under your repository name, click Releases.
On the Releases page, to the right of the release you want to delete, click Edit.
Delete
source

Use private podspec repo only with Cocoapods

I host a private podspec repo internally, and I would like to use Cocoapods without depending on the public master spec repo. Is there a way to remove dependency on the master spec repo entirely?
The issue is that my company is frozen at cocoapods 0.34.1, and cannot update in time. However, recent changes to the master repo require a min version of 0.35.0. Any time I try to run any pod command, I get the following message.
[!] The "master" repo requires CocoaPods 0.35.0 - (currently using 0.34.1)
I understand what that means, and would like to remove the master repo as a dependency altogether, but it seems like that isn't an option. Any insights?
This created quite the fire drill for us today. We ended up changing our build scripts to run a custom pod install alias, which rolls back the min version in the CocoaPods-version.yml.
alias myPodInstall="sed -i -e 's/min: 0.35.0/min: 0.34.0/' ~/.cocoapods/repos/master/CocoaPods-version.yml; pod install"
Definitely a hack, but it unblocked us as we push for our release. Perhaps this helps others out there in a similar situation.

How to do `pod trunk push` to replace an existing version of podspec

I already did a pod trunk push for a podspec version. Can I push it again and overwrite the existing one?
I tried it but it gives me this error.
$ pod trunk push Parse-iOS-SDK.podspec
Validating podspec
-> Parse-iOS-SDK (1.2.21)
[!] Unable to accept duplicate entry for: Parse-iOS-SDK (1.2.21)
Is there a similar command like git push -f force push it?
Ref:
http://guides.cocoapods.org/making/getting-setup-with-trunk
It is now possible to do this by first deleting the pod, and then re-pushing it:
pod trunk delete NAME VERSION
Then
pod trunk push PODSPEC
There should be a really good reason to do so, however, and the best practice is to never delete versions but instead push new ones (what Keith said).
2017 Edit: You can now delete pods on trunk, see this answer
Previous answer:
You cannot overwrite a spec using trunk. You should just push a new version with your changes. You can also submit a pull request to the specs repo but we recommend just pushing a new version.

Resources