创建一个CocoaPods仓库

Step1 注册 CocoaPods

$ pod trunk register your_github_email 'you_user_name' --verbose
#查看注册信息
pod trunk

Step2 创建 .podspec

$ pod spec create your_libname.podspec

Step3 编辑 .podspec


#
#  Be sure to run `pod spec lint HQSegmentPageViewController.podspec' to ensure this is a
#  valid spec and to remove all comments including this before submitting the spec.
#
#  To learn more about Podspec attributes see https://docs.cocoapods.org/specification.html
#  To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#

Pod::Spec.new do |s|
  s.name     = 'your_libname'
  s.version  = '1.0.0'
  s.license  =  { :type => 'MIT', :file => 'LICENSE' }
  s.summary  = 'your_libname'
  s.homepage = 'https://github.com/your_name/'
  s.author   = 'your_name'
  s.source   = { :git => 'your_git_address', :tag => s.version }
  s.platform = :ios, '9.0'
  s.source_files  = 'your_libname/*.{h,m}' #根据自己的目录结构做修改
  s.requires_arc = true

end

验证.podsepc

# 验证.podsepc文件是否正确
$ pod lib lint 

Step4 给你的github仓库打tag

#创建标签
$ git tag -a 1.0.0 -m 'your_tag_message' 
#推送到远程
$ git push origin --tags

Step5 发布.podspec

pod trunk push your_libname.podspec

参考

https://github.com/TimOliver/TOCropViewController/blob/master/TOCropViewController.podspec
https://www.jianshu.com/p/d2d98298b1b8
https://www.jianshu.com/p/9a5ec24ff437

你可能感兴趣的:(创建一个CocoaPods仓库)