- 創(chuàng)建索引庫(kù)(如果是推到公共庫(kù),略過(guò))
- 遠(yuǎn)程git倉(cāng)庫(kù)上創(chuàng)建項(xiàng)目(coding、github)
- pod repo add [庫(kù)名] [git地址]
- ps:這個(gè)庫(kù)是私有庫(kù)的索引庫(kù),存儲(chǔ)所有私有庫(kù)的.podspec文件,不存儲(chǔ)具體代碼。
- 創(chuàng)建組件庫(kù)
- 通過(guò)模板快速創(chuàng)建.pod lib create [工程名]
- 如圖提示缺少colored2,使用sudo gem install colored2 安裝
- 配置.podspec文件
- 看參考知名的第三方框架
Pod::Spec.new do |s|
s.name = "JLRoutes"
s.version = "2.1"
s.summary = "URL routing library for iOS with a simple block-based API."
s.homepage = "https://github.com/joeldev/JLRoutes"
s.license = "BSD 3-Clause \"New\" License"
s.author = { "Joel Levin" => "joel@joeldev.com" }
s.source = { :git => "https://github.com/joeldev/JLRoutes.git", :tag => "2.1" }
s.framework = 'Foundation'
s.requires_arc = true
s.source_files = 'JLRoutes', 'JLRoutes/*.{h,m}', 'JLRoutes/Classes/*.{h,m}'
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'
s.tvos.deployment_target = '9.0'
end
打版本號(hào)。pod tag [版本號(hào)] git push --tags
注意點(diǎn):可能會(huì)有配置子模塊的需求,但在實(shí)踐下來(lái)后,不建議這么操作。推薦分成多個(gè)私有庫(kù)。因?yàn)镋xample中是這么引入的pod 'ZHMediator', :path => '../',配置子庫(kù)后,進(jìn)行pod install后,目錄冗余。
- 驗(yàn)證podspec有效性
- pod lib lint本地驗(yàn)證(不會(huì)驗(yàn)證版本號(hào))
- pod spec lint遠(yuǎn)程驗(yàn)證(需要打好正確的版本號(hào))
- 向索引庫(kù)提交索引文件
5.1 如果是私有庫(kù)
pod repo push [索引庫(kù)名][要提交的索引文件.podspec].如果依賴(lài)了非公有庫(kù)的源,依賴(lài)了library,需要參數(shù)中指定源.--sources=[git地址],[第二個(gè)索引庫(kù)]--use-libraries.
5.2 如果是公有庫(kù)
- pod trunk register [郵箱]
郵箱中會(huì)收到一封驗(yàn)證郵件,點(diǎn)擊后提示回到控制臺(tái) - pod trunk push