Componentization
- 1 Initialize components
- 2 Modify the file
- 3 Git related configuration
-
- 3.1 Git initialization
- 3.2 Associate local library and remote library
- 3.3 Add files to repository
- 3.4 Submit the added files to the repository, and fill in the submission notes
- 3.5 Pull remote warehouse and merge locally
- 3.6 Push local code to remote warehouse
- 3.7 Verify private warehouse
- 3.8 Add tag and submit to warehouse
- 4 Component release
- 5 components used
1 Initialize components
$ pod lib create XXX
2 Modify the file
Modify XXX.podspec
files and other resource files
3 Git related configuration
3.1 Git initialization
$ git init
3.2 Associate local library and remote library
$ git remote add origin 远程库地址
3.3 Add files to repository
- Adding files to the repository (just adding to the cache)
.
means adding all files under the folder
$ git add .
3.4 Submit the added files to the repository, and fill in the submission notes
$ git commit -m "first commit"
3.5 Pull remote warehouse and merge locally
- merge
$ git pull
- merged version
$ git pull origin master
- Mandatory merging of versions, allowing binding of unrelated historical versions
$ git pull origin master --allow-unrelated-histories
3.6 Push local code to remote warehouse
3.6.1 There are codes and branches in the remote warehouse
- first push
$ git push -u origin master
- Subsequent push
$ git push origin master
- There are no files and
master
branches in the remote warehouse
$ git push -u origin --all
3.7 Verify private warehouse
- Note: Address 1 =
http://gitlab.wanda.cn/beyonds/fontend/app/byspaces/byphotopicker.git
- Note: Address 2 =
https://github.com/CocoaPods/Specs.git
$ pod spec lint --allow-warnings
- No other external repositories
$ pod spec lint --sources="地址1" --use-libraries --allow-warnings
- exist using other external repositories
$ pod spec lint --sources="地址2,地址1" --use-libraries --allow-warnings
3.8 Add tag and submit to warehouse
$ git tag 0.1.1 // 标签值需要与对应的版本相同
$ git push --tags
4 Component release
4.1 Publish to GitHub repository
- Publish using the following terminal command
$ pod trunk push [NAME].podspec
Or: < --allow-warnings
stands for ignore warning>
$ pod trunk push [NAME].podspec --allow-warnings
trunk
For the warehouse name, you can usepod repo
to view the current local warehouse name
4.2 Publish to personal private library <internal warehouse>
cd
Enter the directory[NAME].podspec
where- Execute the following code on the console and submit it to the [warehouse name] code base
$ pod repo push 仓库名 [NAME].podspec
- Example <
BYPodspace
index library name> <BYPhotoPicker
component name>
$ pod repo push BYPodspace BYPhotoPicker.podspec
或者
$ pod repo push BYPodspace BYPhotoPicker.podspec --allow-warnings //这个忽略警告
- Note: When creating a personal private library index library, it is best to have a file
5 components used
5.1 Delete cache
- Enter the search
CocoaPods
cache directory
$ cd ~/Library/Caches/CocoaPods
- View cache files
search_index.json
$ ls
- Delete search cache files
$ rm -f search_index.json
5.2 update
- renew
repo
$ pod repo update
- implement
$ pod install
- Update a specific index library
$ pod repo update 索引库名称