私有pod制作

两个仓库

1.代码仓库 code repository

这个仓库是用来存放代码的,正常提交就可以,流程:
1 创建pod项目建议使用pod提供的模板:

pod lib create youNameBase

成功之后会生成项目结构:


WX20210604-181732.png

编辑podSpec文件:

Pod::Spec.new do |s|
  s.name             = 'Library'
  s.version          = '0.1.5'
  s.summary          = 'Library'
  s.description      = 'Library description'
  s.homepage         = 'xxxxx'
  s.author           = { 'xx' => '[email protected]' }
  
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  s.source           = { :git => '该地址是代码仓库的git地址', :tag => s.version.to_s }
end

代码提交

// 正常编写代码,提交之后,打tag、且push tag
$ git add .
$ git commit -m "创建Library组件库"      #提交修改到本地仓库
$ git remote add origin [git仓库地址]    #关联本地仓库与代码远端仓库
$ git pull origin master   #拉取远程仓库代码
$ git push origin master   #提交到代码远端仓库

# 注意:这个很重要
# 打上标签并且与podSpec中的tag保持一致
$ git tag -m "first create release" "0.1.1"
$ git push --tags


# 相关操作----------------------

# 删除本地tag
$ git tag -d v3.1.0
# 删除远程tag
$ git push origin :refs/tags/v3.1.0

2.配置仓库

创建本地spec库、关联远程spec库、校验合法性、push到远程:

// 查看本地有哪些关联的远程仓库
pod repo

// 添加本地仓库并且管理到远程仓库(一定要注意,这个是关联远程的spec仓库,不是代码仓库)
// pod repo add ABCLibrary https://XXXX
pod repo add 本地仓库名称 sourceUrl

// 关联之后,再次 pod repo 就能看到关联的仓库
// 之后就可以根据本地仓库的名字推送podspec配置到远程

// 在podspec 目录下 校验本地的podspec是否合法
pod lib lint --allow-warnings

// 该命令是把podspec文件推送到远程的配置仓库中
pod repo push 本地仓库名称 xxx.podspec --allow-warnings

3.常见问题:

1.cannot load such file -- xcodeproj:

pod lib create proName 
log:
Cloning `https://github.com/CocoaPods/pod-template.git` into `AirstarCommon`.
Configuring AirstarCommon template.
:85:in `require': cannot load such file -- xcodeproj (LoadError)
    from :85:in `require'
    from /Users/zbchen/Documents/Dev/Library/LibraryCode/AirstarCommon/setup/ProjectManipulator.rb:1:in `'
    from ./configure:5:in `require_relative'
    from ./configure:5:in `block in 
' from ./configure:4:in `each' from ./configure:4:in `
' To learn more about the template see `https://github.com/CocoaPods/pod-template.git`. To learn more about creating a new pod, see `https://guides.cocoapods.org/making/making-a-cocoapod`. // 解决: gem install xcodeproj

2.not added the source repo that hosts the Podspec to your Podfile.:

// 私有pod依赖三方pod的使用:
Unable to find a specification for `Toast` depended upon by `AirstarCommon`

You have either:
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

// 要注意是不是souce 引入的问题:
source 'https://github.com/CocoaPods/Specs.git'

你可能感兴趣的:(私有pod制作)