私有库添加pod,gitlab

1、创建仓库
在gitlab创建2个仓库,specManager用来管理私有三方查找索引;specDemo组件化私有三方远程库;
2、编写代码
注意:在仓库中创建项目,切记项目名不能与到时候的库名相同,否则会无法制作成库文件
1.将远程的specDemo 通过git clone 到本地;

2.创建本地xcode文件放入已经 git init 的文件夹内

3.创建specDemo 的 spec文件 -> pod spec create specDemo

4.编写spec文件
创建成功后需要编写spec文件,具体参数写法可参照官方文档:

Pod::Spec.new do |s|

  s.name         = "BGNetworking"
  s.version      = "1.0.0"
  s.summary      = "网络请求框架"
  s.description  = "网络请求框架"
  s.homepage     = "http://git.dev.adnonstop.com/ios/module/BTNetworking"
  s.license      = {:type => "MIT", :file => "LICENSE"}
  s.author       = {"wangwenzhen" => "wangwenzhen@adnonstop.com"}
  s.platform     = :ios, "8.0"
  s.source       = {:git => "git@git.dev.adnonstop.com:ios/module/BTNetworking.git", :tag => "#{s.version}" }
  s.source_files = 'BTNetworkingDemo/BTNetworking/**/*.{h,m}'
  s.dependency 'AFNetworking', '~> 3.1.0'

end

https://guides.cocoapods.org/syntax/podspec.html#specification
5.cmd 命令 pod lib lint --verbose --allow-warnings 查看是否被cocoapod 支持

  1. 将私有组件 打上tag
git add .
git commit -m "添加了base和category代码"
git tag -a 0.0.1 -m "添加0.0.1tag"
git push origin --tags
git push

完成后刷新远程git仓库,查看日志

image

7、添加源至本地cocoapods文件夹中

pod repo add AutoziBaseSpec https://git.oschina.net/heeween/AutoziBaseSpec.git
cd ~/.cocoapods/repos/
open .

命令执行后 通过open 查看spec是否存储到了本地
8、提交pod

warn 需要cd到组件化的文件夹下

pod repo push AutoBaseSpec BeautyKit.podspec --allow-warnings --sources='root@jler.vip:wangwenzhen/BeautyKit.git'

完成后刷新远程spec仓库看是否有tag组件化工程添加的日志

通过 pod search 组件spec中的name 命令查看 本地日志

xcode创建一个demo名称的工程,退出
cd /Users/heew/Desktop/demo 
pod init 
pod search AutoziBase
  1. 新建xcode工程中的时候
    pod init 后在 podfile中编写
source 'https://github.com/CocoaPods/Specs.git' 【这个都是一样的】
source 'https://git.oschina.net/heeween/AutoziBaseSpec.git'//spec仓库 【私有】
target 'demo' do
pod 'AutoziBase', '~> 0.0.1'
end

私有库

私有库 依赖 私有库

pod spec lint --sources='root@jler.vip:wangwenzhen/AutoBaseSpec.git,https://github.com/CocoaPods/Specs.git' --use-libraries --allow-warnings

pod repo push AutoBaseSpec BGAlertView.podspec --allow-warnings --use-libraries --sources='root@jler.vip:wangwenzhen/AutoBaseSpec.git,https://github.com/CocoaPods/Specs'
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容