-
首先在github新建repo
github.png -
clone倉庫至本地
clone.png -
初始化項目
initial.png 創(chuàng)建podspec文件
pod spec create MBMediator https://github.com/MarioBiuuuu/MBMediator.git
podspec.png
- 配置podspec
Pod::Spec.new do |s|
s.name = "MBMediator"
s.version = "0.0.1"
s.summary = ""
s.description = <<-DESC
DESC
s.homepage = "https://github.com/MarioBiuuuu/MBMediator"
s.license = "MIT"
s.author = { "AuthorName" => "AuthorEmail" }
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/MarioBiuuuu/MBMediator.git", :tag => s.version}
s.source_files = "MBMediator", "MBMediator/**/*.{h,m}"
end
s.source_files = ' ' 的多種寫法
ss.source_files = 'MBMediator/Class/*.{h,m}'
表示MBMediator/Class/目錄下的所有 .h 和 .m 文件
s.source_files = 'MBMediator/**/ .'
/后面的 . 應是 星號,MarkDowm語法沖突在此不能正常顯示
表示MBMediator/ 目錄下所有文件,包括子目錄下所有文件。 **/.表示遞歸
當有多個文件時,應用,隔開
s.source_files = 'MBMediator/Class.{h,m}', 'MBMediator/Util*'
- 給項目打tag,并push到遠程倉庫
git tag 0.0.1
push到遠程倉庫
git push origin --tags
- 驗證podspec是否正確
pod lib lint
liblint.png
- pod Trunk注冊
pod trunk register email地址 'MBMediator'
trunk.png
根據(jù)提示前往郵箱確認,然后執(zhí)行
pod trunk me
trunkme.png
- 上傳MBMediator.podspec 到 CocoaPods/repo
pod trunk push MBMediator.podspec
result.png
- 檢驗
pod search MBMediator
- 上傳成功后搜索不到自己的庫怎么辦?
[!] Unable to find a pod with name, author, summary, or descriptionmatching '······'
刪除~/Library/Caches/CocoaPods
目錄下的search_index.json
文件
由于pod setup
成功后會生成~/Library/Caches/CocoaPods/search_index.json
文件。
終端輸入rm ~/Library/Caches/CocoaPods/search_index.json
刪除成功后再執(zhí)行pod search