Publish your opensource cocoapods

栏目: IOS · 发布时间: 5年前

内容简介:这个不用多说,你可以创建自己的项目丢一些东西进去,可以是一个工程,后续将决定你把那一部分内容开源出去。打上tag备用若未注册,执行以下命令,邮箱以及用户名请对号入座。

Github上创建自己的仓库

这个不用多说,你可以创建自己的项目丢一些东西进去,可以是一个工程,后续将决定你把那一部分内容开源出去。

提交自己的变更

打上tag备用

git tag "v1.0.0"  
git push --tags

注册

pod trunk me

若未注册,执行以下命令,邮箱以及用户名请对号入座。

pod trunk register example@example.com 'example'  --verbose

创建.podspec

配置文件

pod spec create yourname

eg:

#  Be sure to run `pod spec lint YJTouchID.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 http://docs.cocoapods.org/specification.html
#  To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/

Pod::Spec.new do |s|

  # ―――  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.
  #

  s.name         = "YJTouchID"
  s.version      = "0.0.2"
  s.summary      = "A Easy Way To Use YJTouchID."

  # 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!
  s.description  = "快速集成TouchID 到当前项目中。A Easy Way To Use YJTouchID:smile:"

  s.homepage     = "https://github.com/Asingers/YJTouchID"
  # s.screenshots  = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"


  # ―――  Spec License  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Licensing your code is important. See http://choosealicense.com for more info.
  #  CocoaPods will detect a license file if there is a named LICENSE*
  #  Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
  #

  # s.license      = "MIT"
  s.license      = { :type => "MIT", :file => "LICENSE" }


  # ――― Author Metadata  ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Specify the authors of the library, with email addresses. Email addresses
  #  of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
  #  accepts just a name if you'd rather not provide an email address.
  #
  #  Specify a social_media_url where others can refer to, for example a twitter
  #  profile URL.
  #

  s.author             = { "zhangyuanjie" => "309954331@qq.com" }
  # Or just: s.author    = "zhangyuanjie"
  # s.authors            = { "zhangyuanjie" => "309954331@qq.com" }
  # s.social_media_url   = "http://twitter.com/zhangyuanjie"

  # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  If this Pod runs only on iOS or OS X, then specify the platform and
  #  the deployment target. You can optionally include the target after the platform.
  #

  # s.platform     = :ios
  s.platform     = :ios, "9.0"

  #  When using multiple platforms
  # s.ios.deployment_target = "5.0"
  # s.osx.deployment_target = "10.7"
  # s.watchos.deployment_target = "2.0"
  # s.tvos.deployment_target = "9.0"


  # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Specify the location from where the source should be retrieved.
  #  Supports git, hg, bzr, svn and HTTP.
  #

  s.source       = { :git => "https://github.com/Asingers/YJTouchID.git", :tag => "#{s.version}" }


  # ――― 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.
  #

  s.source_files  = "YJTouchID", "YJTouchID/YJTouchID/*.{h,m}"
  # s.exclude_files = "Classes/Exclude"

  # s.public_header_files = "Classes/**/*.h"


  # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――	― #
  #
  #  A list of resources included with the Pod. These are copied into the
  #  target bundle with a build phase script. Anything else will be cleaned.
  #  You can preserve files from being cleaned, please don't preserve
  #  non-essential files like tests, examples and documentation.
  #

  # s.resource  = "icon.png"
  s.resources = "YJTouchID/pic/*.png"

  # s.preserve_paths = "FilesToSave", "MoreFilesToSave"


  # ――― Project Linking 	―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  Link your library with frameworks, or libraries. Libraries do not include
  #  the lib prefix of their name.
  #

  # s.framework  = "SomeFramework"
  # s.frameworks = "SomeFramework", "AnotherFramework"

  # s.library   = "iconv"
  # s.libraries = "iconv", "xml2"


  # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
  #
  #  If your library depends on compiler flags you can set them in the xcconfig hash
  #  where they will only apply to your library. If you depend on other Podspecs
  #  you can include multiple dependencies to ensure it works.

  # s.requires_arc = true

  # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
  # s.dependency "JSONKit", "~> 1.4"

end
  • s.name:名称,pod search搜索的关键词,注意这里一定要和.podspec的名称一样,否则报错

  • s.version:版本号,to_s:返回一个字符串

  • s.author:作者

  • s.homepage:项目主页地址

  • s.summary: 项目简介

  • s.source:项目源码所在地址

  • s.license:许可证

  • s.platform:项目支持平台

  • s.requires_arc: 是否支持ARC

  • s.source_files:需要包含的源文件

  • s.public_header_files:需要包含的头文件

  • s.ios.deployment_target:支持的pod最低版本
  • s.social_media_url:社交网址
  • s.resources:资源文件
  • s.dependency:依赖库,(一些第三方)不能依赖未发布的库

source_files写法及含义:

"AA/*
"AA/BB/*.{h,m}"
"AA/**/*.h"

*表示匹配所有文件
*.{h,m}表示匹配所有以.h和.m结尾的文件
**表示匹配所有子目录

验证.podspec

pod spec lint yourname.podspec --verbose --use-libraries

发布

pod trunk push yourname.podspec --use-libraries --allow-warnings

要注意每次有新的代码push之后,要打上将要发布的最新版的tag,例如下次更新了1.0.1

git tag 1.0.1
git push --tags

修改yourname.podspec文件中的内容

s.version      = "1.0.1"
s.source       = { :Git => "https://github.com/xxx/xxx.git", :tag => "1.0.1" }

这样就能对应到版本了


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

C语言程序设计

C语言程序设计

K. N. King / 吕秀锋、黄倩 / 人民邮电出版社 / 2010-4 / 79.00元

时至今日, C语言仍然是计算机领域的通用语言之一,但今天的 C语言已经和最初的时候大不相同了。本书最主要的一个目的就是通过一种“现代方法”来介绍 C语言,书中强调标准 C,强调软件工程,不再强调“手工优化”。这一版中紧密结合了 C99标准,并与 C89标准进行对照,补充了 C99中的最新特性。本书分为 C语言的基础特性、 C语言的高级特性、 C语言标准库和参考资料 4个部分。每章末尾都有一个“问与......一起来看看 《C语言程序设计》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换