CocoaPods私有库搭建的记录
前言
随着项目的业务增加以及马甲包进度的跟进,一些重复的独立业务以私有库的方式引入到项目中对于项目进度的开发就显得越发的迫切了,本文主要记录自己搭建私有库时的整个流程,以防后面再次搭建时忘记,方便自己查阅。
整个记录流程中私有库的存储是在码云中,也可以在公司自己的git仓库中,自己选择即可。
私有库的搭建涉及到创建索引库和私有库,这里解释下两者:
索引库:存放spec文件的仓库,找到代码位置的索引。
私有库:存放代码的仓库。
两者像指针和对象的关系,指针中存放对象的地址,可以通过指针找到对象。两个仓库创建后,通过命令行将两者关联起来,这样整个私有库的搭建过程就完成了。
1、创建索引库
创建的这个空的仓库,是用来存放我们自己所有的私有库的 spec 文件, 就如同官方的 https://github.com/CocoaPods/Specs 是用来存放所有官方的 specs 文件一样。
2、将索引库添加到本地cocoapods仓库
通过命令行添加自己的索引库到本地仓库
pod repo add wyonSpec https://gitee.com/wyon_wang/wyon-spec.git
添加完毕后查看本地仓库
以上就创建完成了一个自己的索引仓库,该仓库只存放各组件的索引文件,不存放代码!!!
3、创建工程模板
wyondeMacBook-Pro:~ wyon$ cd /Users/wyon/Desktop/TestProject
wyondeMacBook-Pro:TestProject wyon$ pod lib create YGTool
Cloning `https://github.com/CocoaPods/pod-template.git` into `YGTool`.
Configuring YGTool template.
security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.------------------------------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 ]> iOSWhat language do you want to use?? [ Swift / ObjC ]> ObjCWould you like to include a demo application with your library? [ Yes / No ]> YESWhich testing frameworks will you use? [ Specta / Kiwi / None ]> NoneWould you like to do view based testing? [ Yes / No ]> NoWhat is your class prefix?> YG_
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.
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>Running pod install on your new library.Analyzing dependencies
Downloading dependencies
Installing YGTool (0.1.0)
Generating Pods project
Integrating client project[!] Please close any current Xcode sessions and use `YGTool.xcworkspace` for this project from now on.
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod 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 Xcodeopen 'YGTool/Example/YGTool.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`.
wyondeMacBook-Pro:TestProject wyon$
通过该命令行自动创建一个模板工程,其中包含我们所需的索引文件,格式为.podspec。创建完后会自动打开该工程。
4、添加我们的组件到指定目录
这样我们本地私有库完成,接下来制作远端仓库
5、将本地库上传码云
这里是新创建一个项目,为我们真正存放代码的仓库。
我们可以根据码云中的提示上传模板文件
通过命令行上传组件文件
$ git add .
$ git commit -m '模板工程初始化'
$ git push -u origin master
之后我们修改下模板工程中的.podspec文件,如下图
6、验证spec文件
注意这里我们上次的代码一定要走的通,不然会校验失败。
wyondeMacBook-Pro:YGTool wyon$ cd /Users/wyon/Desktop/TestProject/YGTool
wyondeMacBook-Pro:YGTool wyon$ pod lib lint --private-> YGTool (1.0.0)- NOTE | xcodebuild: note: Using new build system- NOTE | xcodebuild: note: Using codesigning identity override: -- NOTE | xcodebuild: note: Build preparation complete- NOTE | [iOS] xcodebuild: note: Planning- NOTE | [iOS] xcodebuild: note: Building targets in parallel- 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')YGTool passed validation.
验证成功后打分支,这里的分支一定要和.podspec文件中的版本号一致
$ git tag 1.0.0
$ git push --tags
7、私有库和索引库建立关联
pod repo push wyonSpec YGTool.podspec
这样就同步好了远程和本地索引库,到这里私有库搭建完毕,可以通过命令行搜索下自己的仓库查看一下
pod search YGTool
CocoaPods私有库搭建的记录相关推荐
- 搭建CocoaPods私有库
基于git搭建CocoaPods私有库 1.创建并设置一个私有的Spec Repo. 2.创建Pod的所需要的项目工程文件,并且有可访问的项目版本控制地址. 3.创建Pod所对应的podspec文件. ...
- git公有转私有_【IT新手之路】客户端组件化之私有库搭建
背景 在组件化之前,小花钱包 App 项目代码,在代码结构,代码质量和层级划分上都处于一个比较乱的状态.这样的项目条件在业务发展不是很快的时候,是可以适应需求的,并且能一定程度地保证开发效率.但随着业 ...
- WMware Harbor 开源 Docker 私有库搭建
WMware Harbor 开源 Docker 私有库搭建 Harbor简介 Harbor 的主要功能 基于角色的访问控制 基于镜像的复制策略 图形化用户界面 支持 AD/LDAP 镜像删除和垃圾回收 ...
- iOS-本地私有库搭建以及远程库制作
spec简介 查看本地pod仓库 ~/.cocoapods/repos Spec文件:描述框架信息 pod setup: 将远程仓库的.spec文件拉取到本地 pod install: 先从本地找到. ...
- CocoaPods私有库创建
CocoaPods私有库创建 参考链接 为什么要使用私有库和私有库索引 对于个人来说,可以进行代码积累.我们在创建新项目,很多基础代码会进行复用,都会引入自己常用的代码.还有一些自定义代码,快速代码, ...
- 关于CocoaPods私有库的那点事情
关于CocoaPods私有库的那点事情 私有库 组件化的基本操作 首先得安装好CocoaPods,不懂的童鞋出门右拐找百度 终端命令都是在podspec所在目录,除了pod lib create和po ...
- maven私有库搭建
一.在企业中基本上都会有自己的maven私有库,主要的目的就是方便依赖包的下载.如果采用远程的方式来实现的话,很多时候会考虑网速问题.如果自己活着公司搭建的私有库,这一样在使用上面会效率更高. 二.私 ...
- 创建Cocoapods私有库
本文以自己在公司做的一个手势密码私有库GesturePasswordKit为例说明. 1.在gitlab(或者github,我这里使用的例子是在gitlab上)上创建git仓库 (确保授权正确,避免后 ...
- Cocoapods 私有库
Cocoapods是非常好用的一个iOS依赖管理工具,使用它可以方便的管理和更新项目中所使用到的第三方库, 以及将自己的项目中的公共组件.(cocoapods的安装请自行百度) 1.创建自己的私有sp ...
最新文章
- 源路由 就是指定数据传输经过这个路由服务器
- PowerBI随笔(4)-关系模型与报表-1
- pg加密扩展的安装_postgresql的加密扩展插件pgcrypto
- Mercurial(Hg)基本操作
- 具有多个查询参数的Camel CXF服务
- mysql填写账户远程_mysql账户添加远程访问
- 我从小米裸辞后进Shopee了...
- 在所有linux版本安装oracle9i
- WPF 从文件加载字体
- 【Python3】py脚本打包成exe
- OpenCV对图片的读写,像素值的访问,修改
- 信道检测手机软件 ios_wifi分析仪如何检测周围wifi信号 wifi分析仪使用方法【详解】...
- Linux 系统日常维护
- 生物识别技术是什么,生物识别技术的比较介绍
- 被开发者和合作商抛弃 Android难现昨日辉煌
- QQ2013登陆界面动态背景资源
- 记一次实验报告:基于Linux的中小型企业网络架构
- 计算机应用大赛作品,全国“xx杯”计算机应用基础类说课大赛优秀作品:文字处理软件应用.ppt...
- 机器学习入门(03)— 激活函数分类(阶跃函数和 sigmoid 函数的理论、实现、显示以及区别、非线性函数、ReLU 函数、tanh 函数)
- 真静态与伪静态的区别,伪静态的实现原理及简单使用