##### 註冊
* `pod trunk register 郵箱 '用戶名' --description='電腦描述'`
##### 查收郵件
* 如果是QQ郵箱,可能會被放到“垃圾箱”中,並不一定是“收件箱”
* 點擊郵件中的鏈接:
https://trunk.cocoapods.org/sessions/verify/xxxx
##### 接下來查看個人信息
* `pod trunk me`
```
- Name: MJ Lee
- Email: [email protected]
- 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" => "[email protected]" }
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`