组件化开发 发布自己的 CocoaPods
1.注册自己的 cocoapods 账号
pod trunk register xxxxxxxx@163.com 'name' --verbose
2.确认邮件
[!] Please verify the session by clicking the link in the verification email that has been sent to you_email
注:用qq邮箱注册 可能在垃圾箱里
3.确认是否注册成功
$ pod trunk me
- Name: foolish-an
- Email: xxxxxxxxxx@163.com
- Since: May 28th, 03:25
- Pods: None
- Sessions:
- May 28th, 03:25 - October 3rd, 21:31. IP: 163.127.64.39
4. 创建仓库
在github上创建自己的仓库
创建完成后clone到本地
5.创建.podspec
文件
$ pod spec create 仓库名 (不加后缀名)
6.编辑 .podspec文件
必要信息:
Pod::Spec.new do |s|
s.name = "DLShadowView"
s.version = "0.0.1"
s.summary = "A simple tool"
#s.description = <<-DESC
# DESC
s.homepage = "https://github.com/foolish-an"
s.license = "MIT"
s.author = { "xxxxxxxxxxxx@163.com" => "xxxxxxxxxxxx@163.com" }
s.platform = :ios, "8.0"
s.source = { :git => "https://github.com/foolish-an/DLShadowView.git", :tag => "0.0.1" }
s.source_files = "DLShadowView/*.{h,m}"
end
7.验证.podspeec 文件
$ pod lib lint
8.创建标签 推送代码
注意标签要与.podspeec文件里边version 保持一致
9.发布到cocoapods
pod trunk push DLShadowView.podspec
踩坑注意:github创建仓库要选择license 为MIT类型
s.source_files 文件路径是相对于.podspec 文件的
** 是匹配所有目录
,* 匹配文件
,.{h,m} 匹配后缀是 .h 或 .m 的文件
s.source_files = "DLShadowView/*.{h,m}"
若你的目录下还有很多子目录比如 util, tool, 可以写成
s.source_files = "Classes/util/*.{h,m}"
s.source_files = "Classes/tool/*.{h,m}"
s.source_files = "Classes/**/*.{h,m}"