Cocopods私有库创建(gitLab)

2020-01-18  本文已影响0人  fanren

一、索引库与代码库
要在gitLab创建一个组件库,需要创建两个库:索引库与代码库
索引库:存放spec文件的地方,用于索引到代码的位置。
代码库:指的是我们真正放置组件代码的地方。

二、私有库创建步骤
1.gitLab上创建一个项目(http://52.82.8.87:8088/wanglei/spec.git)用来保存索引库

2.将创建的索引库添加到本地cocoapods仓库

pod repo add Spec http://52.82.8.87:8088/wanglei/spec.git

3.在gitLab上创建代码库(http://52.82.8.87:8088/iOSFrame/WIIIBasicFrame
4.克隆到本地

git clone http://52.82.8.87:8088/iOSFrame/WIIIBasicFrame.git

5.创建组件文件

pod lib create WIIIBasicFrame

6.配置WIIIBasicFrame.podspec文件


7.代码检验

pod lib lint  --private --allow-warnings

检验代码是否有异常,如果有,需要先修复

如果该库中引用了其他的私有库,需要制定引用私有库的源,使用一下命令:

pod lib lint --sources='http://52.82.8.87:8088/wanglei/spec.git,https://github.com/CocoaPods/Specs.git' --private --allow-warnings
// 其中http://52.82.8.87:8088/wanglei/spec.git是引用私有库的源,https://github.com/CocoaPods/Specs.git是cocoapods的源

8.代码提交到远程仓库

git add .
git commit -m "提交代码"
git push 

9.代码库生成tag

git tag 0.1.0(这里的版本号需要与.podspec文件中s.version一致)
git push --tags

删除tag

git tag -d 0.1.0
git push origin :refs/tags/0.1.0

10.索引库与远程代码关联

pod repo push Spec WIIIBasicFrame.podspec --allow-warnings

第一个Spec表示索引库
第二个WIIIBasicFrame.podspec表示代码库

11.成功之后使用


podfile文件

ps:过程中可能会有缓存,使用一下命令删除缓存

pod cache clean WIIIBasicFrame
上一篇 下一篇

猜你喜欢

热点阅读