制作并发布个人CocoaPods库
随着对 CocoaPods 越来越多的依赖,我们也可以尝试把自己的库发布到它上面。
1.在Github上新建一个项目(名字我随便取了一个,其他步骤截图为WCUIKit)。自己做相应修改即可。

2.克隆到本地 git clone https://github.com/dianziguan1234/WCUIKit.git
Xcode创建项目。添加自己的代码。目录结构大致为

其中SourceCode存放源码部分,就是后来通过cocoapods安装以后得到的代码块。
WCUIKit存放我们Xcode创建的项目。
3.重要的一步。添加tag并提交github master分支。
git add -A && git commit -m "Release 1.0.2"
git tag '1.0.2'
git push --tags
git push origin master
4:创建podspec文件。
cd WCUIKit
pod spec create WCUIKit.podspec
之后在该目录下会生成一个 WCUIKit.podspec 文件,该文件是 Ruby 编写的,打开并编辑这个文件,填写好配置文件。
#
# Be sure to run `pod spec lint WCUIKit.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 = "WCUIKit"
s.version = "1.0.2"
s.summary = "任意视图添加角标" # 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.homepage = "https://github.com/dianziguan1234/WCUIKit"
# 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 (example)"
s.license = { :type => "MIT", :file => "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 = { "guanweicheng" => "1396539283@qq.com" }
# Or just: s.author = "guanweicheng"
# s.authors = { "guanweicheng" => "1396539283@qq.com" }
# s.social_media_url = "http://twitter.com/guanweicheng" # ――― 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, "8.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/dianziguan1234/WCUIKit.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 = 'SourceCode/**/*.{h,m}'
#s.exclude_files = "SourceCode/" s.public_header_files = "SourceCode/**/*.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 = "Resources/*.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
红色部分稍微留意下。如果需要详细文档请移步 Specs and the Specs Repo。
5.验证podspec文件
cd WCUIKit
pod spec lint WCUIKit.podspec
6.注册上传到cocoapods
pod trunk register 1396539283@qq.com 'guanweicheng' --description='gwc' pod trunk push WCUIKit.podspec
如果不出意外的话。会恭喜你发布成功。
7.然后可以pod search 你自己的库文件了。这里可能会出搜索不到的情况。参考链接解决即可(原理简单)。http://blog.cocoachina.com/article/29127

podspec文件可以参考我的项目。https://github.com/dianziguan1234/WCUIKit.git
制作并发布个人CocoaPods库的更多相关文章
- Xamarin:制作并发布apk
原文:Xamarin:制作并发布apk 终于到了激动人心的时刻:要向真机发布apk了.流程如下: 1 制作release版的android应用安装包apk文件: 1.1 用VS2012中文版制作:记得 ...
- 制作pypi上的安装库
下载地址 如何制作分发工具呢 setuppy 源码包 其他文件 制作过程 首先上场的肯定是setuppy了如下 然后是LICENCE 注册 测试 总结 自从接触Python以来也有几个月了,虽然主要的 ...
- 手把手图文并茂教你发布Android开源库
转载请把头部出处链接和尾部二维码一起转载,本文出自逆流的鱼,文章链接: http://blog.csdn.net/hejjunlin/article/details/52452220 经常逛githu ...
- 教你一步步发布一个开源库到 JCenter
今天想来分享下,如何一步步自己发布一个开源库到 JCenter 这方面的博客网上已经特别多了,所以本篇并不打算仅仅只是记录流程步骤而已,而是尽可能讲清楚,为什么需要有这个步骤,让大伙知其然的同时还知其 ...
- Egret第三方库的制作和使用(模块化 第三方库)
一.第三方库的制作 官方教程:第三方库的使用方法 水友帖子:新版本第三方库制作细节5.1.x 首先在任意需要创建第三方库的地方,右键,选择"在此处打开命令窗口" 输入egret c ...
- 【我的Android进阶之旅】快速创建和根据不同的版本类型(Dev、Beta、Release)发布Android 开发库到Maven私服
前言 由于项目越来越多,有很多公共的代码都可以抽取出一个开发库出来传到公司搭建好的Maven私服,以供大家使用. 之前搭建的Maven仓库只有Release和Snapshot两个仓库,最近由于开发库有 ...
- 发布Android开源库,看这个文章就够了!
最近在Flipboard实习期间写了一个轮播工具,技术上没什么难点,不过动画效果还是不错的,决定改改代码写个库开源出去.项目地址:http://github.com/chengdazhi/Decent ...
- Docker系列-(2) 镜像制作与发布
上篇文章引入了Docker的基本原理和操作,本节文章主要介绍如何制作Docker镜像和发布. 镜像文件结构 Docker镜像的本质是一系列文件的集合,这些文件依次叠加,形成了最后的镜像文件,类似于下图 ...
- 使用Jitpack发布开源Java库
原文:使用Jitpack发布开源Java库 | Stars-One的杂货小窝 很久之前也写过一篇使用Jitpack发布Android开源库的文章,详见Android开发--发布第三方库到JitPack ...
随机推荐
- 元祖、hash了解、字典、集合
元祖: 元组跟列表差不多,也是存一组数,只是它一旦创建,便不能再修改,所以又叫只读列表. 创建: names = ('neo', 'mike', 'eric') 特性: # 1.可存放多个值 # 2. ...
- [NOIP2005] 提高组 洛谷P1054 等价表达式
题目描述 明明进了中学之后,学到了代数表达式.有一天,他碰到一个很麻烦的选择题.这个题目的题干中首先给出了一个代数表达式,然后列出了若干选项,每个选项也是一个代数表达式,题目的要求是判断选项中哪些代数 ...
- 移动端click事件延迟300ms该如何解决
window.addEventListener( "load", function() { FastClick.attach( document.body ); }, fa ...
- csu1365 Play with Chain
很显然的splay,第一次用splay操作区间...我实在佩服这个targan大佬,居然搞出这么牛逼的平衡树,调了大概5个小时终于搞定了.. #include<cstdio> #inclu ...
- AtCoder Grand Contest 011 E - Increasing Numbers(灵性乱搞)
题意: 当一个整数高位数字总不小于低位数字,或者说写成字符串之后单调不下降,称之为上升数.求一个整数最少能表示为多少个上升数的和.(n<=1e500000) 分析: 考虑那些不下降的数字,一定可 ...
- linux下常用快捷方式
一.终端最常用的快捷键: 1.新建终端窗口:crtl+shift+n 2.终端的切换:shift+左右箭头 3.挂起:crtl+s 4.解除挂起:crtl+q 5.清屏:crtl+l 二.命令行光标移 ...
- Mariadb 索引及外键
索引 索引相当于一本书的目录,在一个数据库或表有索引的情况下,会很便于查询数据,使查询更加效率,相对的也有缺点,不利于去修改,比较麻烦,有索引便于查询,那就意味着索引创建的越多越好么?然而并不是:索引 ...
- luogu1314 聪明的质检员
题目大意 小 T 是一名质量监督员,最近负责检验一批矿产的质量.这批矿产共有 n 个矿石,从 1 到 n 逐一编号,每个矿石都有自己的重量 wi 以及价值 vi.检验矿产的流程是: 1.给定 m 个区 ...
- UVA 213 Message Decoding 【模拟】
题目链接: https://cn.vjudge.net/problem/UVA-213 https://uva.onlinejudge.org/index.php?option=com_onlinej ...
- [Android6.0][RK3399] 双屏异显代码实现流程分析(二)【转】
本文转载自:http://blog.csdn.net/dearsq/article/details/55050125 Patch Code dtsi rk3399-androiddtsi rk3399 ...