私有库管理

1、查看本地仓库

pod repo
iShot_2023-05-06_09.26.52.png

URL:远程仓库地址
Path:本地仓库地址
2、创建远程代码仓TestCloudeStorage。


iShot_2023-05-06_09.46.33.png

3、cd到代码库创建的目录,执行pod lib create 库名,并根据提示选择相应的配置项,就可以创建一个公/私有库的本地仓库了。

$ cd /Users/iss730001004790/Desktop/组建化文档
$ pod lib create TestCloudeStorage

//输出结果:
Cloning `https://github.com/CocoaPods/pod-template.git` into `TestCloudeStorage`.
Configuring TestCloudeStorage 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 name? 
 > yaojun

! Setting your name in git to yaojun
  git config user.name "yaojun"

 What is your email?
 > cocoyaojun@163.com

! Setting your email in git to cocoyaojun@163.com
  git config user.email "cocoyaojun@163.com"

------------------------------

To get you started we need to ask a few questions, this should only take a minute.

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. )


What platform do you want to use?? [ iOS / macOS ]
 > ios

What language do you want to use?? [ Swift / ObjC ]
 > swift

Would you like to include a demo application with your library? [ Yes / No ]
 > yes

Which testing frameworks will you use? [ Quick / None ]
 > quick

Would you like to do view based testing? [ Yes / No ]
 > no
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 Nimble (10.0.0)
Installing Quick (2.2.1)
Installing TestCloudeStorage (0.1.0)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `TestCloudeStorage.xcworkspace` for this project from now on.
Pod installation complete! There are 3 dependencies from the Podfile and 3 total pods installed.

[!] Your project does not explicitly specify the CocoaPods master specs repo. Since CDN is now used as the default, you may safely remove it from your repos directory via `pod repo remove master`. To suppress this warning please add `warn_for_unused_master_specs_repo => false` to your Podfile.

 Ace! you're ready to go!
 We will start you off by opening your project in Xcode
  open 'TestCloudeStorage/Example/TestCloudeStorage.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`.

3、在项目里修改文件,解决报错,运行成功后方可提交。


iShot_2023-05-06_11.12.53.png

4、提交项目到代码仓。

cd TestCloudeStorage
git add .
git commit -m "add CloudeStorageManager"
git push -u origin main

提交完成后,可在github上查看到。


iShot_2023-05-06_13.59.50.png

校验本地

pod lib lint --allow-warnings

//校验成功输出:
TestCloudeStorage passed validation.

5、创建podspec文件远程仓库。


iShot_2023-05-06_09.33.12.png

6、增加

pod repo add YJSpecs https://github.com/helloyaojun/YJSpecs.git

打上tag

git tag '0.1.0'
git push --tag

校验

//如果验证的是私有库,则在后面加上--private,否则会有警告,你可以选择--allow-warnings来忽略该警告
pod spec lint --private --allow-warnings

//如果是以下报错,不用理会,重新执行命令即可。
fatal: unable to access 'https://github.com/yaojun/TestCloudeStorage.git/': Failed to connect to github.com port 443 after 75003 ms: Operation timed out

提交

pod repo push YJSpecs TestCloudeStorage.podspec --allow-warnings

同时需要设置YJSpecs的token

git remote set-url origin https://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@github.com/helloyaojun/YJSpecs.git
git branch -M main

重新执行pod spec lint --allow-warnings,就能通过。

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 在iOS项目开发中,我们制作自己的远程私有库或者开源库,然后用pod方式来安装或者移除比我们手动去删除或者集成更加...
    Sweet丶阅读 1,654评论 0 5
  • 大概步骤 1. 如果没有远程管理私有库就创建一个url私有库,并且拉到本地。 2. 如果需要上传的framewor...
    zcc_ios阅读 402评论 0 0
  • 前沿 由于项目需求不是很紧促以及项目中多使用cocoapod 管理的自己的代码,就在各种博客中,看了许多优秀的文章...
    荷码人生阅读 661评论 0 0
  • 学习到这块知识点时,自己做了如下记录:文章比较长,因为把这四部分放在一起了,方便查看。(1)创建远程私有库(2)添...
    TeeMo_Yan阅读 803评论 2 1
  • 在iOS项目开发中,我们制作自己的远程私有库或者开源库,然后用pod方式来安装或者移除比我们手动去删除或者集成更加...
    周大生_c1b6阅读 432评论 0 0