title: 通过码云创建远程私有库
date: 2018-05-04 16:53:35
type: "categories"
categories:
- 组件化
description: 组件化之路第一章,通过码云pod来创建远程私有库
组件化(一)
创建远程私有库
- 基于cocoapods建立远程私有库做组件化
- 通过码云私有仓库实现
本地创建私有仓库
- 创建本地私有库
pod lib create 本地私有库名称
-
本地私有库可以直接使用
path => 本来路径来pod
-
添加自己的项目文件
-
修改Spec文件
Pod::Spec.new do |s|
s.name = 'OCRouter'
s.version = '0.1.0'
s.summary = 'OCRouter.路由'
# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
s.description = 'OCRouter.路由的使用'
s.homepage = 'https://gitee.com/a407184508'
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'a407184508' => '407184508@qq.com' }
s.source = { :git => 'https://gitee.com/a407184508/OCRouter.git', :tag => s.version.to_s }
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '8.0'
s.source_files = 'OCRouter/Classes/**/*'
# s.resource_bundles = {
# 'OCRouter' => ['OCRouter/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
- 通过Git提交到远程仓库进行管理
git add .
git commit -m "初始化项目"
git push
- 本地私有库关联码云创建的Spec库文件
pod repo add Spec git@gitee.com:a407184508/Spec.git
- 在码云上配置公钥建立本地ssh链接
ssh-keygen -t rsa -C 407184508@qq.com
cat ~/.ssh/id_rsa.pub
ssh -T git@gitee.com
- 查看本地私有库
➜ Pods pod repo
master
- Type: git (master)
- URL: https://github.com/CocoaPods/Specs.git
- Path: /Users/chenzhou/.cocoapods/repos/master
Spec
- Type: git (master)
- URL: git@gitee.com:a407184508/Spec.git
- Path: /Users/chenzhou/.cocoapods/repos/Spec
2 repos
- 进入私有库文件夹,把文件下的Spec文件push到本地私有库目录中去
pod repo push Spec OCRouter.podspec
- 然后就可以通过
pod search OCRouter
搜索你的私有库
-> OCRouter (0.1.0)
OCRouter.路由
pod 'OCRouter', '~> 0.1.0'
- Homepage: https://gitee.com/a407184508
- Source: https://gitee.com/a407184508/OCRouter.git
- Versions: 0.1.0 [Spec repo]
(END)
网友评论