组件仓库创建
1.创建远端仓库 以码云为例
- 创建索引仓库
- 创建组件仓库
2.索引库关联本地
cd ~/.cocoapods/repos
pod repo add GTCompSpec https://gitee.com/guochangzheng/gtcomp-spec.git
复制代码
3.创建文件夹
GTCompTest
复制代码
4.cd文件夹到目录下
cd ~/Desktop/GTCompTest
复制代码
5.创建本地组件模板
pod lib create GTCompDemo
复制代码
创建完成之后会自动打开一个demo工程
- 配置.podspec文件
**6.添加远端组件仓库 **
#添加远程仓库
cd ~/Desktop/GTCompTest/GTCompDemo
git remote add origin https://gitee.com/guochangzheng/gtcomp-demo.git
复制代码
7.本地组件库代码提交
git push -u origin master #第一次可能会报错可尝试用 git push -u origin master -f 可能会覆盖远程的修改
git add . #记得后面一定要有 .
git commit -m "创建我的组件"
git push -u origin master
git tag '0.1.0' #注意:这里的tag号必须和.podSpec文件的版本号一致
git push --tags
复制代码
8.组件库验证
本地验证
pod lib lint --use-libraries --allow-warnings
远端验证
pod spec lint --use-libraries --allow-warnings
复制代码
9.将spec 文件提交到本地的私有仓库,然后再push到远程仓库
pod repo push [xxxSpec] [xxx].podspec --use-libraries --allow-warnings
例如:
pod repo push GTCompSpec GTCompDemo.podspec --use-libraries --allow-warnings
复制代码
10.查看私有仓库
pod search GczMyTest
复制代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END