1. 注册coding.net代码托管平台,并创建项目作为spec索引库
2. 本地生成秘钥
- 生成秘钥
ssh-keygen
liutiesongdeMacBook-Pro-2:~ liutiesong$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/liutiesong/.ssh/id_rsa):
/Users/liutiesong/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/liutiesong/.ssh/id_rsa.
Your public key has been saved in /Users/liutiesong/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:rfVoZyXXXXXXiXXXXXXXXXXXXXXXXXXXXrcYeBV4 liutiesong@liutiesongdeMacBook-Pro-2.local
The key's randomart image is:
+---[RSA 3072]----+
|oO@E o |
|+Boo= |
|oE=+ . |
| =o * . |
|o..* + S d |
| .+ + + p 0 |
| o + o + + |
| . o+ + o |
| ...=o. |
+----[SHA256]-----+
- 查看公钥文件路径
公钥在.pub文件中,复制出公钥到平台对应的ssh设置中!](https://img.haomeiwen.com/i3692367/ccba8746c26c2c92.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2. 找到本地spec索引库
查看私有库
pod repo
关联远程库
pod repo add CYOCBasePod git@e.coding.XXXXXXX/specs/specs.git
pod repo可以查看是否添加成功
3. 创建代码文件托管库
4. 上传库前的准备操作
# 本地新建远程库文件,并且cd 到目录下
cd /Users/liutiesong/Desktop/remoteLib
# 创建远程库文件
pod lib create CYOCBasePod
会提示输入内容
What platform do you want to use?? [ iOS / macOS ]
> iOS
What language do you want to use?? [ Swift / ObjC ]
> ObjeC
Possible answers are [ 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?
> cy
Running pod install on your new library.
Analyzing dependencies
Downloading dependencies
Installing CYOCBasePod (0.1.0)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `CYOCBasePod.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 'CYOCBasePod/Example/CYOCBasePod.xcworkspace'
运行完会生成一个demo工程并自动打开,找到replaseme文件,并将文件替换掉
- cd到example文件目录下
pod install
编译没问题则可以进行后续提交操作了
5. 提交封装好的代码到远程私有库
- 先修改podspec文件
- 关联并提交代码
# cd到生成的demo文件中
cd /Users/liutiesong/Desktop/remoteLib/CYOCBasePod
# 查看提交状态
git status # (如果是红色需要提交到暂存区)
git add .
git commit -m '初始版本提交'
#关联版本库
git remote add origin https://e.coding.net/cyfactory/cy_oc_basepod/cy_oc_basepod.git
- 打tag版本标签
git tag '0.1.0'
git push --tags
如果有问题,确认代码无误可以进行强制提交(慎用)
git push -f origin master
- 修改后验证下spec文件是否正确
- 本地验证
liutiesongdeMacBook-Pro-2:CYOCBasePod liutiesong$ pod lib lint
-> CYOCBasePod (0.1.0)
- NOTE | xcodebuild: note: Using new build system
- NOTE | xcodebuild: note: Building targets in parallel
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
- NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
- NOTE | [iOS] xcodebuild: note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'CYOCBasePod' from project 'Pods')
- NOTE | [iOS] xcodebuild: note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
- NOTE | [iOS] xcodebuild: note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')
CYOCBasePod passed validation.
liutiesongdeMacBook-Pro-2:CYOCBasePod liutiesong$
- 远程验证
liutiesongdeMacBook-Pro-2:CYOCBasePod liutiesong$ pod spec lint
-> CYOCBasePod (0.1.0)
- NOTE | xcodebuild: note: Using new build system
- NOTE | xcodebuild: note: Building targets in parallel
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
- NOTE | [iOS] xcodebuild: note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'CYOCBasePod' from project 'Pods')
- NOTE | [iOS] xcodebuild: note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
- NOTE | [iOS] xcodebuild: note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')
- NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
Analyzed 1 podspec.
CYOCBasePod.podspec passed validation.
liutiesongdeMacBook-Pro-2:CYOCBasePod liutiesong$
6. 将spec提交到本和远程私有库
- 先查看私有库是否存在
liutiesongdeMacBook-Pro-2:CYOCBasePod liutiesong$ pod repo
CYOCBasePod
- Type: git (master)
- URL: git@e.coding.net:cyfactory/specs/specs.git
- Path: /Users/liutiesong/.cocoapods/repos/CYOCBasePod
master
- Type: git (master)
- URL: https://git.coding.net/CocoaPods/Specs.git
- Path: /Users/liutiesong/.cocoapods/repos/master
trunk
- Type: CDN
- URL: https://cdn.cocoapods.org/
- Path: /Users/liutiesong/.cocoapods/repos/trunk
3 repos
liutiesongdeMacBook-Pro-2:CYOCBasePod liutiesong$
- 将spec文件提交到本地私有库
pod repo push CYOCBasePod CYOCBasePod.podspec
liutiesongdeMacBook-Pro-2:CYOCBasePod liutiesong$ pod repo push CYOCBasePod CYOCBasePod.podspec
Validating spec
-> CYOCBasePod (0.1.0)
- NOTE | xcodebuild: note: Using new build system
- NOTE | xcodebuild: note: Building targets in parallel
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
- NOTE | [iOS] xcodebuild: warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
- NOTE | [iOS] xcodebuild: note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'CYOCBasePod' from project 'Pods')
- NOTE | [iOS] xcodebuild: note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'Pods-App' from project 'Pods')
- NOTE | [iOS] xcodebuild: note: Execution policy exception registration failed and was skipped: Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted" (in target 'App' from project 'App')
Updating the `CYOCBasePod' repo
Adding the spec to the `CYOCBasePod' repo
- [No change] CYOCBasePod (0.1.0)
Pushing the `CYOCBasePod' repo
liutiesongdeMacBook-Pro-2:CYOCBasePod liutiesong$
7. 检测
pod search CYOCBasePod
-> CYOCBasePod (0.1.0)
CYOCBasePod.
pod 'CYOCBasePod', '~> 0.1.0'
- Homepage: https://cyfactory.coding.net/p/cy_oc_basepod/
- Source: https://e.coding.net/cyfactory/cy_oc_basepod/cy_oc_basepod.git
- Versions: 0.1.0 [CYOCBasePod repo]
(END)
网友评论