1. 程式人生 > >CocoaPods私有倉庫使用和搭建

CocoaPods私有倉庫使用和搭建

建立code repository

pod lib create 專案名稱
e.g
pod lib create RemoteNotificationManager
  • What language do you want to use?? [ Swift / ObjC ]
    • ObjC
  • Would you like to include a demo application with your library? [ Yes / No ]
    • Yes
  • Which testing frameworks will you use? [ Specta / Kiwi / None ]
    • None
  • Would you like to do view based testing? [ Yes / No ]
    • No
  • What is your class prefix?
    • WX

配置Sepc

  • 複製專案https地址配置如下
s.source           = { :git => 'https://git.oschina.net/yueyueTravel/QXConfiguration.git', :tag => s.version }
  • 將QXConfiguration.podspec所在的目錄拖進SourceTree
  • 開啟SourceTree,設定-> 遠端倉庫->新增
如下配置
倉庫名稱:origin
URL: [email protected]
.oschina.net:yueyueTravel/QXConfiguration.git

校驗code repository

# 私有pod進行校驗
pod lib lint --private

將本地pod提交到倉庫去

先將程式碼提交到code repository

設定tag

git tag '0.1.0'

提交tags

git push --tags

如果沒有將公司的Specs新增到本地, 先執行以下程式碼,如果有新增則跳過

pod repo add oschina-qx2016-summersoft_specs [email protected]
.oschina.net:qx2016/SummerSoft_Specs.git

向公司的Specs新增pod庫

pod repo push oschina-qx2016-summersoft_specs 名字.podspec 

# 如果有警告,要忽略的話
pod repo push oschina-qx2016-summersoft_specs 名字.podspec --allow-warnings

# 包含私有庫
pod repo push oschina-qx2016-summersoft_specs 名字.podspec --sources=oschina-qx2016-summersoft_specs,master --allow-warnings

更新私有spec repository

pod repo update [倉庫名稱]
# 如下
pod repo update oschina-qx2016-summersoft_specs

有可能有快取,需要先clean快取後再pod install或pod update

pod cache clean PodName 

更新原生代碼倉庫

pod install --verbose --no-repo-update
pod update --verbose --no-repo-update