html
Commands:c++
+ repo Manage spec-repositoriesgit
+ search Searches for podsgithub
+ setup Setup the CocoaPods environmentobjective-c
+ spec Manage pod specsswift
+ trunk Interact with the CocoaPods API (e.g. publishing new specs)xcode
+ try Try a Pod!ide
+ update Update outdated project dependencies and create newui
$ pod
+ cache Manipulate the CocoaPods cache
+ init Generate a Podfile for the current directory.
+ install Install project dependencies to Podfile.lock versions
+ ipc Inter-process communication
+ lib Develop pods
+ list List pods
+ outdated Show outdated project dependencies
+ plugins Show available CocoaPods plugins
Podfile.lock
Options:
--silent Show nothing
--version Show the version of the tool
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command
建立CocoaPods核心步驟:
$ git tag -a 1.1.1 -m ’Tag release 1.1.1‘
$ git push --tags
添加成功
Counting objects: 1, done.
Writing objects: 100% (1/1), 163 bytes | 0 bytes/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To https://github.com/c6357/YUKit.git
* [new tag] 1.1.1 -> 1.1.1
這裏以YUKit爲例
官方推薦資源目錄模板以下
$ tree MyLib -L 2
MyLib
├── .travis.yml
├── _Pods.xcproject
├── Example
│ ├── MyLib
│ ├── MyLib.xcodeproj
│ ├── MyLib.xcworkspace
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Pods
│ └── Tests
├── LICENSE
├── MyLib.podspec
├── Pod
│ ├── Assets
│ └── Classes
│ └── RemoveMe.[swift/m]
└── README.md
push後添加 tag ( 這裏的tag 後面pod spec 文件 version 會用到)
pod spec create
$pod spec create [NAME|https://github.com/USER/REPO]
e.g. $ pod spec create YUKit https://github.com/c6357/YUKit
本地會生成一個YUKit.podspec文件
2.編輯 pod spec文件
如何編寫請參考官方文檔Specification 或者參考網上優秀pod spec 文件
本地驗證
$ cd ~/.cocoapods/repos/REPO_NAME
$ pod lib lint (驗證)
$ pod lib lint --verbose(驗證--並顯示詳細信息)
$ pod lib lint --allow-warning(驗證--忽略警告)
YUKit passed validation.
註冊trunk
$ pod trunk register orta@cocoapods.org 'Orta Therox' --description='macbook air'
$ pod trunk add-owner YUkit kyle@cocoapods.org(還能夠添加其餘小夥伴)
$ pod trunk me //查看本身的註冊信息
- Name: Orta Therox
- Email: orta@cocoapods.org
- Since: January 6th, 21:41
- Pods:
- YUKit
- Sessions:
- January 6th, 21:41 - Unverified. IP: XXXXX
- January 6th, 21:42 - May 13th, 21:42. IP: XXXXX
- January 6th, 21:44 - August 20th, 00:56. IP: XXXXX
- January 7th, 08:35 - May 14th, 09:20. IP: XXXXX
Updating spec repo `master`
Validating podspec
Updating spec repo `master`
CocoaPods 1.0.0.beta.6 is available.
提交到遠端(有警告要選最後一個)
$ pod trunk push YUKit.podspe
$ pod trunk push YUKit.podspe --verbose
$ pod trunk push YUKit.podspe --allow-warning
pod'YUKit', '~> 1.1.6'
$pod search yukit
YUKit for iOS.(objective-c 、c++)
pod 'YUKit', '~> 1.1.6'
- Homepage: https://github.com/c6357/YUKit
- Source: https://github.com/c6357/YUKit.git
- Versions: 1.1.6, 1.0.4, 1.0.0, 0.0.9 [master repo]
- Subspecs:
- YUKit/header (1.1.6)
- YUKit/foundation (1.1.6)
- YUKit/foundation/lib (1.1.6)
- YUKit/foundation/category (1.1.6)
- YUKit/uikit (1.1.6)
- YUKit/uikit/lib (1.1.6)
- YUKit/uikit/category (1.1.6)
- YUKit/services (1.1.6)
- YUKit/services/NSJson (1.1.6)
- YUKit/services/Reachability (1.1.6)
- YUKit/base (1.1.6)
- YUKit/base/NavigationController (1.1.6)
- YUKit/base/ViewController (1.1.6)
- YUKit/base/TableView (1.1.6)
- YUKit/base/View (1.1.6) - YUKit/base/ViewModel (1.1.6)
建立私有的請查閱官方文檔