一、索引庫創(chuàng)建
1、在遠(yuǎn)程創(chuàng)建索引文件倉庫(索引庫倉庫用來存放所有私有庫每個(gè)版本的所有文件)

image.png
2、將索引文件倉庫添加到本地:
$ pod repo add <倉庫名稱> <遠(yuǎn)程索引倉庫地址>
3、輔助命令行
1、查看本地倉庫
$ pod repo
2、刪除本地倉庫
$ pod repo remove <name>
二、podsepc文件的創(chuàng)建以及使用
1、創(chuàng)建.podsepc文件,在私有庫路徑下(podsepc文件名和私有庫名稱一致)
pod spec create <名稱>
2、podsepc文件格式
Pod::Spec.new do |spec|
spec.name = "QCLibTest"
spec.version = "0.0.4"
spec.summary = "QCLibTest"
spec.description = "A short description of QCLibTest"
spec.homepage = "https://gitee.com/name/QCLibTest"
spec.license = "MIT"
# spec.license = { :type => "MIT", :file => "FILE_LICENSE" }
spec.author = { "name" => "email" }
spec.source = { :git => "git@gitee.com: name/QCLibTest.git", :tag => "#{spec.version}" }
spec.source_files = "QCLibTest/Class/**/*.{h,m}"
#spec.exclude_files = "Classes/Exclude"
end
三、私有庫提交Git倉庫
1、在git服務(wù)下建立一個(gè)私有庫倉庫,Clone到本地,然后添加私有庫文件并提交代碼;
2、在私有庫文件下創(chuàng)建sepc文件,注意版本號(hào)設(shè)置;
3、提交后,針對(duì)每個(gè)提交的額版本打tag,注意tag的版本號(hào)和sepc文件內(nèi)的版本號(hào)要一致
1、打tag標(biāo)記
$ git tag -m '一些tag信息描述' '版本號(hào)(0.0.1)'
2、提交tag
$ git push --tags
四、更新遠(yuǎn)程索引庫和本地索引庫
1、在第一步所建立的git遠(yuǎn)程索引倉庫的對(duì)應(yīng)私有庫版本列表中,添加剛剛提交的私有庫版本的spec文件
2、執(zhí)行pod repo update 更新本地索引庫
五、引用私有庫的項(xiàng)目的podfile文件配置:
// 在引入私有庫時(shí),會(huì)將遠(yuǎn)程的索引庫倉庫自動(dòng)拷貝到本地,不用手動(dòng)處理
source 'https://gitee.com/name/QCLibPodSpecs.git'
source 'https://cdn.cocoapods.org'
#source 'https://github.com/CocoaPods/Specs.git'
# platform :ios, '9.0'
target 'QCLibTestDemo' do
// 以下三種文件導(dǎo)入方式效果一樣
# pod 'QCLibTest', :git => 'https://gitee.com/name/QCLibTest.git', :tag => '0.0.4'
# pod 'QCLibTest', :git => 'git@gitee.com: name/QCLibTest.git', :tag => '0.0.3'
pod 'QCLibTest'
end