自定义CocoaPods代码仓库-gitlab

资料

如何在gitLib 下创建私有 CocoaPods 仓库
CocoaPods私有库配置笔记
使用Cocoapods创建私有podspec
私有库添加pod,gitlab
CocoaPods私有仓库搭建
[Cocoapods]项目添加Cocoapods支持遇到的坑
The NAME.podspec specification does not validate
CocoaPods基础篇之创建私有 repo
自定义cocoapods库
CocoaPods中Podfile语法
iOS Xcode全面剖析
[iOS]XcodeProject的内部结构分析
cocoapods系列教程—spec文件

使用私有Cocoapods仓库 中高级用法

[CocoaPods]podspec文件中的resource和resource_bundle

*匹配所有文件
c*匹配以名字C开头的文件
*c匹配以名字c结尾的文件
*c*匹配所有名字包含c的文件
**文件夹以及递归子文件夹
?任意一个字符(注意是一个字符)
[set] 匹配多个字符,支持取反
{p,q} 匹配名字包括p 或者 q的文件

日常上传

git push origin :refs/tags/0.0.8

pod lib lint --allow-warnings
pod lib lint  --sources='http://172.16.0.108/zhangshuai/yqmsspecs.git,https://github.com/CocoaPods/Specs.git' --allow-warnings --verbose
git tag
git tag 0.0.7
git push origin 0.0.7
pod spec lint --sources='http://172.16.0.108/zhangshuai/yqmsspecs.git,https://github.com/CocoaPods/Specs.git' --allow-warnings --verbose
pod repo list
pod repo push yqmsspecs  Module_DetailPage.podspec --allow-warnings --verbose

pod repo update ~/.cocoapods/repos/yqmsspecs/
pod repo update ~/.cocoapods/repos/0-zhangshuai-yqmsspecs/

 pod repo push 0-zhangshuai-yqmsspecs Module_Tree.podspec --allow-warnings --verbose --sources=https://github.com/CocoaPods/Specs.git,http://172.16.0.108/zhangshuai/yqmsspecs.git,http://172.16.0.108/YQMSUtils/YQMSUtilsSpec.git

重点难点

上传repo,报出错误详细信息

$pod repo push zhiguang-repo QZCrashLogManager.podspec --allow-warnings

Validating spec
 -> QZCrashLogManager (0.1.0)
    - WARN  | description: The description is shorter than the summary.

Updating the `zhiguang-repo' repo

Your configuration specifies to merge with the ref 'master'
from the remote, but no such ref was fetched.

Adding the spec to the `zhiguang-repo' repo

 - [Add] QZCrashLogManager (0.1.0)

Pushing the `zhiguang-repo' repo

To https://github.com/zhiguangqiao/cocoapod-repo.git
 * [new branch]      master -> master

跟公共仓库的冲突时,重新指定路径

// 使用master分支
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git'
// 使用指定分支
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :branch => 'dev'
// 使用指定tag
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :tag => '0.7.0'
// 使用某一次提交
pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :commit => '082f8319af'

上传的步骤(基于成功上传过的代码)

修改podsepec文件

Pod::Spec.new do |s|

  s.name         = "DKNightVersion"
  s.version      = "1.1.0"
  s.summary      = "DKNightVersion"

  s.description  = <<-DESC
                msnightversion  component
                   DESC

  s.homepage     = "http://172.16.0.108/zhangshuai/msnightversion.git"

  s.license      = "MIT"
  s.author             = { "zhaojian" => "[email protected]" }

  s.platform     = :ios
  s.ios.deployment_target   = "9.0"
  s.requires_arc = true
  s.source       = { :git => "http://172.16.0.108/zhangshuai/msnightversion.git", :tag => "#{s.version}" }
  s.source_files  = "DKNightVersion/Core/*.{h,m}", "DKNightVersion/ColorTable/*{h,m}", "DKNightVersion/extobjc/*.h", "DKNightVersion/DeallocBlockExecutor/*.{h,m}", "DKNightVersion/UIKit/*.{h,m}", "DKNightVersion/Manual/*.{h,m}", "DKNightVersion/CoreAnimation/*.{h,m}", "DKNightVersion/DKNightVersion.h"


  s.framework  = "Foundation"
  s.static_framework  =  true
  s# .dependency 'JSONModel'
  # s.dependency 'MSBaseViewController'
  # s.dependency 'Masonry'
  # s.dependency 'MBProgressHUD', '~> 1.1.0'
  # s.dependency 'MJRefresh'
  # s.dependency 'AFNetworking', '~>3.0'
  # s.dependency 'MJExtension'
  # s.dependency 'SDWebImage'
end

提交所有代码

git add -A && git commit -m "#note 上传代码"

打一个版本号的tag

git tag 1.1.0
git push origin 1.1.0 //并上传到gitlab仓库

找到要上传的索引仓库

$ ls -al  ~/.cocoapods/repos/
total 0
drwxr-xr-x+  8 flannery  staff   256 10 25 20:11 .
drwxr-xr-x+  4 flannery  staff   128 10 25 20:09 ..
drwxr-xr-x  17 flannery  staff   544  9 19 09:09 guangqiang-liu
drwxr-xr-x+ 10 flannery  staff   320  6 17 11:30 master
drwxr-xr-x+ 32 flannery  staff  1024 10 24  2018 taobao-baichuansdk-alibcspecs
drwxr-xr-x   8 flannery  staff   256 10 25 15:11 trunk
drwxr-xr-x   8 flannery  staff   256 10 25 21:16 yqmsspecs

上传

pod repo push yqmsspecs DKNightVersion.podspec --allow-warnings 
//显示的日志

Validating spec
 -> DKNightVersion (1.1.0)
    - NOTE  | xcodebuild:  note: Using new build system
    - NOTE  | [iOS] xcodebuild:  note: Planning build
    - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    - NOTE  | [iOS] xcodebuild:  warning: Skipping code signing because the target does not have an Info.plist file and one is not being generated automatically. (in target 'App' from project 'App')
    - NOTE  | xcodebuild:  : note: 'UISearchTextField' has been marked as being introduced in iOS 13.0 here, but the deployment target is iOS 9.0.0
    - NOTE  | xcodebuild:  DKNightVersion/DKNightVersion/Manual/UISearchBar+Keyboard.m:55:9: note: enclose 'UISearchTextField' in an @available check to silence this warning
    - WARN  | [iOS] xcodebuild:  DKNightVersion/DKNightVersion/Manual/UISearchBar+Keyboard.m:65:9: warning: 
    - NOTE  | xcodebuild:  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator13.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UISearchTextField.h:29:12: note: 'UISearchTextField' has been marked as being introduced in iOS 13.0 here, but the deployment target is iOS 9.0.0
    - NOTE  | xcodebuild:  DKNightVersion/DKNightVersion/Manual/UISearchBar+Keyboard.m:65:9: note: enclose 'UISearchTextField' in an @available check to silence this warning
    - WARN  | xcodebuild:  DKNightVersion/DKNightVersion/Manual/UISearchBar+Keyboard.m:82:9: warning: 'UISearchTextField' is only available on iOS 13.0 or newer [-Wunguarded-availability-new]
    - NOTE  | xcodebuild:  DKNightVersion/DKNightVersion/Manual/UISearchBar+Keyboard.m:82:9: note: enclose 'UISearchTextField' in an @available check to silence this warning
    - WARN  | xcodebuild:  DKNightVersion/DKNightVersion/Manual/UISearchBar+Keyboard.m:92:9: warning: 'UISearchTextField' is only available on iOS 13.0 or newer [-Wunguarded-availability-new]
    - NOTE  | [iOS] xcodebuild:  DKNightVersion/DKNightVersion/Manual/UISearchBar+Keyboard.m:92:9: note: 
    - WARN  | xcodebuild:  DKNightVersion/DKNightVersion/DeallocBlockExecutor/NSObject+DeallocBlock.h:13:32: warning: this block declaration is not a prototype [-Wstrict-prototypes]
    - WARN  | xcodebuild:  DKNightVersion/DKNightVersion/DeallocBlockExecutor/DKDeallocBlockExecutor.h:13:51: warning: this block declaration is not a prototype [-Wstrict-prototypes]
    - WARN  | xcodebuild:  DKNightVersion/DKNightVersion/DeallocBlockExecutor/DKDeallocBlockExecutor.h:15:49: warning: this block declaration is not a prototype [-Wstrict-prototypes]
    - WARN  | xcodebuild:  DKNightVersion/DKNightVersion/DeallocBlockExecutor/NSObject+DeallocBlock.m:17:32: warning: this block declaration is not a prototype [-Wstrict-prototypes]
    - WARN  | xcodebuild:  DKNightVersion/DKNightVersion/DeallocBlockExecutor/DKDeallocBlockExecutor.m:13:51: warning: this block declaration is not a prototype [-Wstrict-prototypes]
    - WARN  | [iOS] xcodebuild:  DKNightVersion/DKNightVersion/Manual/UISearchBar+Keyboard.m:55:9: warning: 'UISearchTextField' is only available on iOS 13.0 or newer [-Wunguarded-availability-new]
    - WARN  | [iOS] xcodebuild:  DKNightVersion/DKNightVersion/Manual/UISearchBar+Keyboard.m:65:9: warning: 'UISearchTextField' is only available on iOS 13.0 or newer [-Wunguarded-availability-new]
    - NOTE  | [iOS] xcodebuild:  DKNightVersion/DKNightVersion/Manual/UISearchBar+Keyboard.m:92:9: note: enclose 'UISearchTextField' in an @available check to silence this warning
    - WARN  | [iOS] xcodebuild:  DKNightVersion/DKNightVersion/DeallocBlockExecutor/NSObject+DeallocBlock.h:13:32: warning: 
    - WARN  | xcodebuild:  /Users/flannery/Library/Developer/Xcode/DerivedData/App-bukzfywgrqyfxmdadcdkkfljgoie/Build/Products/Release-iphonesimulator/DKNightVersion/DKNightVersion.framework/Headers/DKDeallocBlockExecutor.h:13:51: warning: this block declaration is not a prototype [-Wstrict-prototypes]
    - WARN  | xcodebuild:  /Users/flannery/Library/Developer/Xcode/DerivedData/App-bukzfywgrqyfxmdadcdkkfljgoie/Build/Products/Release-iphonesimulator/DKNightVersion/DKNightVersion.framework/Headers/DKDeallocBlockExecutor.h:15:49: warning: this block declaration is not a prototype [-Wstrict-prototypes]
    - WARN  | [iOS] xcodebuild:  /Users/flannery/Library/Developer/Xcode/DerivedData/App-bukzfywgrqyfxmdadcdkkfljgoie/Build/Products/Release-iphonesimulator/DKNightVersion/DKNightVersion.framework/Headers/NSObject+DeallocBlock.h:13:32: warning: 
    - WARN  | [iOS] xcodebuild:  /Users/flannery/Library/Developer/Xcode/DerivedData/App-bukzfywgrqyfxmdadcdkkfljgoie/Build/Products/Release-iphonesimulator/DKNightVersion/DKNightVersion.framework/Headers/NSObject+DeallocBlock.h:13:32: warning: this block declaration is not a prototype [-Wstrict-prototypes]

Updating the `yqmsspecs' repo


Adding the spec to the `yqmsspecs' repo

 - [Update] DKNightVersion (1.1.0)

Pushing the `yqmsspecs' repo


[!] 'DKNightVersion' uses the unencrypted 'http' protocol to transfer the Pod. Please be sure you're in a safe network with only trusted hosts. Otherwise, please reach out to the library author to notify them of this security issue.

配置cocoapods仓库(重新配置)

上传列表页pods仓库

1. 更新相应的仓库
pod repo update ~/.cocoapods/repos/yqmsspecs/
2. 
pod lib lint --allow-warnings
pod lib lint --allow-warnings --sources='http://172.16.0.108/zhangshuai/yqmsspecs.git,https://github.com/CocoaPods/Specs.git' --allow-warnings --verbose

// 代码打tag
git add -A && git commit -m "add pod files"
git push origin master

// 上传到私有仓库
pod repo push CTMSpecs CTMediator.podspec --allow-warnings

实际项目创建podspec文件

1. pod spec create Moudle_MSFilter

2. 编辑spec文件
2.1 DESC 描述内容不能为空

3. 进行校验
3.1 本地校验
3.2 网络校验

4. 上传到pods

创建podspec文件2

在这里插入代码片
发布了167 篇原创文章 · 获赞 62 · 访问量 22万+

猜你喜欢

转载自blog.csdn.net/AdrianAndroid/article/details/102775149