1.創(chuàng)建framework疗我,并把本地代碼上傳到遠端代碼倉庫Gitlab,創(chuàng)建遠端倉庫的時候 記得 添加證書 LICENSE文件,
2.創(chuàng)建配置文件的遠端倉庫,也就是Spec倉庫栗菜, 記得 添加證書LICENSE文件
3.把遠端的配置文件的倉庫 spec? clone到本地? 通過終端? 命令代碼為:
? pod repo add testRepo https://gitee.com/zhouzheren/TestRepo.git
其中:? testRepo為文件名字? https://gitee.com/zhouzheren/TestRepo.git 為倉庫地址
4.用終端命令 cd到 本地的代碼倉庫残炮,通過終端指令 pod spec create? 創(chuàng)建.podspec文件? 例如:pod spec create PrivateLibiary? 創(chuàng)建了PrivateLibiary.podspec文件
5.設(shè)置PrivateLibiary.podspec文件中的內(nèi)容? ? 大概為:
Pod::Spec.new do |s|
s.name? ? ? ? = "PrivateLibiary" # 項目名稱
s.version? ? ? = "0.1.1"? ? ? ? # 版本號 與 你倉庫的 標簽號 對應
s.license? ? ? = "MIT"? ? ? ? ? # 開源證書
s.summary? ? ? = "私有庫創(chuàng)建測試" # 項目簡介
s.homepage? ? = "http://10.134.150.205/yanghao/PrivateLibiary" # 倉庫的主頁
s.source? ? ? = { :git => "http://10.134.150.205/yanghao/PrivateLibiary.git", :tag => "#{s.version}" }#你的倉庫地址,不能用SSH地址
s.requires_arc = true # 是否啟用ARC
s.platform? ? = :ios, "8.0" #平臺及支持的最低版本
s.ios.vendored_frameworks = "PrivateLibiaryTest.framework"
# User
s.author? ? ? ? ? ? = { "畫舫煙中淺" => "yanghao0405@163.com" } # 作者信息
s.social_media_url? = "http://www.reibang.com/u/dea3cd9fc359" # 個人主頁
end
6.把PrivateLibiary.podspec文件上傳到 配置文件的倉庫 就可以了
例如:pod repo push privateRepo PrivateLibiary.podspec
其中 privateRepo為配置文件倉庫的名字 ?即為隱藏文件.cocoapods目錄下的文件
? ? ? ? PrivateLibiary.podspec 為要上傳的東西 ?即為.podspec文件
補充:pod lib lint指令可以測試編輯的.podspec文件是否正確? 使用這個命令先要cd到.podspec目錄
? ? ? ? ? ? 上傳本地代碼倉庫的時候一定要記得? 打上 tag? 并且? tag值與上傳的.podspec文件中s.version保持一致寒亥,tag值是用來區(qū)分同一個私有庫不同的版本的
? ? ? ? ? ? 終端命令? 打tag? cd到代碼倉庫? git tag -m “first release” “0.1.0”
? ? ? ? ? ? Git push - -tags
私有庫的更新
1.更新你的framework,并上傳至代碼庫
2.上傳后給項目打一個tag值
3.修改.podspec文件中的tag值,與你所打印的tag值要對應
4.上傳你修改后的.podspec文件到你的配置倉庫