The original link: blog.skytoup.com/index.php/a…

Old birds can skip…

Warehouse source

Prior to Cocoapods 1.7.2, the first installation required several GIGABytes of repository source initialization (git pull, github source), which was slow to pull and very large.

Later, in 1.7.0, an experimental scheme was proposed to change the git repository source to the CDN repository source, which was officially enabled in 1.7.2.

  • Old warehouse source:https://github.com/CocoaPods/Specs.git
  • New warehouse source:https://cdn.cocoapods.org/

CocoapodsRelated directories and structures

  • ${user directory}/.cocoapods/repos/${repository name}# source warehouse
  • Git source repository structure
    • ${三方库名称}/${版本号}/${spec文件}
  • CDN Source warehouse structure (main structure)
    • all_pods.txtVersion number information for all libraries
    • all_pods_versions_${MD5[0]}_${MD5[1]}_${MD5[2]}.txtMD5(library name)[0...3]Version number information for the shard file repository
      • TXT fileOne library per line, format${library name}/${version number}/${version number}/...

Podfile&The source warehouse&Three party librariesThe diagram

pod update/installPart of the brief process

  1. Local source warehousesynchronousRemote source warehouse(It is strongly recommended thatAdd parameters after the command--no-repo-updateSkip this step and update manually if necessarypod repo update)
  2. Find the appropriate version number in the local source repository by the library namespec(Git and CDN have different source lookup methods)
  3. According to thespecIn thesourceAnd other related parameters (git/svn/hg/httpRepository file (there is a local cache lookup before this step)

Library name lookupspec

  • Git repository source
    • Search based on local directory structureA spec file
  • CDN warehouse source
    1. Tripartite library by nameMD5 (lowercase), the result is taken before3A letter
    2. Access the corresponding local file (all_pods_versions_${MD5[0]}_${MD5[1]}_${MD5[2]}.txt) to find the appropriate version number
    3. Through the linkhttps://cdn.cocoapods.org/Specs/${MD5 [0]} ${MD5 [1]} _ _ ${MD5 [2]} / ${name} warehouse / ${version} / ${name} warehouse. Podspec. JsonTo obtainA spec file

Rust has written a widget to check if the library has a new version based on podfile.lock, which uses the CDN repository source to find versions. If you are interested, check out github.com/skytoup/Pod…

Source warehouse management commands

  • pod repoList the added sources
  • Pod repo add ${source repository local name} ${source repository link}# add source
  • Pod repo remove ${source repository local name}Remove the source, or delete it directly${user directory}/.cocoapods/repos/${repository name}

A link to the

  • 1.7.2 update description: blog.cocoapods.org/CocoaPods-1…
  • Podspec. Source doc: guides.cocoapods.org/syntax/pods…