Foreword: CocoaPods related information
Commands:
+ repo Manage spec-repositories
+ search Searches for pods
+ setup Setup the CocoaPods environment
+ spec Manage pod specs
+ trunk Interact with the CocoaPods API (e.g. publishing new specs)
+ try Try a Pod!
+ update Update outdated project dependencies and create new
-
-
+ 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
Create CocoaPods core steps:
1. Upload resources to github
$ git tag -a 1.1.1 -m ’Tag release 1.1.1‘
$ git push --tags
Added successfully
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
2. Create and edit the pos spec file
-
-
Here is an example of YUKit
-
The official recommended resource directory template is as follows
-
$ 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 -
Add tag after push (the pod spec file version will be used after the tag here)
-
-
pod spec create
$pod spec create [NAME|https://github.com/USER/REPO]
e.g. $ pod spec create YUKit https://github.com/c6357/YUKit
A YUKit.podspec file will be generated locally
-
2. Edit the pod spec file
How to write, please refer to the official document Specification or refer to the excellent pod spec file on the Internet
3. Verify the pod spec and submit it to Specs
-
local authentication
-
$ cd ~/.cocoapods/repos/REPO_NAME
-
$ pod lib lint (验证)
-
$ pod lib lint --verbose(验证--并显示详细信息)
-
$ pod lib lint --allow-warning(验证--忽略警告)
-
YUKit passed validation.
-
-
register trunk
-
$ pod trunk register [email protected] 'Orta Therox' --description='macbook air'
-
$ pod trunk add-owner YUkit [email protected](还可以添加其他小伙伴)
-
$ pod trunk me //查看自己的注册信息
-
- Name: Orta Therox
- Email: [email protected]
- 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.
-
Submit to the remote end (there is a warning to choose the last one)
-
$ pod trunk push YUKit.podspe
-
$ pod trunk push YUKit.podspe --verbose
-
$ pod trunk push YUKit.podspe --allow-warning
-
4. Use
under 'YUKit' , '~> 1.1.6'
$pod search yukit
YUKit for iOS.(objective-c 、c++)
under '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)
Using the example YUKitExample
To create a private one, please refer to the official documentation