創建cocoapods 私有庫。
pod lib create BlinkingLabel
創建模板,后面可以考慮直接拿創建好的模板修改一下來使用BlinkingLabel.podspec
修改該文件中的配置
s.version // 版本號,采用 ruby 版本號規則
s.homepage // 自己的遠程倉庫地址
s.source // 自己的遠程倉庫地址pod lib lint BlinkingLabel.podspec
驗證 創建的 庫關聯遠程庫
git add .
git commit -m “Initial Commit"
git remote add origin https://github.com/<GITHUB_USERNAME>/BlinkingLabel.git // replace <GITHUB_USERNAME> with your github.com username
git push -u origin masterpod lib lint BlinkingLabel.podspec --verbose --allow-warnings
再次驗證Pods/BlinkingLabel/Pod/Classes/ 中添加代碼文件
pod install // 可以將代碼文件自己引入工程中cd Example 文件, 安裝自己的庫
pod install推送自己的 本地庫 到遠程庫中
git tag 0.1.0 // 這里的版本號 要跟 BlinkingLabel.podspec 保持一致
git push origin 0.1.0pod spec lint BlinkingLabel.podspec --verbose --allow-warnings 最后一次驗證
創建遠程索引庫:https://git.dev.tencent.com/Flyfishering/WBBSpace.git
pod repo // 查看本地索引庫pod repo add 本地索引庫的名字 遠程索引庫 // 本地索引庫跟遠程索引庫名字起一樣的 都叫 WBBSpace
在 finder 路徑 用戶/.cocoapods/repos 中可以驗證是否添加成功將本地索引文件推送到遠程索引庫中
pod repo push WBBSpace BlinkingLabel.podspec --verbose --allow-warnings //提交索引文件到遠程索引庫。可以在新 項目中使用該 庫了
cd 項目路徑
pod init
打開 Podfile,
1. 添加 source 'https://git.dev.tencent.com/Flyfishering/WBBSpace.git'
2. 添加 pod 'BlinkingLabel'
pod install // 就可以使用了
更新 pod 庫版本
- 修改庫代碼
- 修改 BlinkingLabel.podspec 版本號
s.version = '0.1.3' - 更改 git tag 版本號 推送到 遠程倉庫
git tag 0.1.3 // 這里的版本號 要跟 BlinkingLabel.podspec 保持一致
git push origin 0.1.3 - 驗證
pod spec lint BlinkingLabel.podspec --verbose --allow-warnings - 更新遠程 索引庫
pod repo push WBBSpace BlinkingLabel.podspec --verbose --allow-warnings
項目中使用 新版本的庫
- 修改項目 Podfile 中的配置
pod 'BlinkingLabel','0.1.3' - pod install , 就更新到了最新版本庫
pod 只識別 git 的 tag 標簽