利用pod trunk發(fā)布程序
注冊(cè)
pod trunk register 郵箱 '用戶名' --description='電腦描述'
查收郵件
- 如果是QQ郵箱,可能會(huì)被放到“垃圾箱”中砚作,并不一定是“收件箱”
- 點(diǎn)擊郵件中的鏈接:
https://trunk.cocoapods.org/sessions/verify/xxxx
接下來查看個(gè)人信息
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
- 中間可能遇到這種錯(cuò)誤
NoMethodError - undefined method 'last' for #<Netrc::Entry:0x007fc59c246378>
- 這時(shí)候需要嘗試更新gem源或者pod
sudo gem update --system
sudo gem install cocoapods
sudo gem install cocospods-trunk
創(chuàng)建podspec文件
- 接下來需要在項(xiàng)目根路徑創(chuàng)建一個(gè)podspec文件來描述你的項(xiàng)目信息
pod spec cretae 文件名
- 比如pod spec cretae MJExtension就會(huì)生成一個(gè)MJExtension.podspec
填寫podspec內(nèi)容
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
- 值得注意的是纱控,現(xiàn)在的podspec必須有tag懂牧,所以最好先打個(gè)tag巷查,傳到github
git tag 0.0.1
git push --tags
檢測(cè)podspec語法
pod spec lint MJExtension.podspec
發(fā)布podspec
pod trunk push MJExtension.podspec
- 如果是第一次發(fā)布pod炒辉,需要去https://trunk.cocoapods.org/claims/new認(rèn)領(lǐng)pod
檢測(cè)
-
pod setup
: 初始化 -
pod repo update
: 更新倉庫 pod search MJExtension
倉庫更新
- 如果倉庫更新慢绰寞,可以考慮更換倉庫鏡像
pod repo remove master
pod repo add master http://git.oschina.net/akuandev/Specs.git
來源:小碼哥