CocoaPods如何存储不同版本的pod zip链接? [英] How does CocoaPods stores pod zip links in different versions?
问题描述
我有一个专用的CocoaPods框架,因为它是一个iOS框架,所以我必须将其压缩并放入s3中才能下载.
I have a private CocoaPods framework, because it is a iOS framework, I have to zip it and put into s3 to be able to download.
最后看起来像这样:
Pod::Spec.new do |s|
s.name = "XXX"
s.version = "1.0.1"
s.homepage = "https://bitbucket.org/XXX"
s.summary = "XXX"
s.description = "XXX"
s.license = "Commercial"
s.author = "XXX"
s.source = { :http => "https://s3-ap-southeast-2.amazonaws.com/XXX.zip" }
s.platform = :ios, "9.0"
s.swift_version= "4.1"
s.ios.vendored_frameworks = "XXX.framework"
end
每次更新框架时,我都会压缩一个新的 .framework
文件,然后使用完全相同的URL替换可下载的zip文件: https://s3-ap-southeast-2.amazonaws.com/XXX.zip
.
Every time I update my framework, I will zip a new .framework
file then replace the downloadable zip file with exact same url: https://s3-ap-southeast-2.amazonaws.com/XXX.zip
.
上传后,我执行 pod push YYY xxx.podspec
将podspec推送到另一个中央pod spec存储库中.
After it's been uploaded, I do pod push YYY xxx.podspec
to pushes the podspec into my another central pod spec repository.
我想知道的是,如果使用此框架的开发人员将其从 1.0.0
更新为 1.0.1
.CocoaPods将从该完全相同的链接下载最新的 framework
.如果开发人员想要回滚到 1.0.0
,该怎么办?CocoaPod在哪里/如何存储zip的旧(所有)版本?
What I am wondering is, if the developer who uses this framework update it from 1.0.0
to 1.0.1
. CocoaPods will download the latest framework
from that exact same link. What if the developer wants to roll back to 1.0.0
? where/How does CocoaPod stores the old (all) versions of the zip?
推荐答案
您需要在服务器上托管不同版本的框架,并为此提供不同的podspec:
You need to host on your server the different versions of your framework, and so give the different podspecs:
旧版本
s.version = "1.0.0"
s.source = { :http => "https://s3-ap-southeast-2.amazonaws.com/XXX-1-0-0.zip" }
当前版本:
s.version = "1.0.1"
s.source = { :http => "https://s3-ap-southeast-2.amazonaws.com/XXX-1-0-1.zip" }
等等
s.version = "1.5.1"
s.source = { :http => "https://s3-ap-southeast-2.amazonaws.com/XXX-1-5-1.zip" }
这样,当您在 pod install
/ pod update
中使用podspec时,开发人员将获取正确的源.
This way, when you use the podspec with pod install
/pod update
the developer will fetch the correct sources.
我给他们起了一个可能的名字.另外,您可以对尚未公开的"pre-versions"使用不同的名称,以免用户猜测地址而直接下载"它们.
I gave a possible naming for them. Also, you could use the different for "pre-versions" not yet public, to avoid users to "download them" before hand by guessing the address.
这篇关于CocoaPods如何存储不同版本的pod zip链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!