以前总结过,最近要使用组件化,但是遇见问题再看以前的手记,却发现行不通了,感觉又得重新整理,技术变化太快,总要紧跟技术潮流。再来一遍吧。
$ pod repo 查看本地索引库
在https://coding.net上创建
私有仓库Spec https://git.coding.net/ZKReadStone/ZKNewSpec.git
和私有项目仓库Module https://git.coding.net/ZKReadStone/BaseXib.git
$ pod lib create BaseXibView 创建私有库工程 最好再指定位置创建,例桌面的CocoaLib文件夹里
$ pod repo add ZKSpec https://git.coding.net/ZKReadStone/ZKNewSpec.git
添加本地私有索引库并与远程私有库关联
私有库文件替换Replace.m文件
修改.podspec文件,重点–重点–重点
Pod::Spec.new do |s|
s.name = 'XibView'
s.version = '0.1.0'
s.summary = 'use of XibView.'
# 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 = <<-DESC
XibView is xib a tool for user ,any can product a project quickly!!!!
DESC #模块详情描述,比 s.summary 长点
s.homepage = 'https://coding.net/u/ZKReadStone/p/ZKNewSpec' #Spec主页
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'ZKReadStone' => 'zhangkangreadstone@163.com' }#账户名和邮箱,这里也要正确,如果在https://coding.net ,账户名 和对应的邮箱
s.source = { :git => 'https://git.coding.net/ZKReadStone/BaseXib.git', :tag => s.version.to_s }#模块资源地址 注意不是Spec地址
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
s.ios.deployment_target = '9.0' #模块支持的版本
s.source_files = 'XibView/Classes/*.{h,m}'#表示资源文件位置类型
# s.resource_bundles = {
# 'XibView' => ['XibView/Assets/*.png']
# }
# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
上传到远程仓库
cd 到对应的目录下
$ git remote add origin https://…git//关联远程仓库
$ git status //查看提交文件状态
$ git add .
$ git commit -m"first commits"
$ git push origin master
$ git tag ‘0.1.0’
$ git push --tags //打tag 重点–重点–重点 必要步骤
cd Example 下 $ pod install
验证本地和远端
$ pod lin lint
$ pod spec lint
$ pod spec lint --allow-warnings(验证远程是否正确,注意:Username与Password一定要填写正确)
$ pod repo push ZKSpec ZKNewSpec.podspec
$ pod repo
使用
source 'https://git.coding.net/ZKReadStone/ZKNewSpec.git'
platform :ios, '9.0'
target 'TestDemo' do
use_frameworks!
pod 'XibView'
end