CocoaPods制作第三方代碼庫壮不,發(fā)布到官方Pod和自己的私有庫(模塊化、組件化)

萌圖鎮(zhèn)樓

CocoaPods在這里就不多做介紹了皱碘,相信大家都對此都使用過忆畅,也知道其對我們的好處。CocoaPods可以使我們項(xiàng)目管理第三方更容易尸执,平時(shí)第三方庫都是pod install下來的,再也不用之前的手動(dòng)拖進(jìn)工程了缓醋。那么我們今天就來說下我們自己怎么制作第三方并發(fā)布到CocoaPods官方如失;還有項(xiàng)目組件化,把自己的模塊封裝成庫并發(fā)布到私有的git上送粱。

*環(huán)境安裝

首先我們需要安裝CocoaPods環(huán)境褪贵,之前寫過CocoaPods環(huán)境安裝,沒安裝的同學(xué)可以跟著安裝下抗俄。最好安裝最新的環(huán)境脆丁,否則執(zhí)行下邊步驟可能會(huì)出現(xiàn)錯(cuò)誤。

*制作本地庫

打開目錄动雹,cd到指定目錄槽卫,輸入指令創(chuàng)建庫∫闰穑“ZMBase”是庫的名字歼培。

pod lib create ZMBase

輸入命令后會(huì)顯示下載模板,會(huì)有幾秒鐘等待茸塞。

Cloning `https://github.com/CocoaPods/pod-template.git` into `ZMBase`.

模板下載好以后躲庄,需要你回答幾個(gè)問題:

1.你要使用哪個(gè)平臺(tái)?iOS
2.你要使用哪種語言钾虐?
3.庫中是否包含一個(gè)實(shí)例程序噪窘?(一般選擇示例程序)
4.你要使用哪個(gè)測試框架?(沒有就寫None)
5.是否要UI測試效扫?(我一直都是NO倔监,沒有測試過)
6.類名前綴是什么直砂?(這個(gè)我創(chuàng)建Swift庫的時(shí)候沒有這一項(xiàng))
------------------------------

To get you started we need to ask a few questions, this should only take a minute.

If this is your first time we recommend running through with the guide: 
 - http://guides.cocoapods.org/making/using-pod-lib-create.html
 ( hold cmd and double click links to open in a browser. )


What platform do you want to use?? [ iOS / macOS ]
 > iOS

What language do you want to use?? [ Swift / ObjC ]
 > Swift

Would you like to include a demo application with your library? [ Yes / No ]
 > Yes

Which testing frameworks will you use? [ Quick / None ]
 > None

Would you like to do view based testing? [ Yes / No ]
 > No

Running pod install on your new library.

接下來會(huì)自動(dòng)執(zhí)行pod install。

Analyzing dependencies
Fetching podspec for `ZMBase` from `../`
Downloading dependencies
Installing ZMBase (0.1.0)
Generating Pods project
Integrating client project

[!] Please close any current Xcode sessions and use `ZMBase.xcworkspace` for this project from now on.
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.

[!] Automatically assigning platform `ios` with version `9.3` on target `ZMBase_Example` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.

 Ace! you're ready to go!
 We will start you off by opening your project in Xcode
  open 'ZMBase/Example/ZMBase.xcworkspace'

To learn more about the template see `https://github.com/CocoaPods/pod-template.git`.
To learn more about creating a new pod, see `http://guides.cocoapods.org/making/making-a-cocoapod`.

執(zhí)行完后會(huì)自動(dòng)打開工程丐枉,如果沒有自動(dòng)打開哆键,我們可以手動(dòng)打開ZMBase.xcworkspace,到此為止一個(gè)空的本地庫已經(jīng)出現(xiàn)了瘦锹。你會(huì)看到如下目錄結(jié)構(gòu)


1.jpg

我們可以在ReplaceMe.swift位置添加我們的代碼籍嘹,添加自己的代碼。


2.jpg
*注意點(diǎn):
1弯院、我們自己的代碼不管是新添加文件辱士、還是現(xiàn)有代碼有改動(dòng),都需要需要在cd到Example下執(zhí)行pod install后听绳,才能導(dǎo)入頭文件import ZMBase颂碘,代碼才會(huì)更新。
2.我們自己的代碼文件最多一層文件結(jié)構(gòu)即Animation文件夾內(nèi)只能放代碼椅挣,不能再創(chuàng)建子文件夾头岔。
3.每個(gè)類文件如果想暴露出去,則需要在代碼類名前添加修飾符即(public class xxx或者open extension xxx)鼠证,添加public峡竣、open,而extension不能用open修飾所以用plublic修飾量九。
4.如果已經(jīng)暴露的類适掰,想暴露里邊的函數(shù)方法,則也需要在方法 func 前加public荠列,否則外部調(diào)用會(huì)找不到方法名类浪。
MiaozdeMacBook-Pro:Example miaoz$ pod install
Analyzing dependencies
Fetching podspec for `ZMBase` from `../`
Downloading dependencies
Using SnapKit (3.2.0)
Using Then (2.3.0)
Using ZMBase (0.1.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 3 total pods installed.

[!] Automatically assigning platform `ios` with version `9.3` on target `ZMBase_Example` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
MiaozdeMacBook-Pro:Example miaoz$

到這里就可以導(dǎo)入import ZMBase到ViewController.


3.jpg

到這里本地庫我們已經(jīng)制作好了,如果把我們本地當(dāng)做git庫的話肌似,這時(shí)候我們只需要在你其他的項(xiàng)目或者工程的Podfile文件里添加如下:
ZMTest:是項(xiàng)目名稱
ZMBase:本地私有庫
path:是指定本地庫所在的位置

target 'ZMTest' do
  pod 'ZMBase', :path => '/Users/miaoz/Desktop/ZMPods/ZMBase'
end
*本地庫提交到CocoaPods遠(yuǎn)程倉庫

首先我們先了解下Specs和Specs Repo费就、Code和Code Repo。
Spec:我們使用CocoaPods的指令創(chuàng)建好本地庫之后川队,默認(rèn)生成的podspec文件受楼。它描述該庫某一個(gè)版本的信息,比如庫的名字呼寸、版本號(hào)艳汽、描述、依賴庫等等对雪。

#
# Be sure to run `pod lib lint ZMBase.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
  #庫名
  s.name             = 'ZMBase'
  #庫版本
  s.version          = '0.1.0'
  #庫簡短描述
  s.summary          = 'A short description of ZMBase.'

# This description is used to generate tags and improve search results.
#   * Think: What does it do? Why did you write it? What is the focus?
#   * Try to keep it short, snappy and to the point.
#   * Write the description between the DESC delimiters below.
#   * Finally, don't worry about the indent, CocoaPods strips it!
  #庫詳細(xì)描述
  s.description      = <<-DESC
TODO: Add long description of the pod here.
                       DESC
  #庫介紹主頁地址
  s.homepage         = 'https://github.com/miaozhang9/ZMBase'
  # s.screenshots     = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
  #庫開源許可
  s.license          = { :type => 'MIT', :file => 'LICENSE' }
  #作者信息
  s.author           = { 'miaozhang9' => '395052985@qq.com' }
  #源碼git地址
  s.source           = { :git => 'https://github.com/miaozhang9/ZMBase.git', :branch => 'master', :tag => s.version.to_s}
  # s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
  #庫依賴系統(tǒng)版本
  s.ios.deployment_target = '8.0'
#“*” 表示匹配所有文件
#“*.{h,m}” 表示匹配所有以.h和.m結(jié)尾的文件
#“**” 表示匹配所有子目錄
  #源碼文件配置
  s.source_files = 'ZMBase/Classes/**/*.swift'
  #資源文件配置
  # s.resource_bundles = {
  #   'ZMBase' => ['ZMBase/Assets/*.png']
  # }
  #源碼頭文件配置
  # s.public_header_files = 'Pod/Classes/**/*.h'
  #系統(tǒng)框架依賴
  # s.frameworks = 'UIKit', 'MapKit'
  #依賴第三方庫
  # s.dependency 'AFNetworking', '~> 2.3'
   s.dependency 'SnapKit', '~> 3.2.0'
   s.dependency 'Then', '~> 2.3.0'
end

Specs Repo:是Git庫存放Specs文件河狐,它包含了所有可用的第三方庫。每個(gè)庫都會(huì)有獨(dú)立的文件夾,每個(gè)版本以獨(dú)立的子文件夾保存馋艺。文件夾中只有一個(gè)描述文件栅干,也就是Spec。
Code:就是我們自己庫的源代碼捐祠。
Code Repo:就是Git庫存放源代碼的地方碱鳞。

*注意:Specs Repo和Code Repo是不一樣的,存放的地址也不一樣踱蛀,不能存放到同個(gè)git庫下

*提交到官方的CocoaPods

1.提交源代碼到git
git remote add origin https://github.com/miaozhang9/ZMBase
git add .
git commit -a -m "0.1.0"
git pull origin master
#git push -u origin master
git push origin master
git tag 0.0.1
git push origin 0.0.1
#如果有沖突errorUpdates were rejected because the tip of your current branch is behind
git push -u origin master -f 

接下來我們先建個(gè)git倉庫來存放代碼窿给。


4.jpg

出現(xiàn)error的原因是,我之前已經(jīng)創(chuàng)建了ZMBase的repository率拒。

Last login: Mon Mar  5 16:20:24 on ttys006
MiaozdeMacBook-Pro:~ miaoz$ cd /Users/miaoz/Desktop/ZMPods/ZMBase
MiaozdeMacBook-Pro:ZMBase miaoz$ git remote add origin https://github.com/miaozhang9/ZMBase
fatal: remote origin already exists.
MiaozdeMacBook-Pro:ZMBase miaoz$ git pull origin master
From https://github.com/miaozhang9/ZMBase
 * branch            master     -> FETCH_HEAD
Already up-to-date.
MiaozdeMacBook-Pro:ZMBase miaoz$ git add .
MiaozdeMacBook-Pro:ZMBase miaoz$ git commit -a -m "commit"
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working tree clean
MiaozdeMacBook-Pro:ZMBase miaoz$ git add .
MiaozdeMacBook-Pro:ZMBase miaoz$ git commit -a -m "commit"
[master fa59f5b] commit
 1 file changed, 1 insertion(+), 1 deletion(-)
MiaozdeMacBook-Pro:ZMBase miaoz$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 365 bytes | 365.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/miaozhang9/ZMBase
   331d7e9..fa59f5b  master -> master
MiaozdeMacBook-Pro:ZMBase miaoz$ git tag 0.1.0
MiaozdeMacBook-Pro:ZMBase miaoz$ git push origin 0.1.0
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/miaozhang9/ZMBase
 * [new tag]         0.1.0 -> 0.1.0
MiaozdeMacBook-Pro:ZMBase miaoz$ 

執(zhí)行完命令后崩泡,這時(shí)候已經(jīng)把代碼提交到了git上,如下圖:


5.jpg
2.提交Spec文件到Specs Repo

--1>提交到官方的Specs上

首先先用cd到Spec文件所在的目錄猬膨,然后執(zhí)行pod lib lint

MiaozdeMacBook-Pro:ZMBase miaoz$ pod lib lint

 -> ZMBase (0.1.0)
    - WARN  | summary: The summary is not meaningful.
    - WARN  | [iOS] swift: The validator used Swift 3.2 by default because no Swift version was specified. To specify a Swift version during validation, add the `swift_version` attribute in your podspec. Note that usage of the `--swift-version` parameter or a `.swift-version` file is now deprecated.
    - WARN  | xcodebuild:  /Users/miaoz/Desktop/ZMPods/ZMBase/ZMBase/Classes/Animation/DismissAnimation.swift:65:133: warning: 'M_PI' is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.
    - WARN  | xcodebuild:  /Users/miaoz/Desktop/ZMPods/ZMBase/ZMBase/Classes/Animation/ModalAnimation.swift:128:133: warning: 'M_PI' is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.

[!] ZMBase did not pass validation, due to 4 warnings (but you can use `--allow-warnings` to ignore them).
You can use the `--no-clean` option to inspect any issue.

庫沒有通過驗(yàn)證角撞,說明Spec配置有問題,在Spec出現(xiàn)warnings是不行的勃痴,我們可以根據(jù)警告進(jìn)行修改谒所,也可以我們執(zhí)行pod lib lint --allow-warnings

MiaozdeMacBook-Pro:ZMBase miaoz$ pod lib lint --allow-warnings

 -> ZMBase (0.1.0)
    - WARN  | summary: The summary is not meaningful.
    - WARN  | [iOS] swift: The validator used Swift 3.2 by default because no Swift version was specified. To specify a Swift version during validation, add the `swift_version` attribute in your podspec. Note that usage of the `--swift-version` parameter or a `.swift-version` file is now deprecated.
    - WARN  | xcodebuild:  /Users/miaoz/Desktop/ZMPods/ZMBase/ZMBase/Classes/Animation/DismissAnimation.swift:65:133: warning: 'M_PI' is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.
    - WARN  | xcodebuild:  /Users/miaoz/Desktop/ZMPods/ZMBase/ZMBase/Classes/Animation/ModalAnimation.swift:128:133: warning: 'M_PI' is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.

ZMBase passed validation.
MiaozdeMacBook-Pro:ZMBase miaoz$ 

當(dāng)出現(xiàn)ZMBase passed validation.的時(shí)候,說明驗(yàn)證通過沛申。

接下來要做第二件事百炬,把Spec提交到官方的CocoaPods的Specs Repo
提交之前,你需要注冊pod賬號(hào)污它。實(shí)質(zhì)上是將"郵箱--名稱--電腦"綁定在一起,所以這里不需要密碼庶弃。

pod trunk register EMAIL [NAME]

以下是該指令的幫助文檔衫贬,大概意思是:
如果第一次注冊,郵箱和名稱都是必須的歇攻。如果已經(jīng)注冊過固惯,可以省略名稱(除非你想修改名稱)。推薦填寫描述信息缴守,以及給出了一些Examples葬毫,按著Example做就可以了。

pod trunk register EMAIL [NAME]

      Register a new account, or create a new session.

      If this is your first registration, both an `EMAIL` address and your
      `NAME` are required. If you’ve already registered with trunk, you may omit
      the `NAME` (unless you would like to change it).

      It is recommended that you provide a description of the session, so that
      it will be easier to identify later on. For instance, when you would like
      to clean-up your sessions. A common example is to specify the location
      where the machine, that you are using the session for, is physically
      located.

      Examples:

          $ pod trunk register eloy@example.com 'Eloy Durán' --description='Personal Laptop'
          $ pod trunk register eloy@example.com --description='Work Laptop'
          $ pod trunk register eloy@example.com

執(zhí)行
pod trunk register xxx@xx.com Miaoz
結(jié)果
[!] Please verify the session by clicking the link in the verification email that has been sent to xxx@xx.com
去郵箱認(rèn)證即可屡穗。
注冊賬號(hào)之后贴捡,我們可以嘗試將Spec提交到Specs Repo:
執(zhí)行命令:

pod trunk push ZMBase.podspec --allow-warnings
--------------------------------------------------------------------------------
 ??  Congrats

 ??  ZMBase (0.1.0) successfully published
 ??  March 5th, 03:05
 ??  https://cocoapods.org/pods/ZMBase
 ??  Tell your friends!
--------------------------------------------------------------------------------

如果出現(xiàn)以上圖示則說明提交到官方CocoaPods已經(jīng)成功,可能是用pod search ZMBase 這時(shí)候不會(huì)搜索的村砂,原因可能有延遲烂斋,需要等待一個(gè)小時(shí)左右,才會(huì)搜到。

總結(jié)提交Spec步驟:
1.給項(xiàng)目打tag(必須要打tag汛骂,CocoaPods中的不同版本罕模,實(shí)質(zhì)是不同的tag,不打tag會(huì)導(dǎo)致下一步驗(yàn)證不通過)

git tag 0.1.0
git push origin 0.1.0

2.檢查合法性

## 指令
pod spec lint ZMBase.podspec --allow-warnings

結(jié)果

-> ZMBase (0.1.0)
Analyzed 1 podspec.
ZMBase.podspec passed validation.

3.提交到Specs Repo

## 指令
pod trunk push ZMBase.podspec --allow-warnings

--2>提交到自己私有的Specs上
首先我們先創(chuàng)建一個(gè)git庫帘瞭,用于管理我們的Specs淑掌。
創(chuàng)建后的git地址https://github.com/miaozhang9/ZMSpecccc.git
在終端執(zhí)行

pod repo add ZMSpec https://github.com/miaozhang9/ZMSpecccc.git

添加成功后我們需要把ZMBase.podspec推送到ZMSpec庫中

pod repo push ZMSpec ZMBase.podspec --allow-warnings

如果出現(xiàn)warning可以執(zhí)行

pod repo push ZMSpec ZMBase.podspec --allow-warnings

MiaozdeMacBook-Pro:ZMBase miaoz$ pod repo push ZMSpec ZMBase.podspec --allow-warnings

Validating spec
 -> ZMBase (0.1.0)
    - WARN  | summary: The summary is not meaningful.
    - WARN  | [iOS] swift: The validator used Swift 3.2 by default because no Swift version was specified. To specify a Swift version during validation, add the `swift_version` attribute in your podspec. Note that usage of the `--swift-version` parameter or a `.swift-version` file is now deprecated.
    - WARN  | xcodebuild:  ZMBase/ZMBase/Classes/Animation/DismissAnimation.swift:65:133: warning: 'M_PI' is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.
    - WARN  | xcodebuild:  ZMBase/ZMBase/Classes/Animation/ModalAnimation.swift:128:133: warning: 'M_PI' is deprecated: Please use 'Double.pi' or '.pi' to get the value of correct type and avoid casting.

Updating the `ZMSpec' repo

Already up-to-date.

Adding the spec to the `ZMSpec' repo

 - [No change] ZMBase (0.1.0)

Pushing the `ZMSpec' repo

MiaozdeMacBook-Pro:ZMBase miaoz$ 

到這里我們已經(jīng)成功發(fā)布到ZMSpec git上了,我們來看一下我們的ZMSpec的git項(xiàng)目:


6jpg

這里的OTBase是之前發(fā)布的OC庫蝶念。

查看我們本地的Specs庫:

直接Findle ->右鍵 -> 前往文件夾 -> 輸入:~/.cocoapods/repos ->點(diǎn)擊前往


7.jpg

至此抛腕,我們的私有庫創(chuàng)建發(fā)布結(jié)束敌买。但是我們注意到逻澳,LATSpecs的README.md文件是空的,為了后期的維護(hù)更新涡相,以及團(tuán)隊(duì)小伙伴的使用方便适袜,建議完備一下信息柄错。
終端執(zhí)行

cd  xxx
git add . 
git commit -a -m "add Readme"
git pull origin master
git push origin master
終端執(zhí)行一下進(jìn)入我們的私有庫管理Specs,git更新提交下:

MiaozdeMacBook-Pro:~ miaoz$ cd /Users/miaoz/.cocoapods/repos/ZMSpec 
MiaozdeMacBook-Pro:ZMSpec miaoz$ git add . 
MiaozdeMacBook-Pro:ZMSpec miaoz$ git commit -a -m "add Readme"
[master 8e3a72a] add Readme
 1 file changed, 12 insertions(+), 2 deletions(-)
MiaozdeMacBook-Pro:ZMSpec miaoz$ git pull origin master
From https://github.com/miaozhang9/ZMSpecccc
 * branch            master     -> FETCH_HEAD
Already up-to-date.
MiaozdeMacBook-Pro:ZMSpec miaoz$ git push origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 625 bytes | 625.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/miaozhang9/ZMSpecccc.git
   cbc413e..8e3a72a  master -> master
MiaozdeMacBook-Pro:ZMSpec miaoz$ 
readme.jpg

我們發(fā)布的私有庫和發(fā)布到官方的庫都已經(jīng)完成苦酱,那么我們接下來售貌,來驗(yàn)證一下。

*驗(yàn)證發(fā)布的私有庫

新建工程TestPodLib然后,cd 到主目錄

pod init // 1.初始化pod
touch podfile // 2.生成podfile文件
open podfile

編輯podfile

# Uncomment the next line to define a global platform for your project
#因?yàn)槲覀兊膸煸诠俜絊pecs和自己的Specs上都上傳了疫萤,在這里我們只測試官方的
source 'https://github.com/CocoaPods/Specs.git'
#如果需要測試自己私有的颂跨,需要把上傳到官方Specs的移除
#source 'https://github.com/miaozhang9/ZMSpecccc.git'
platform :ios, '9.0'

target 'TestPodLib' do
  # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
  use_frameworks!

  # Pods for TestPodLib
pod 'ZMBase','~> 0.1.0'
end
注意:podfile文件里要加上
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/miaozhang9/ZMSpecccc.git'
#如果你不配置系統(tǒng)的索引庫 會(huì)找不到其他的庫 只能找到你自己創(chuàng)建的倉庫
1520246133177.jpg
出現(xiàn)這種情況的原因就是我們官方Specs和自己的Specs都上傳了。
[!] Found multiple specifications for `ZMBase (0.1.0)`:
- /Users/miaoz/.cocoapods/repos/master/Specs/a/f/b/ZMBase/0.1.0/ZMBase.podspec.json
- /Users/miaoz/.cocoapods/repos/ZMSpec/ZMBase/0.1.0/ZMBase.podspec

pod install后我們來看下工程目錄

pod install后的目錄.jpg

我們會(huì)看到.h扯饶、.m及源碼都能暴露出來恒削,是因?yàn)槲覀僺pec文件

 s.source_files = 'ZMBase/Classes/**/*.swift'
 s.source_files = 'OTBase/Classes/**/*.{h,m}'
  #源碼頭文件配置
  # s.public_header_files = 'Pod/Classes/**/*.h'
  # s.public_header_files = 'Pod/Classes/**/*.swift'

總結(jié)要點(diǎn)cocoapods創(chuàng)建Swift(OC)私有庫:

創(chuàng)建私有spec repo

$ pod repo add [privateSpecRepoName] [privateGitPath]
創(chuàng)建私有spec repo 中的lib

$ pod lib create [libName]

提交到創(chuàng)庫
$ git add .
$ git commit -s -m "初始導(dǎo)入"
$ git remote add origin [創(chuàng)庫ssh地址]           #添加遠(yuǎn)端倉庫
$ git push origin master     #提交到遠(yuǎn)端倉庫
$ git tag -m "發(fā)布" "0.1.0"
$ git push --tags     #推送tag到遠(yuǎn)端倉庫
提交podspec到私有repo

$ pod repo push [privateSpecRepoName] [libName].podspec

至此,我們的私有庫尾序、發(fā)布到官方cocoaPods庫已經(jīng)發(fā)布結(jié)束钓丰。具體更詳細(xì)的信息,建議大家多多參考CocoaPods官網(wǎng)每币。

*更新版本

--code
 git add .     //新增的文件 加入倉庫 
 git commit -a -m "0.1.2"      "0.1.2" -- tag 號(hào) //  需要提交的文件上傳確認(rèn)
git pull origin master         //下拉最新資源
 git push origin master         //上傳本地最新代碼
 git tag 0.1.2      //打tag
 git push --tags   

 --spec
pod lib lint --allow-warnings     //驗(yàn)證本地庫是否正確    lib  換成 spec 的 話 就是 就是驗(yàn)證遠(yuǎn)程服務(wù)器的 庫 是否正確

一些需要選項(xiàng):

--verbose:打印錯(cuò)誤
--allow-warnings:允許警告
--use-libraries:如果自己私有庫包含library携丁,則需要
--no-clean:檢查問題
--sources:如果依賴別的第三方庫則需要
pod repo push ZMBase ZMSpec.podspec --allow-warnings

lint完整寫法(有依賴庫、允許警告):

pod lib lint YYStudio_LoanSDK.podspec --sources='http://10.11.180.29/mobileDevelopers/YZT-Loan-Pod-Spec.git' --verbose --allow-warnings --use-libraries --no-clean

上傳完整寫法(有依賴庫兰怠、允許警告):

pod repo push com-mobiledevelopers-yzt-loan-pod-spec YYStudio_ACFaceCheckSDK.podspec --sources='https://github.com/CocoaPods/Specs.git' --allow-warnings --use-libraries
命令行指令:

history    查看自己用過的歷史指令

pod repo list   查看本地repo私有庫資源信息

open ~/.cocoapods   打開本地私有庫資源的位置

若是出現(xiàn)錯(cuò)誤信息
[!] The repo MyRepo at ../.cocoapods/repos/MyRepo is not clean
更新下我們的版本庫梦鉴,

$ pod repo update [你的repo]

demo地址
Specs: https://github.com/miaozhang9/ZMSpecccc.git
Swift: https://github.com/miaozhang9/ZMBase.git
OC: https://github.com/miaozhang9/OTBase.git

下邊是一些podSpec相關(guān)的文章,不太懂得可以看下揭保。
配置Spec踩過的坑
podspec文件講解

有問題大家可以留言7食取!秸侣!
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末快骗,一起剝皮案震驚了整個(gè)濱河市娜庇,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌方篮,老刑警劉巖名秀,帶你破解...
    沈念sama閱讀 206,311評論 6 481
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異藕溅,居然都是意外死亡匕得,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 88,339評論 2 382
  • 文/潘曉璐 我一進(jìn)店門巾表,熙熙樓的掌柜王于貴愁眉苦臉地迎上來汁掠,“玉大人,你說我怎么就攤上這事集币】稼澹” “怎么了?”我有些...
    開封第一講書人閱讀 152,671評論 0 342
  • 文/不壞的土叔 我叫張陵鞠苟,是天一觀的道長乞榨。 經(jīng)常有香客問我,道長当娱,這世上最難降的妖魔是什么吃既? 我笑而不...
    開封第一講書人閱讀 55,252評論 1 279
  • 正文 為了忘掉前任,我火速辦了婚禮跨细,結(jié)果婚禮上鹦倚,老公的妹妹穿的比我還像新娘。我一直安慰自己冀惭,他們只是感情好震叙,可當(dāng)我...
    茶點(diǎn)故事閱讀 64,253評論 5 371
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著散休,像睡著了一般媒楼。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上溃槐,一...
    開封第一講書人閱讀 49,031評論 1 285
  • 那天,我揣著相機(jī)與錄音科吭,去河邊找鬼昏滴。 笑死,一個(gè)胖子當(dāng)著我的面吹牛对人,可吹牛的內(nèi)容都是我干的谣殊。 我是一名探鬼主播,決...
    沈念sama閱讀 38,340評論 3 399
  • 文/蒼蘭香墨 我猛地睜開眼牺弄,長吁一口氣:“原來是場噩夢啊……” “哼姻几!你這毒婦竟也來了?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 36,973評論 0 259
  • 序言:老撾萬榮一對情侶失蹤蛇捌,失蹤者是張志新(化名)和其女友劉穎抚恒,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體络拌,經(jīng)...
    沈念sama閱讀 43,466評論 1 300
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡俭驮,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 35,937評論 2 323
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了春贸。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片混萝。...
    茶點(diǎn)故事閱讀 38,039評論 1 333
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖萍恕,靈堂內(nèi)的尸體忽然破棺而出逸嘀,到底是詐尸還是另有隱情,我是刑警寧澤允粤,帶...
    沈念sama閱讀 33,701評論 4 323
  • 正文 年R本政府宣布崭倘,位于F島的核電站,受9級特大地震影響维哈,放射性物質(zhì)發(fā)生泄漏绳姨。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 39,254評論 3 307
  • 文/蒙蒙 一阔挠、第九天 我趴在偏房一處隱蔽的房頂上張望飘庄。 院中可真熱鬧,春花似錦购撼、人聲如沸跪削。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,259評論 0 19
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽碾盐。三九已至,卻和暖如春揩局,著一層夾襖步出監(jiān)牢的瞬間毫玖,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 31,485評論 1 262
  • 我被黑心中介騙來泰國打工凌盯, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留付枫,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 45,497評論 2 354
  • 正文 我出身青樓驰怎,卻偏偏與公主長得像阐滩,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個(gè)殘疾皇子县忌,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 42,786評論 2 345

推薦閱讀更多精彩內(nèi)容