美文网首页
cocoapod远程私有库

cocoapod远程私有库

作者: 刘铁崧 | 来源:发表于2020-08-29 12:59 被阅读0次

1. 注册coding.net代码托管平台,并创建项目作为spec索引库

coding.net

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]-----+

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文件是否正确
  1. 本地验证
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$ 
  1. 远程验证
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)

8. 使用

相关文章

  • cocoapod远程私有库

    1. 注册coding.net代码托管平台,并创建项目作为spec索引库 coding.net 2. 本地生成秘钥...

  • Cocoapod搭建私有库详细教程

    Cocoapod搭建私有库详细教程 一、准备工作 创建两个私有远程仓库 WYSpec 和 WYLib-- WYSp...

  • 如何发布自己的pods框架

    创建CocoaPod私有库的详细步骤 一. 远程索引库 概念:每创建一个组件都会带有一个 xxx.podspec ...

  • 组件化(第二篇)

    组件化 一、本地私有库方案优化二、远程私有库三、如何使用远端私有库四、远程私有库的升级五、远程私有库依赖问题六、远...

  • 如何创建CocoaPod私有仓库

    创建私有pod仓库和源代码仓库 团队所有开发人员需将远程私有仓库地址添加到CocoaPod 检查CocoaPod记...

  • iOS--本地私有库和远程私有库(三) --- ⅰ

    (三)敲重点!!远程私有库来了! ⅰ.远程私有库演示(本篇) ⅱ.远程私有库升级+优化 铺垫一:Category文...

  • cocoapod远程私有库升级迭代

    将修改后的文件放入Classes文件夹内,cd到Example文件目录下,并安装 修改spec文件将版本号更新 c...

  • iOS组件化开发远程私有库

    一、本地化私有库 工程创建好之后可以用作本地私有库,通过path来引入本地私有库 二、远程私有库 创建远程私有库,...

  • iOS--本地私有库和远程私有库(三) --- ⅱ

    (三)敲重点!!远程私有库来了! ⅰ.远程私有库演示 ⅱ.远程私有库升级+优化(本篇) 铺垫:本篇中的一些文件命名...

  • 组件化三:远程私有库

    远程私有库跟本地私有库的区别就是 先看看那远程私有库的原理 先创建一个远程的库,把本地的库关联到远程的库中,然后修...

网友评论

      本文标题:cocoapod远程私有库

      本文链接:https://www.haomeiwen.com/subject/sfwcsktx.html