创建自己的CocoaPods库
来源:互联网 发布:网络设置(2g) 编辑:程序博客网 时间:2024/05/18 11:40
创建自己的CocoaPods库
前期准备:
准备好自己的代码库,本文以github上的代码库为例,可参考作者的工程:LYCopyLabel。
注册trunk(已注册过的请跳过):
// 升级pods至最新版本$ sudo gem install cocoa pods// 进行注册 邮箱和GitHub用户名字$ pod trunk register example@xxx.com 'GithubUserName' --verbose // 根据提示点击邮箱链接进行验证 完成注册
查看注册是否成功:
$ pod trunk me //返回如下表示注册成功- Name: GithubUserName- Email: example@xxx.com- Since: May 13th, 11:19- Pods: None- Sessions:
正式开始
创建
.podspec
仓库文件://创建仓库文件$ pod spec create LYCopyLabel// 返回如下Specification created at LYCopyLabel.podspec
编辑
.podspec
文件,可以根据内容提示自己编辑,也可以参考比较知名的三方库的该文件进行编辑。$ vim LYCopyLabel.podspec//编辑文本 Pod::Spec.new do |s|s.name = "LYCopyLabel"s.version = "1.0.1"s.summary = "Sub Class of UILabel to make the label enable to be copyed when long pressed"s.homepage = "https://github.com/liuyang20091130/LYCopyLabel"s.license = 'MIT's.author = { "liuyang20091130" => "example@xxx.com" }s.platform = :ioss.platform = :ios, "5.0"s.source = { :git => "https://github.com/liuyang20091130/LYCopyLabel.git", :tag => "#{s.version}" }s.source_files = "CopyLabel/LYCopyLabel/*.{h,m}"s.public_header_files = "CopyLabel/LYCopyLabel/*.h"
使用
pod lib lint
验证.podspec
文件的正确性。若出现错误需根据提示执行第2步进行修改。//执行pod lib lint LYCopyLabel.podspec//正确返回-> LYCopyLabel (1.0.1)LYCopyLabel passed validation.
有可能出现的提示:
- WARN | source: The version should be included in the Git tag.
,则需要给git添加tag。tag要与.podspec
文件中s.source :tag
相同。$ git tag '1.0.1' $ git push --tags
推送pod代码库到远程仓库,耐心等待返回。
//执行pod trunk push LYCopyLabel.podspec //返回如下表示成功-> LYCopyLabel (1.0.1) Sub Class of UILabel to make the label enable to be copyed when long pressed pod 'LYCopyLabel', '~> 1.0.1' - Homepage: https://github.com/liuyang20091130/LYCopyLabel - Source: https://github.com/liuyang20091130/LYCopyLabel.git - Versions: 1.0.1 [master repo]ESCOC-------------------------------------------------------------------------------- �� Congrats �� LYCopyLabel (1.0.1) successfully published �� May 13th, 11:59 �� https://cocoapods.org/pods/LYCopyLabel �� Tell your friends!
使用
pods search
搜索自己的pod库验证下,大功告成。$ pod search LYCopyLabel// 返回如下,大功告成。-> LYCopyLabel (1.0.1)Sub Class of UILabel to make the label enable to be copyed when long pressedpod 'LYCopyLabel', '~> 1.0.1'- Homepage:https://github.com/liuyang20091130/LYCopyLabel- Source: https://github.com/liuyang20091130/LYCopyLabel.git- Versions: 1.0.1 [master repo]
0 0
- 创建自己的Cocoapods库
- 创建自己的CocoaPods库
- 创建自己的Cocoapods
- cocoapods创建自己的共有库
- CocoaPods创建自己的pod
- CocoaPods创建自己的pod
- CocoaPods创建自己的开源库和私有库
- 创建自己的CocoaPods的Spec仓库
- 配置自己的CocoaPods库
- 配置自己的CocoaPods库
- 配置自己的CocoaPods库
- 配置自己的CocoaPods库
- 配置自己的CocoaPods库
- 发布自己的CocoaPods库
- 在CocoaPods上创建自己iOS程序的依赖管理
- 上传自己的库到Cocoapods
- 在CocoaPods上制作自己的库
- 用CocoaPods 建立自己的库类
- 5-12 功夫传人
- 字符流练习
- node.js安装
- python 发送post请求
- 2小时学会springboot
- 创建自己的CocoaPods库
- mysql 导入txt文件中文乱码
- iOS小技巧总结,绝对有你想要的(下)
- RPM包的制作
- NodeJs安装与使用入门
- Python安装与使用
- iOS 进阶(一)block 与 property
- 二叉树的遍历
- fragment中实现listView的滑动隐藏toolbar