1.查看本地pod repo
master
- Type: git (master)
- URL: https://github.com/CocoaPods/Specs.git
- Path: /Users/~~~~/.cocoapods/repos/master
taobao-baichuansdk-alibcspecs
- Type: git (master)
- URL: http://repo.baichuan-ios.taobao.com/baichuanSDK/AliBCSpecs.git
- Path: /Users/~~~~/.cocoapods/repos/taobao-baichuansdk-alibcspecs
taobao-baichuansdk-alibcspecsmirror
- Type: git (master)
- URL: http://repo.baichuan-ios.taobao.com/baichuanSDK/AliBCSpecsMirror.git
- Path: /Users/~~~~/.cocoapods/repos/taobao-baichuansdk-alibcspecsmirror
2.使用一个开源git平台如码云 coding github 新建索引库 关联本地pod索引库
pod repo add XCBase https://e.coding.net/minaxc/XC.git
关联后 pod repo 会 发现新增
XCBase
- Type: git (master)
- URL: https://e.coding.net/minaxc/XC.git
- Path: /Users/~~~~/.cocoapods/repos/XCBase
3.新建本地库 进入目标文件
cd /Users/~~~~/Desktop/remoteLib
mrxx:~ mr.xx$ cd /Users/~~~~/Desktop/remoteLib
mrxx:remoteLib mr.xx$ pod lib create XCBase 执行后 会打印
Cloning `https://github.com/CocoaPods/pod-template.git` into `XCBase`.
Configuring XCBase template.
! Before you can create a new library we need to setup your git credentials.
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
What is your email?
> ~~~~~~~~@qq.com
! Setting your email in git to ~~~~~~~~@qq.com
git config user.email " ~~~~~~~~@qq.com"
------------------------------
To get you started we need to ask a few questions, this should only take a minute.
~~~~~~~~~~~ 16:39:39.881 defaults[89553:1355589]
The domain/default pair of (org.cocoapods.pod-template, HasRunBefore) does not exist
If this is your first time we recommend running through with the guide:
- https://guides.cocoapods.org/making/using-pod-lib-create.html
( hold cmd and double click links to open in a browser. )
Press return to continue.
What platform do you want to use?? [ iOS / macOS ]
> iOS
What language do you want to use?? [ Swift / ObjC ]
> ObjC
Would you like to include a demo application with your library? [ Yes / No ]
> Yes
Which testing frameworks will you use? [ Specta / Kiwi / None ]
> None
Would you like to do view based testing? [ Yes / No ]
> No
What is your class prefix?
> XC
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
Running pod install on your new library.
Analyzing dependencies
Downloading dependencies
Installing XCBase (0.1.0)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `XCBase.xcworkspace` for this project from now on.
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
Ace! you're ready to go!
We will start you off by opening your project in Xcode
open 'XCBase/Example/XCBase.xcworkspace'
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`.
mrxx:remoteLib mr.xx$ cd /Users/~~~~~/Desktop/remoteLib/XCBase/Example
mrxx:Example mr.xx$ pod install
Analyzing dependencies
Downloading dependencies
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
成功后可以在EXample文件中pod Install然后运行校验一下编译后看看库文件是否存在bug并且完善库
4.然后进入XCBase将要集成的pod库放入到XCBase中的XCBase目录下的Classes文件中
5.进入remoteLib下的XCBase cd /Users/~~~~~~/Desktop/remoteLib/XCBase
添加远程git库关联 git remote add origin https://e.coding.net/minaxc/XCBase.git
提交并保存代码
并打tag标签
mrxx:XCBase mr.xx$ git tag
mrxx:XCBase mr.xx$ git tag '0.1.0'
mrxx:XCBase mr.xx$ git tag
0.1.0
mrxx:XCBase mr.xx$ git push --tags
最后push上去
6.修改XCBase.podspec 文件
注意点1.
s.version = '0.1.0' 对应提交时添加的tag
s.description = <<-DESC XCBase.日历控件 DESC
s.source = { :git => 'https://e.coding.net/minaxc/XCBase.git', :tag => s.version.to_s }
s.source_files = 'XCBase/Classes/**/*' (默认库文件是Classes目录下的所有文件 如果有特殊需求需要修改这里)!!!
7.pod spec lint 远程校验 pod lib lint 本地校验
如果在校验是出现告警问题 后缀添加 --allow-warnings 例子如下
校验失败
[!] The spec did not pass validation, due to 10 warnings (but you can use `--allow-warnings` to ignore them).
mrxx:XCBase mr.xx$ pod lib lint --allow-warnings
校验成功
Analyzed 1 podspec.
XCBase.podspec passed validation.
8. 校验通过后 mrxx:XCBase mr.xx$ pod repo push XCBase XCBase.podspec 如果有告警问题
提交失败 如下
[!] The `XCBase.podspec` specification does not validate.
mrxx:XCBase mr.xx$ pod repo push XCBase XCBase.podspec --allow-warnings 同样添加 --allow-warnings
提交成功 如下
Updating the `XCBase' repo
Adding the spec to the `XCBase' repo
- [Add] XCBase (0.1.0)
Pushing the `XCBase' repo
!!!注意这里的索引文件一定要配置争取在提交
9.最后可以使用pod集成了 但是需要添加source源路径
source 'https://~~~~~~~/git/~~~~/cocoapods.git'
source 'https://github.com/CocoaPods/Specs.git'
source 'http://repo.baichuan-ios.taobao.com/baichuanSDK/AliBCSpecs.git'
source 'http://repo.baichuan-ios.taobao.com/baichuanSDK/AliBCSpecsMirror.git'
pod 'AMapLocation-NO-IDFA'