美文网首页
Cocoapods私有库实现

Cocoapods私有库实现

作者: 54be30d2931c | 来源:发表于2018-06-21 11:20 被阅读7次
    1. 使用pod命令来自动创建工程
    pod lib create TestKit
    
    1. 新建私有git库 gitlab/github
    2. 添加私有库到本地pod库
    pod repo add TestKit http://git.xxx.com/xxx/xxx.git
    
    1. 检查效果
    cd ~/.cocoapods/repos
    

    这里除了master之外,新增了一个TestKit文件夹

    1. 修改TestKit.podspec文件
    2. 检测pod库是否可用
    pod lib lint
    pod lib lint --allow-warnings // 如果有警告可以使用命令忽略
    
    TestKit.podspec passed validation. // 成功提示
    
    1. 开发代码 -> 打Tag -> 提交Git -> Push
      注意:这里.podspec 中的version必须跟git所打tag版本一致
    //  具体情况,使用对应的命令
    git add --all
    git commit -m "update podspec"
    git push origin master
    git tag 0.0.1      // TestKit.podspec中的version必须跟git所打tag版本一致
    git push --tags
    
    1. 提交本地库,向Spec Repo提交podspec
    pod repo push TestKit TestKit.podspec
    pod repo push TestKit TestKit.podspec --allow-warnings // 如果有警告可以使用命令忽略
    
    1. 测试一下pod搜索
    pod search TestKit
    

    注意:如果确定以上都做对了,还是搜索不到,如下

    $ pod search TestKit
    [!] Unable to find a pod with name, author, summary, or description matching `TestKit `
    

    这是需要把缓存删掉

    rm ~/Library/Caches/CocoaPods/search_index.json
    

    再次测试

    1. 使用
    pod "TestKit", :git => "http://git.xxx.com/xxx/xxx.git"
    

    相关文章

      网友评论

          本文标题:Cocoapods私有库实现

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