您的位置:首页 > 其它

创建私有Cocoapods库

2015-07-27 18:20 281 查看

环境:

1、CocoaPod 0.36.4
2、xcode6
3、注册好的代码管理网站Coding(https://coding.net),其他的也可以


步骤

在coding上创建一个空的仓库

本地创建pod工程文件:

命令如下:pod lib create SLTest4

上传到远程仓库

git add.

git commit -m “init pod”

git remote add origin https://git.coding.net/shulong/SLTest4.git

git push -u origin master

添加tag

git tag -m “first tag” “0.1.0”

git push –tags

编辑Podspec Metadata中的podspec文件编辑好的内容如下

Pod::Spec.new do |s|
s.name             = "SLTest4"
s.version          = "0.1.0"
s.summary          = "A private pod test"
s.description      = <<-DESC
a private pod test
DESC
s.homepage         = "https://coding.net/u/shulong/p/SLTest4/git"
s.license          = 'MIT'
s.author           = { "LiuShulong" => "bigfish_liu@126.com" }
s.source           = { :git => "https://git.coding.net/shulong/SLTest4.git", :tag => s.version.to_s }
s.platform     = :ios, '7.0'
s.requires_arc = true

s.source_files = 'Pod/Classes/**/*'
s.resource_bundles = {
'SLTest4' => ['Pod/Assets/*.png']
}
end


name指的是该pod的名字,version为pod的版本,summary和description为概述和描述,homepage直接位仓库的主页,license一般MIT,source_files为要添加的pod代码的位置,具体的可查阅官网,这里的注释最好去掉,否则后边可能引起错误

6.有效性检测:pod lib lint,当出现 -> SLTest4 (0.1.0)

SLTest4 passed validation.

表示检测通过,进入下一步

7.向spec提交podspec

pod repo add SLTest4 https://git.coding.net/shulong/SLTest4.git

pod repo push SLTest4 SLTest4.podspec

8.使用Podfile如下

platform :ios, ‘7.0’

source “https://git.coding.net/shulong/SLTest4.git

pod “SLTest4”

最后:如果升级或删除某个pod,则pod repo remove XXX

链接:

创建pod

使用私有pod lib创建
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: