CoCoaPods的原理

创建自己的本地私有库
1.创建本地私有库
2.自己的库内容先放到Classes文件夹,再Classes文件夹放入本地私有库
3.cd 到 目录 git init
4.git add .
5.git commit -m "内容"
6.pod spec create 仓库名

7.修改spec的描述
summary的描述比description多
source 里面的地址不需要
s.exclude_files 注释
8.创建工程
9.pod init
10.在pofile里面写pod "TestSp", :path => "../TestSp"
11.pod install

创建自己的远程私有库
1.创建主工程
2.在github上创建用于存放描述信息.podspec文件的远程私有索引库
3.创建本地私有索引库文件夹 并与远程私有索引库关联
pod repo add 本地私有索引库文件夹名称 github上远程私有库的地址
4.pod repo 查看本地已经存在的索引库

5.在github上创建一个存放基础组件的仓库
6.创建模板测试工程
pod lib create 工程名

7.在测试模板工程文件夹下面 把自己的内容替换掉Classes文件夹内部的内容
8.回到Example路径下 执行pod install操作 检查是否可以执行成功
9.把测试模板工程 提交到远程代码仓库
git status
git add .
git commit -m'基础组件测试工程'
10.修改spec文件里面的内容

11.pod lib lint 进行本地验证
出现BaseComponents passed validation. 就代表验证成功
12.提交spec
git status
git add .
git commit -m '编辑spec文件'
git remote add origin 远程代码仓库地址
git push origin master
git tag '0.1.0' (要与BaseComponents.podspec文件中的tag值保持一致)
git push --tags
13.pod spec lint --allow-warnings进行远程验证
出现 BaseComponents.podspec passed validation.代表验证成功
14.把podspec文件提交到本地的私有索引库
pod repo push 本地私有库文件夹名称 BaseComponents.podspec

15.在需要pod的工程内的podfile文件内添加源
source "http://egit.enovatemotors.com/ios/specs.git"
source "https://github.com/yxy1585391/LMBase.git"
当需要把主库分为多个字库时 修改spec文件

然后执行
git status
git add .
git commit -m'新增Base,Tool文件内容'
git push origin master (提交到远程)
git tag '0.2.0'
git push --tags
pod repo push LMBase BaseComponents.podspec
网友评论