美文网首页
ios创建私有库

ios创建私有库

作者: 画舫烟中浅 | 来源:发表于2018-03-07 09:18 被阅读0次

1.创建framework,并把本地代码上传到远端代码仓库Gitlab,创建远端仓库的时候 记得 添加证书 LICENSE文件,

2.创建配置文件的远端仓库,也就是Spec仓库, 记得 添加证书LICENSE文件

3.把远端的配置文件的仓库 spec  clone到本地  通过终端  命令代码为:

  pod repo add testRepo https://gitee.com/zhouzheren/TestRepo.git

其中:  testRepo为文件名字  https://gitee.com/zhouzheren/TestRepo.git 为仓库地址

4.用终端命令 cd到 本地的代码仓库,通过终端指令 pod spec create  创建.podspec文件  例如:pod spec create PrivateLibiary  创建了PrivateLibiary.podspec文件

5.设置PrivateLibiary.podspec文件中的内容    大概为:

Pod::Spec.new do |s|

s.name        = "PrivateLibiary" # 项目名称

s.version      = "0.1.1"        # 版本号 与 你仓库的 标签号 对应

s.license      = "MIT"          # 开源证书

s.summary      = "私有库创建测试" # 项目简介

s.homepage    = "http://10.134.150.205/yanghao/PrivateLibiary" # 仓库的主页

s.source      = { :git => "http://10.134.150.205/yanghao/PrivateLibiary.git", :tag => "#{s.version}" }#你的仓库地址,不能用SSH地址

s.requires_arc = true # 是否启用ARC

s.platform    = :ios, "8.0" #平台及支持的最低版本

s.ios.vendored_frameworks = "PrivateLibiaryTest.framework"

# User

s.author            = { "画舫烟中浅" => "yanghao0405@163.com" } # 作者信息

s.social_media_url  = "https://www.jianshu.com/u/dea3cd9fc359" # 个人主页

end

6.把PrivateLibiary.podspec文件上传到 配置文件的仓库 就可以了

例如:pod repo push privateRepo PrivateLibiary.podspec

其中 privateRepo为配置文件仓库的名字  即为隐藏文件.cocoapods目录下的文件

        PrivateLibiary.podspec 为要上传的东西  即为.podspec文件

补充:pod lib lint指令可以测试编辑的.podspec文件是否正确  使用这个命令先要cd到.podspec目录

            上传本地代码仓库的时候一定要记得  打上 tag  并且  tag值与上传的.podspec文件中s.version保持一致,tag值是用来区分同一个私有库不同的版本的

            终端命令  打tag  cd到代码仓库  git tag -m “first release” “0.1.0”

            Git push - -tags

私有库的更新

1.更新你的framework,并上传至代码库

2.上传后给项目打一个tag值

3.修改.podspec文件中的tag值,与你所打印的tag值要对应

4.上传你修改后的.podspec文件到你的配置仓库

相关文章

网友评论

      本文标题:ios创建私有库

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