What exactly does `pod repo update` do?

可紊 提交于 2019-12-18 11:38:06

问题


I'm following an internet tutorial on Firebase and as part of it I had to do some work in the command line. I'm pretty comfortable with the command line, but I'm unfamiliar with Cocoapods. I ran pod repo update but after doing so I realized I ran it on my entire Documents folder of my Mac instead of the folder that contained my project. I took over 20 mins to execute and it printed out literally thousands of things when it finally completed, some of which included "create" and "deleted". I was kind of concerned- would running this command have modified anything in my Documents besides the Firebase project? And what does pod repo update even do for that matter?


回答1:


As per the documentation pod repo update updates the spec repos located at ~/.cocoapods/repos in your home folder.

Updates the local clone of the spec-repo NAME. If NAME is omitted this will update all spec-repos in ~/.cocoapods/repos.

The repo is basically a list of all pods and versions available. I have just encountered an error in our CI builds because the repo did not include a spec for a library I have just added. By running pod repo update it now knows of this newer version and can continue to install it.

So to answer your question.. Running pod repo update in your documents folder will not do anything in that folder. It will update its pod spec references in your ~/.cocoapods/repos folder only.




回答2:


The main cocoapods repo is nothing but a list of ALL podspecs. A podspec is:

A specification describes a version of Pod library. It includes details about where the source should be fetched from, what files to use, the build settings to apply, and other general metadata such as its name, version, and description.

The specs directory is nothing but a list of all distinct podspecs. Each version of the podspec is under a tag directory. The repo doesn't contain the pod itself. The repo contains the podspec. The podspec gives the location of the repo.

spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }

When you do pod repo update, you're pulling the latest podspecs (not the actual pod) from https://github.com/CocoaPods/Specs

Cocoapods master repo:

The list of some Alamofire podspecs

A single podspec 4.7.3:



来源:https://stackoverflow.com/questions/43701352/what-exactly-does-pod-repo-update-do

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!