2012年11月18日 星期日

CocoaPod 加入自己的 spec資料庫



https://github.com/CocoaPods/CocoaPods/wiki/Sharing-pod-specifications-with-yourself-and-the-world



指令

$ pod repo add my-spec-repo http://github.com/my-account/spec-repo.git


記得 裡面的 檔案結構要為  /xxxxxx/0.0.1/xxxxxx.podspe
https://github.com/CocoaPods/CocoaPods/wiki/Working-with-repositories

不然在執行 pod repo lint my-spec-repo

會報錯


另外  my-spec-repo 會加入到  /Users/willsborKang/.cocoapods/my-spec-repo


之後用  pod search xxxxxx

就可以看到類似....


-> AFDownloadRequestOperation (0.0.1)
   暫時拿別人的來實驗.
   - Homepage: https://github.com/steipete/AFDownloadRequestOperation
   - Source:   https://github.com/steipete/AFDownloadRequestOperation.git
   - Versions: 0.0.1 [myspecrepo repo]

這樣的內容

- Versions: 0.0.1 [myspecrepo repo]    就不會是 [master repo]


======== 我想應該是這樣用

https://github.com/CocoaPods/CocoaPods/wiki/Creating-and-maintaining-a-pod

先在自己的專案下  ex: xxxlib 下建立  一個  xxxlib.podspe

$ pod spec create xxxlib

接著編輯這個podsec


編輯後!!!


$ pod spec lint --local

$ git add -A && git commit -m "Release 0.0.1."
$ git tag '0.0.1'
$ git push --tags


pod spec lint --local  只是先檢查格式對不對

接著commit 到git

然後加上tag

然後push到git server上


接著


$ pod push myspec

如果之前 有加入 pod repo add  myspec xxxxx.git

那這裡就會自動更新 xxxxx.git   server

然後接著 在重新載入到 seach list中

所以上面結束後再執行 pod search xxxlib

就可以看到他在 [myspec repo]  中了











沒有留言:

張貼留言