美文网首页
ios 私有库创建

ios 私有库创建

作者: sunghui | 来源:发表于2019-07-27 21:14 被阅读0次

一.创建私有库的索引库

    1.git上创建私有索引库

        拿到私有库的索引地址(https://github.com/***/Repo.git)

    2.在本地添加一个自己的远程索引库(路径为上一步拷贝的项目路径) 

       pod repo   add Repo    https://github.com/***/Repo.git

       cocoapods本地仓库路径(command + shift + G)  ~/.cocoapods/repos

    可以查看创建好的本地索引pod repo list

二.创建远程代码库

    1.在git 上创建远程代码库 

        拿到远程库地址(https://github.com/***/SSKits.git)

    2.创建本地代码库

        (1).pod lib create SSKits

           (2).将需要的组件类放到项目的Classes目录下,资源放到Assets

            (3).cd 到项目的Example 下 pod install 编译是否报错

            (4).修改.podspec的内容

              (5).进入项目目录推送到github上

                  git remote add origin 远程代码仓库地址

                  git push origin master  (git push -u origin master 第一次上传)

                  git add .

                  git commit -m “xxx"

                  git tag 版本号 (注:这里的版本号必须和podspec里写的版本号一致,也就是1.0.0)

                  git push --tags

               (6).cd 到项目目录 对组件进行本地验证 和远程验证

                    pod lib lint  --use-libraries --allow-warnings 本地验证

                    pod spec lint  --use-libraries --allow-warnings 远程验证

               (7).pod repo push 本地索引  **.podspec --use-libraries --allow-warnings

***操作中遇到了一个问题

                   项目没有初始化, 这个时候git仓库是空的,需要我们在~/cocoapods/repo/xxxx 下添加一个初始文件,例如添加个readme.md

                   解决方法:

                  检查./git/config 文件中git地址是否正确

                  初始化项目,执行

                 git config --globaluser.name"git用户名"git config --globaluser.email"邮箱"cd TJRepotouch README.mdgit add README.mdgit commit -m"add README"git push -u origin master

   之后再pod repo push 本地索引  **.podspec --use-libraries --allow-warnings即可。

            (8).可以 pod search ****(如果搜不到,不是没传成功,是我们的本地搜索库没更新,可以先删除,如果遇到下边问题可以在终端执行rm ~/Library/Caches/CocoaPods/search_index.json)

三.更新组件 (修改组建的specs版本号)

git add .

git commit -m'更新描述'

git push origin master

git tag -a'新版本号'-m'注释'

git push --tags

更新索引库

pod repo push 索引库名称 xxx.podspec

四.使用

    podfile 引用本地repo 地址 即可使用

********   git pull //这里直接用pull,相当于拉取。

然后,等待一会,就可以更新成功了。

相关文章

网友评论

      本文标题:ios 私有库创建

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