Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Infra for the CocoaPods CDN

NotificationsYou must be signed in to change notification settings

CocoaPods/cdn.cocoapods.org

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Following the increasing cost and several outages on the Netlify service, it was decided to look for simpler alternatives.

The new build process uses GH Actions to create the static indices and runs roughly every 7 minutes. The result is deployed into a GitHub Pages environment.

How the CDN works

Our CDN works by taking theCocoaPods Specs repo and creating static files which tells the CocoaPods CLI what pods and versions exist currently.

The CocoaPods CLI will use the information from files like:

https://cdn.cocoapods.org/all_pods.txt:

!ProtoCompiler!ProtoCompiler-gRPCPlugin+verify-000110Clock12030112101229Sdk12306DeveCocoa180305Pod19WhereSVProgressHUD1BAIDUSDKSYDemo1PasswordExtension1PasswordExtensionHaha20170610test20180408Test...

There are a set of knownprefixes for all Podspec paths, you take the name of the pod, create a SHA (using md5) of it and take the first three characters.

E,g, for the Podspec name:AppNetworkManager ->222d4d61b20ded1118cedbb42c07ce5f. So, it lives at2/2/2.

the CocoaPods CLI can get a list of versions for all pods which live at2/2/2 from these know indices:

https://cdn.cocoapods.org/all_pods_versions_2_2_2.txt:

AppNetworkManager/1.0.0/1.0.1/1.0.2/1.0.4/1.0.5/1.0.6/1.0.7BIZGrid4plus1CollectionViewLayout/1.0.0ContactsWrapper/0.0.1/0.0.2/0.0.3/0.9/1.0/1.0.1/1.0.2DfPodTest/0.0.1/0.0.2GoogleConversionTracking/1.2.0/2.1.0/3.0.0/3.1.1/3.2.0/3.3.0/3.3.1/3.4.0HZTabbar/0.0.1/0.0.2/0.0.3/0.0.4IAPHelperLV/0.1.0/0.1.1/0.1.2IDLib/0.2.0/0.3.0...

Which means to get a podspec JSON, to ensure the CLI can resolve all your dependencies, then the CLI will make HTTP requests like these:

  • https://cdn.cocoapods.org/Specs/2/2/2/AppNetworkManager/1.0.0/AppNetworkManager.podspec.json
  • https://cdn.cocoapods.org/Specs/2/2/2/ContactsWrapper/0.9/ContactsWrapper.podspec.json
  • https://cdn.cocoapods.org/Specs/2/2/2/IDLib/0.2.0/IDLib.podspec.json

Repeat this process for all the dependencies of your dependencies, and that is enough to be able to download just the Podspecs specs needed for your whole dependency tree. Meaning you don't need to do the full clone of the Specs repo.

How the CDN is implemented

This repo is responsible for generatingall_pods.txt and the sharded indices. That happens inScripts/create_pods_and_versions_index.rb.

These files get pushed to theGitHub Pages branch of this repo.

We then use CloudFlare CDN to redirect incoming URLs either to this repo's GitHub Pages static site, or to ajsDelivr backed copy of the CocoaPods Specs repo based on this re-direct rule:

cdn.cocoapods.org/Specs/* ->https://cdn.jsdelivr.net/cocoa/Specs/$1

This repo does not contain any redirect code as it's not possible to do so in GitHub Pages.

About

Infra for the CocoaPods CDN

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp