ios 建立私人的 pod 倉庫

來源:互聯網
上載者:User

標籤:

接觸pod以後發現用它管理第三方代碼很方便,之後就產生了用把自己寫的模組放到pod上的想法,經過一系列的百度和Google,基本上實現了,以下就是我實現的步驟和理解:

標準的pod使用流程

 

而我們的是這個

一.產生私用的pod倉庫

如果安裝了pod那麼在本地會有一個pod倉庫

我們要產生的私人倉庫也會在這個目錄下。

1.需要一個git地址(如:https://github.com/liuxiaolong-nm/cyhz_pods_repository.git)

2.建立私人的pod spec repo,產生的時候需要和一個git repository綁定(第1步的作用),執行命令 如:pod repo add LXLSpecs https://github.com/liuxiaolong-nm/cyhz_pods_repository.git ,之後在原生產生一個你自己命名的pod spec repo,

二.建立pod lib 

準備一個git 地址 如:[email protected]:liuxiaolong-nm/ios_pod_library_test.git,

找一個目錄執行命令:pod lib create 名稱 ,之後會產生一個pod 依賴項目

如:pod lib create ios_pod_library_test 後會讓你選項一些屬性

之後

 

把這個項目提交git 上去,執行上傳命令:

git add .
git commit -s -m "Initial Commit of Library"
git remote add origin [email protected]:liuxiaolong-nm/ios_pod_library_test.git
git push origin master

第一次提交之後我我建議用 git用 source tree管理

之後再打個標籤

接下來開發編輯 pod lib 項目的的podspec檔案

 

 

執行pod lib lint 命令校對檔案是否可用

注意:s.summary 和 s.description 對應的標題文字不能一樣,s.version 最少為3個數字如:0.1.0,否則會校對失敗。

校對成功!

現在開始讓pod lib裡添加模組代碼,

 

pod lib裡的代碼必須放到這個檔案,資源檔放到Assets這個檔案夾。

添加之後push 到git 遠端。

 

測試一下,建立一個pod 項目 修改Podfile檔案

執行命令 pod update 

 

 

ok 大功告成!

下一篇將講解pod lib 的日常維護。

 

ios 建立私人的 pod 倉庫

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.