美文网首页
Pods 公共库 和私有库创建

Pods 公共库 和私有库创建

作者: Lucky_1122 | 来源:发表于2020-05-13 13:38 被阅读0次

    创建私有库
    一.pod库的创建

    1. 终端 cd Desktop

    2. pod lib create MyWebSocket 会有提示按照提示选择即可

    3. cd 到 ~/Desktop/MyWebSocket/Example

    4. pod install —verbose —no-repo-update

    5. 把要上传的文件放在Example文件同级的MyWebSocket/Classes/文件下 屏幕快照 2020-05-13 下午1.14.51.png
    6. 去码云创建一个私有代码库(https://gitee.com/xxxxx/MyWebsocket.git

    7. 修改podspec

      屏幕快照 2020-05-13 下午1.19.21.png
      summary homepage source(修改仓库地址为第6步码云的仓库地址source:https://gitee.com/xxxxx/MyWebsocket.git) dependency(依赖库)
    8. pod install —verbose —no-repo (更新依赖库)

    9. 引入上传文件看是否能成功

    10. cd 到 example 上一级

    11. 验证本地podspec配置 pod lib lint

    12. 验证不通过就修改podspec, 通过后添加远程地址,即创建码云地址 git remote add origin https://gitee.com/xxxxx/MyWebsocket.git

    13. git add .

    14. git commit —m ‘xx’

    15. git pull origin master --allow-unrelated-histories(远程仓库和本地仓库master分支是不同的分支,需要添加--allow-unrelated-histories)

    16. git push origin master

    17. git tag 0.0.1

    18. git push origin 0.0.1

    19. 在码云在创建一个pods管理库,https://gitee.com/xxxxxx/MyPods.git

    20. 名字一般是带specs 比如 MyPrivateSpecs(私有pods管理库,组件库由它来管理)
      pod repo add MyPrivateSpecs https://gitee.com/xxxxxx/MyPods.git

    21. 把MyWebSocket.podspec发布到私有pods仓库
      pod repo push MyPrivateSpecs MyWebSocket.podspec
      到这里已经创建完成

    更新版本

    修改podspec的version
    git add .
    git commit —m ‘xx’
    git push origin master(这里不需要在关联了 因为已经关联过了)
    把 tag提交到远程仓库
    git tag '0.0.2'
    git push origin 0.0.2
    先验证下 本地的 spec 文件 pod lib lint
    验证远程 spec 文件 pod spec lint
    pod repo
    pod repo push MyPrivateSpecs MyWebSocket.podspec
    (如果有依赖公有库:pod repo push MyPrivateSpecs MyWebSocket.podspec --sources=https://github.com/CocoaPods/Specs.git

    如果依赖公有私有:pod repo push MyPrivateSpecs MyWebSocket.podspec --sources=https://gitee.com/biao_sun/MyPods.git,https://github.com/CocoaPods/Specs.git

    更新完成

    注意

    一.私有库引用私有库的时候
    1.需要在podfile 里面加上source:'https://gitee.com/xxxxxx/MyPods.git' 私有pods仓库地址

    1. s.dependency 'CommonTools(这是依赖的私有库)'

    二. 私有库引用公有库的时候
    1.podfile 添加 source 'https://github.com/CocoaPods/Specs.git'
    2.s.dependency ' s.dependency 'Alamofire', '~> 4.9.0''

    三. 私有库同时依赖公有库和私有库,就需要把私有pods库地址和公有pods仓库地址加在podfile上

    相关文章

      网友评论

          本文标题:Pods 公共库 和私有库创建

          本文链接:https://www.haomeiwen.com/subject/plnooqtx.html