Podfile语法: https://www.jianshu.com/p/8a0fd6150159
cocoapods 高级使用:http://tech.yunyingxbs.com/article/detail/id/272.html
如何用 trunk 开源代码 http://blog.youkuaiyun.com/codingfire/article/details/52470802
git tag 用法 http://blog.youkuaiyun.com/jeffasd/article/details/49863335
github sourceTree 管理开源库 https://www.cnblogs.com/zhanglinfeng/p/6283178.html
pod 本地库:
http://blog.youkuaiyun.com/veryitman/article/details/51407078
https://www.jianshu.com/p/8af475c4f717
一键发布:
https://juejin.im/entry/58df270f61ff4b006b1227c9
常用的命令:
//提交
git add -A;
git commit "内容更新"
git commit -m "如果当前有变化,先提交到git上,再创建tag"
//删除 原来无用的 tag
git tag -d 1.0.0
git push origin :refs/tags/1.0.0
//打tag
git tag 1.0.0
git push --tags
git push origin master
//验证
pod lib lint XXXX.podspec --allow-warnings
pod trunk push XXXX.podspec --allow-warnings
//删除 search_index.json
/Users/mac/Library/Caches/CocoaPods/search_index.json
使开源库支持pod search
步骤 【一】:
1.用户名邮箱注册,为github的用户名和绑定邮箱(下面的内容替换为自己的):
pod trunk register lc081200@163.com 'this is you password' --verbose
如果报错,一般是pod版本低或者ruby的版本低,根据错误百度。
2.查看是否注册成功
pod trunk me
如果成功,pod trunk me 后提示:
步骤 【二】:
1、git 里面建立仓库,并clone 到本地,(重要:里面有建立仓库初始化的 README、.gitignore、LICENSE 和隐藏文件等。)
2.在clone 克隆下的文件夹里面,导入开源工程 demo 的代码, 里面包含了要开源的文件。
3、创建 .podspec文件
创建方法:终端 cd 到要创建 的文件路径下 至执行:
pod spec create LCFontManager 默认会有一些内容:
简单写法可以参考我的:https://github.com/iRemark/LCCopybook/blob/master/LCFontManager.podspec
复杂写法可以参考开源库 AFNetworking 或百度具体的说明。
可以通过vim来打开文件操作,博主一般用电脑的文本编辑打开,打开后看到的内容有很多,博主只保留了基本的信息,如下:
//特别说明,里面的注释是博主为了大家知道什么意思加的,实际使用时一定要去掉
Pod::Spec.new do |s|
//文件名
s.name = 'LCFontManager'
//版本
s.version = '1.0.0'
//描述信息
s.summary = '简介 一下 这个开源库'
//这里的主页自己随便写
s.homepage = 'https://i.cnblogs.com/EditPosts.aspx?postid=8318325'
//作者
s.authors = { 'iRemark' => 'lc081200@163.com' }
//资源路径
s.source = { :git => 'https://github.com/iRemark/LCCopybook.git', :tag => '1.0.1' }
//ARC模式
s.requires_arc = true
//license,一般我们用MIT
s.license = 'MIT'
//允许的最低系统使用版本
s.ios.deployment_target = '7.0'
//库文件路径
s.source_files = 'LCFontManager/*'
end
一定要小心引号,之类的 中英文、圆角半角、错误。
步骤 【三】:
1. 验证编辑 的.podspec
是否通过
pod lib lint LCFontManager.podspec
通过截图:
2. 验证通过后, 才能代码 上传到 github
git commit -m "如果当前有变化,先提交到git上,再创建tag"
3.打tag 提交:
//如果原来的tag不想要了,删除 原来无用的 tag
git tag -d 1.0.0
git push origin :refs/tags/1.0.0
//打 tag
git tag 1.0.0
git push --tags
git push origin master
//提交
pod trunk push XXXX.podspec --allow-warnings
提交时会提示输入账号密码,按照自己的github的账号密码来输入。
成功后提示:
4. 搜索提交的库
pod search LCFontManager
如果成功 上传,然后却搜索不到 :保存提示:
[!] Unable to find a pod with name, author, summary, or description matching `xxx`
解决方法就是Finder前往资源库去删除缓存中的search_index.json
/Users/mac/Library/Caches/CocoaPods/search_index.json
里面环节要求比较严格,环节出错情况比较多。出错了不可怕,百度下错误提示。