CocoaPods 系列之一 制作公開庫
CocoaPods 系列之二 更新公開庫
CocoaPods 系列之三 Podspec 語法說明
CocoaPods 系列之四 Podspec subspec
CocoaPods 系列之五 Private Pods(譯文) 制作私有庫
CocoaPods 系列之六 Private Pods 制作私有庫從0到1
CocoaPods 系列之七 我遇到的驗證不過
準備知識:
Mac電腦,碼云管理私有庫,當前電腦能訪問這個私有庫
1 創建工程,創建倉庫,編寫代碼
- 分享出去的庫文件要放在根目錄上
- 使用MIT 根目錄包含LICENSE文件
2 推送代碼,打tag
git tag -a '0.0.1' -m '初始化工程'
push origin 0.0.1
3 在根目錄創建podSpec文件
pod spec crate TestSpec
4 編寫 podSpec文件
Pod::Spec.new do |s|
s.name = "Oli"
s.version = "0.0.1"
s.summary = "This is a Test"
s.description = <<-DESC
A short description of Oli. Test Spec
DESC
s.homepage = "http://www.lxweimin.com/p/d9281e576c22"
s.license = "MIT"
s.author = { "haohaisheng" => "haohaisheng95@163.com" }
s.source = { :git => "https://gitee.com/haisenv/OliOli.git", :tag => s.version}
s.source_files = "Oli", "Oli/*/.{h,m}"
end
4 驗證 pod lib lint
如果輸出 Oli passed validation. 沒有問題
5 添加私有Repo
pod repo add HaishengSpec git@gitee.com:haisenv/test_private_library.git
6 把私有庫添加到Repo中
pod repo push HaishengSpec Oli.podspec
- 這個命令會執行3個動作 更新本地Repo , 把spec添加到repo,推送到遠程倉庫
pod repo push HaishengSpec BJDownload.podspec --allow-warnings
*如果想忽略警告,可以使用這個命令
7 pod search 不到
刪除/資源庫/Caches/CocoaPods/search_index.json ,不刪除可能pod search 不到
8 創建測試工程 pod init ,編寫 Podfile
- pod 'Oli', :git => 'git@gitee.com:haisenv/OliOli.git' ,:branch => 'dev'
這種方式不做第5,6都能夠成功; pod install即可
8 刪除本地的私有庫
pod repo remove [name]
*方式二 在Podfile中添加
source 'https://gitee.com/haisenv/test_private_library.git'
pod 'Oli'
然后pod install即可