将自己的框架上传到cocoapods远程
1、开发框架 ,并将开发好的框架通过git上传到远程仓库 并 打tag
2、创建 spec 文件
$ pod spec create 名称 (和代码名称保持一致就可以)
qjsxqTestLib git:(master) pod spec create qjsxqTestLib
3、修改 spec 文件
Pod::Spec.new do |spec|
spec.name = "qjsxqTestLib"
spec.version = "0.0.1"
spec.summary = "xxxxxxx"
spec.description = <<-DESC
详细描述,这个要比 spec.summary长才可以
DESC
spec.homepage = "https://github.com/qjsxq121/lqTestLib"
spec.license = "MIT"
spec.author = { "李强" => "18363827786@163.com" }
spec.platform = :ios, "10.0"
spec.source = { :git => "https://github.com/qjsxq121/lqTestLib.git", :tag => "0.0.1" }
spec.source_files = "Classes", "Classes/**/*.{h,m}"
spec.exclude_files = "Classes/Exclude"
end
4、去CocoaPods官网注册https://guides.cocoapods.org/making/getting-setup-with-trunk.html
pod trunk register 18363827786@163.com 'liqiang' --description='liqiang'
5、将spec文件上传到 远程cocoapods
pod trunk push qjsxqTestLib.podspec --allow-warnings
然后搜索pod search qjsxqTestLib 就可以搜到了
如果搜索不到可以删除本地cocoapods的索引文件再搜索,
位置在 /Users/lq/Library/Caches/CocoaPods
(search_index.json)的文件
cocoapods 管理本地私有库
1、将本地仓库添加git 管理(不用上传远程)
2、创建 spec 文件
Pod::Spec.new do |spec|
spec.name = "PersonLib"
spec.version = "0.0.1"
spec.summary = "xxx"
spec.description = <<-DESC
xxxxxxxxxxxxxxx
DESC
#不一样的地方
spec.homepage = "http://EXAMPLE/PersonLib"
spec.license = "MIT"
spec.author = { "李强" => "liqiang@mammoth.ink" }
spec.platform = :ios, "10.0"
#不一样的地方
spec.source = { :git => "", :tag => "#{spec.version}" }
spec.source_files = "Classes", "Classes/**/*.{h,m}"
然后使用
target 'Test' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# 代表,到时候寻找 ,会到某个路径下面 找一个 PersonLib.podspec文件
pod 'PersonLib' , :path => '../PersonLib'
target 'TestTests' do
inherit! :search_paths
# Pods for testing
end
target 'TestUITests' do
# Pods for testing
end
end
网友评论