准备资料
关于pod trunk
1 | ➜ devhhb (master) ✗ pod trunk --help |
补充:
1.查看个人账号信息 $pod trunk me
2.注册账号 $pod trunk register xxx@qq.com [username]
3.查看库信息 $pod trunk info Moya
关于pod lib
1 | ➜ devhhb (master) ✗ pod lib --help |
补充:
1.引入github上的模板创建一个pod库 $pod lib create [pod name]
2.校验本地.podspec
文件是否有效 $pod lib lint [pod name]. podspec
; 若当前终端路径与.podspec文件同级$pod lib lint
即可.
3.校验时, 后面可拼接 忽略警告 --allow-warnings
; 查看详情 --verbose
关于pod spec
1 | ➜ devhhb (master) ✔ pod spec --help |
补充:
1.创建spec文件创建指令$pod spec create [filename]
2.lint
同$pod lib lint
3.打印spec路径$ pod spec which [QUERY]
简述步骤
创建 $pod lib create [pod name]
1 | ➜ Desktop pod lib create testPods |
补充:
1.通过模板创建的项目成功编译后提交推送到github
编辑 podspec
文件
1 | //文件匹配规则 |
模板编辑参考:
1.HBSwiftKit.podspec
2.YYKit.podspec
3.Alamofire.podspec
4.Moya.podspec
补充:
1.编辑完成后先本地校验spec通过, $pod lib lint
或者pod spec lint [NAME.podspec]
. 官方原文如下:
1 | pod lib lint and pod spec lint now have support for building and running your tests automatically when you lint your podspec. For example, linting the CoconutLib.podspec will automatically setup and run your tests provided by the given test specs. If you want to skip this step you may use the --skip-tests flag. |
2.发布$pod trunk push [NAME.podspec]
到Trunk, 这样会制作成公开库, 私有库使用$pod repo push REPO [NAME.podspec]
. 官方原文如下:
1 | Deploying a library |
3.注意spec文件中s.source的引入路径 s.source = { :git => 'https://github.com/xxx.git', :tag => s.version.to_s }
后面关联的是tag
, 且版本号取的是s.version.to_s
; 所以在远端的spec文件中的s.version
必须要有添加的tag
版本号与之对应. 例如: 你更新一个s.version = '0.0.2'
的sepc文件, 那么也应该推送一个带有标签0.0.2
的tag与之对应. 这样才能拉取代码后并匹配相应的tag节点版本
测试Pods
常规测试当然是在项目中引入即可, $pod install
, 另外也可以使用$pod search [pod name]
或者pod search HBSwiftKit --simple
补充:
只是需要注意, 发布后一般需要10多分钟才能生效.大致原因可能与官方下面描述有关:
1 | Documenting a Pod |
相关引用
- 本文作者: 醉疏狂
- 本文链接: https://hubin97.github.io/2021/04/12/制作公开Pods/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!