利用pod trunk发布程序

##### 注册

* `pod trunk register  邮箱 '用户名' --description='电脑描述'`


##### 查收邮件

* 如果是QQ邮箱,可能会被放到垃圾箱中,并不一定是收件箱

* 点击邮件中的链接:

https://trunk.cocoapods.org/sessions/verify/xxxx


##### 接下来查看个人信息

* `pod trunk me`


```

  - Name:     MJ Lee

  - Email:    xxxxxx@qq.com

  - Since:    January 28th, 03:53

  - Pods:     None

  - Sessions:

    - January 28th, 04:28 - June 5th, 04:34. IP: xxx.xxx.xxx.xxx Description: Macbook Pro

```

* 中间可能遇到这种错误


```

NoMethodError - undefined method 'last' for #<Netrc::Entry:0x007fc59c246378>

```

* 这时候需要尝试更新gem源或者pod

* `sudo gem update --system`

* `sudo gem install cocoapods`  

* `sudo gem install cocospods-trunk`  


##### 创建podspec文件

* 接下来需要在项目根路径创建一个podspec文件来描述你的项目信息  

* `pod spec cretae 文件名`  

* 比如pod spec cretae MJExtension就会生成一个MJExtension.podspec


##### 填写podspec内容

```

Pod::Spec.new do |s|

  s.name         = "MJExtension"

  s.version      = "0.0.1"

  s.summary      = "The fastest and most convenient conversion between JSON and model"

  s.homepage     = "https://github.com/CoderMJLee/MJExtension"

  s.license      = "MIT"

  s.author             = { "MJLee" => "xxxxx@qq.com" }

  s.social_media_url   = "http://weibo.com/exceptions"

  s.source       = { :git => "https://github.com/CoderMJLee/MJExtension.git", :tag => s.version }

  s.source_files  = "MJExtensionExample/MJExtensionExample/MJExtension"

  s.requires_arc = true

end

```

* 值得注意的是,现在的podspec必须有tag,所以最好先打个tag,传到github  

* `git tag 0.0.1`    

* `git push --tags`


##### 检测podspec语法

* `pod spec lint MJExtension.podspec`


##### 发布podspec

* `pod trunk push MJExtension.podspec`  

* 如果是第一次发布pod,需要去https://trunk.cocoapods.org/claims/new认领pod


##### 检测

* `pod setup` : 初始化

* `pod repo update` : 更新仓库

* `pod search MJExtension`


##### 仓库更新

* 如果仓库更新慢,可以考虑更换仓库镜像

    * `pod repo remove master`

    * `pod repo add master http://git.oschina.net/akuandev/Specs.git`

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值