第一步:cd到项目(HDCryptorTools)目录下,执行以下命令创建podspec文件
pod spec create HDCryptorTools
第二步:执行第一步后,会创建出HDCryptorTools.podspec文件,修改该文件配置:如下:
#
# Be sure to run `pod spec lint HDCryptorTools.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see https://guides.cocoapods.org/syntax/podspec.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#
Pod::Spec.new do |spec|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in depth.
#
spec.name = "HDCryptorTools"
spec.version = "0.0.1"
spec.summary = "A short description of HDCryptorTools."
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
spec.description = <<-DESC
TODO: Add long description of the pod here.
DESC
spec.homepage = "https://github.com/Harden-Lee/HDCryptorTools"
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.author = { 'Harden-Lee' => '363182580@qq.com' }
spec.source = { :git => 'https://github.com/Harden-Lee/HDCryptorTools.git', :tag => spec.version.to_s }
spec.ios.deployment_target = "9.0"
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# CocoaPods is smart about how it includes source code. For source files
# giving a folder will include any swift, h, m, mm, c & cpp files.
# For header files it will include any header in the folder.
# Not including the public_header_files will make all headers public.
#
spec.source_files = "HDCryptorTools", "HDCryptorTools/*.{h,m}"
end
特别说明一下:spec.name :项目名;spec.version:项目版本; spec.homepage:项目主页;spec.source :项目资源下载地址
第三步:执行以下命令进行验证,成功会提示"HDCryptorTools passed validation"
pod lib lint HDCryptorTools.podspec --allow-warnings
第四步:在Github上创建release版本
配置选项并点击“publish release”创建,版本号要与podspec文件里的版本号一致
第五步:注册CocoaPods账号:
pod trunk register orta@cocoapods.org 'Orta Therox' --description='macbook air'
执行命令后会提示邮箱认证,进入邮件点连接确认,然后就可以回到终端执行第六步
备注:
-
orta@cocoapods.org
修改成自己的邮箱 -
'Orta Therox' 修改成自己的用户名(可以任意填)
-
--description='macbook air' 可以不改,也可以修改为--verbose (修改为—verbose执行命令会有提示)
第六步:检查账号是否创建成功
pod trunk me
第七步:检查文件格式有效性
pod spec lint --allow-warnings
第八步:上传代码到CocoaPods
pod trunk push HDCryptorTools.podspec --allow-warnings
第九步:检查上传是否成功
pod search HDCryptorTools
网友评论