定义私有cocoapods 源

cocoa pods 网站: https://cocoapods.org/
 
1、创建 pod
运行 pod lib create xxx,在运行当前目录创建名称为xxx 的项目,这个过程中会要求填写支持的语言oc or swift,是否创建Demo,选择测试框架等信息。
 
创建成功后修改 .podspec 文件,需要注意的就是 ' 和 "不能是中文符号 ,否则在下面的步骤执行会包语法错误
 
Pod::Spec.new do |s|
  s.name             = "YXHTTPSession"
  s.version          = "0.1.1"
  s.summary          = "A simple network base on NSURLSession."
  s.homepage         = "https://github.com/shuleihen/YXHTTPSession"
  s.license          = 'MIT'
  s.author           = { "zdy" => "shuleihen@126.com" }
  s.source           = { :git => "https://github.com/shuleihen/YXHTTPSession.git", :tag => s.version.to_s }
  s.ios.deployment_target = '7.0'
  s.source_files = 'YXHTTPSession/Classes/**/*'
  s.dependency 'MJExtension', '~> 3.0.10'
end
 
pod spec lint 检测文件是否有问题,并且会检测外部依赖,pod lib lint 只检测文件是否有问题。
 
 
将源码添加到工程class文件夹下面,打上tag为0.1.1 提交到Github上。如何使用git可以查看git使用说明。
 
2、创建私有源 Specs Repo
在git上创建一个空的源地址
git@github.com:shuleihen/Specs.git
 
添加私有源地址
$ pod repo add REPO_NAME SOURCE_URL
 
在~/.cocoapods/repos/ 目录下面可以找到私有源
 
添加pod 到私有源上
$ pod repo push REPO_NAME SPEC_NAME.podspec
 
 
原文地址:https://www.cnblogs.com/shuleihen/p/5541347.html