创建自己的CocosPod库

2018-09-10  本文已影响23人  ElaineYin

打开终端,切换到你要创建的位置的目录,我这里是桌面/desktop/pod
cd desktop/pod

1. 从头开始创建:pod lib create LPodTest

如果存在项目工程,也可以直接进去工程根目录,创建spec文件,指令:pod spec create your_pod_spec_name,不需要手动加 .podspec 后缀

2. git tag操作:(以tag0.1.2为例)

创建分支:git tag -m’Tag 0.1.2’ ‘0.1.2’

查看tag: git tag

推送分支: git push --tags

切换分支:git checkout 0.1.2

删除本地tag: git tag -d 0.1.2

删除远程tag:git push origin –delete tag

3. 修改spec文件

image.png

spec s.source_files要与目录对应

image.png

4. 验证spec文件

本地验证:pod lib lint xx.podspec

远程仓库验证:pod repo lint xx.podspec

注意:第一次创建没推送到仓库,使用远程验证不成功

创建私有仓库:pod repo add MySpecs '私有仓库地址’,创建成功之后 ~/.cocoapods/repos仓库中会出现masterMySpecs两个文件夹,master是cocos公共仓库,MySpecs就是自己创建的仓库

私有仓库验证:pod spec lint --sources='私有仓库repo地址***’

5. 推送到spec仓库:

推送到公共仓库:pod trunk push xx.podspec,如果trunk没有注册,需要先注册,注册之后使用pod trunk me,可以查看注册信息,以及已经发布的资源,成功之后就可以使用pod search xx查询

推送到私有仓库:pod repo MySpecs xx.podspec,其中MySpecs是自己创建的私有仓库

6. 更新

更新指定仓库:pod repo update ****
更新指定的库:pod update ****

上一篇 下一篇

猜你喜欢

热点阅读