Cocoapods发布

2017-03-20  本文已影响11人  Mominglaile

Cocoapods发布

$ pod trunk register xxxxxxxx@qq.com "name"

注册成功会出现以下提示

[!] Please verify the session by clicking the link in the verification email that has been sent to 281090013@qq.com
$ pod trunk me

成功会打印以下信息

  - Name:     XXXXX
  - Email:    XXXXXXXX@qq.com
  - Since:    September 23rd, 09:54
  - Pods:     None
  - Sessions:
    - September 23rd, 09:54 - January 29th, 2017 10:02. IP:
    XXX.XX.XXX.XXX

详情图如下:


798533EB-01B2-46A4-A759-3A5687F00A00.png

会用的忽略吧.....

拿到新仓库的链接,开始到 SourceTree 发挥了

3.png

把仓库克隆下来

4.png

不废话,Xcode的就自己琢磨
以下是做好之后的项目结构:

5.png 6.png 7.png

拿到这张图所在的指那个你刚刚创建仓库的链接

8.png
    $ cd /Users/name/Documents/XXXXTest 

2.接着

$ pod spec create https://github.com/liuconglaile/XXXXTest

这一串 https://github.com/liuconglaile/XXXXTest 就是刚刚那张图片复制的地址

假如你输入命令后出现以下内容:

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

I’ve recently added [XXXXTest](https://github.com/CocoaPods/Specs/tree/master/XXXXTest) to the [CocoaPods](https://github.com/CocoaPods/CocoaPods) package manager repo.

CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.

However, XXXXTest doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.

[Semantic version](http://semver.org) tags (instead of plain commit hashes/revisions) allow for [resolution of cross-dependencies](https://github.com/CocoaPods/Specs/wiki/Cross-dependencies-resolution-example).

In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:


$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags


――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] This repo does not appear to have semantic version tags.

After commiting the specification, consider opening a ticket with the template displayed above:
  - link:  https://github.com/liuconglaile/XXXXTest/issues/new
  - title: Please add semantic version tags

Specification created at XXXXTest.podspec

它提示你, XXXXTest.podspec 文件要修改

但是里面有一堆有的没的,全是英文,很多东西是可以不要的,我自己精简过后:

Pod::Spec.new do |s|

  s.name         = "XXXXTest"
  s.version      = "0.0.1"
  s.summary      = "这是我测试pod的一个分类,仅供娱乐..."
  s.homepage     = "https://github.com/liuconglaile/XXXXTest"
  s.license      = "MIT"
  s.authors      = { "liuconglaile" => "momingcode@icloud.com" }
  s.platform     = :ios, "7.1"
  s.source       = { :git => "https://github.com/liuconglaile/XXXXTest.git", :tag => s.version }

  s.source_files  = "Categorys", "Categorys/*.{h,m}"


end

正常在发布的时候都会打上一个tag,如版本0.0.1就会打上一个名为0.0.1的tag,
你也可以选择一个最新的commit来作为该库0.0.1版的代码, 比如它本身生成的样子(有时间最好看看里面长啥样的,别急着删)

用的是tag的话,就像我上面写的那样.每次有新版本,就改改 s.version就好

s.source_files = "Categorys", "Categorys/*.{h,m}"

我这里 Categorys 就是文件夹名&pod名
Categorys/ 这个呢,就是代表着

项目根目录/文件夹/*.{h,m} ----- *.{h,m}代表着改文件夹里面所有的.h.m文件
$ pod spec lint

或者

$ pod spec lint --verbose

打印:

9.png
$ pod trunk push

漫长的等待.....这里可以考研一下自己的人品

10.png

嗯,然后就再也没有然后了,接下来的自己琢磨吧

另外

CocoaPods 1.1.0.beta.1 is available.
To update use: `sudo gem install cocoapods --pre`
[!] This is a test version we'd love you to try.

这句话,别不记得看,不然你下次百度就不好意思了....

上一篇 下一篇

猜你喜欢

热点阅读