美文网首页
打造自己的远程git私有库,进行组件化开发

打造自己的远程git私有库,进行组件化开发

作者: MCUS | 来源:发表于2019-01-11 17:03 被阅读0次

该文章内容是我的入门篇,可以先看看,更好的实现方式,直接去看我最新整理的,地址:

https://www.jianshu.com/p/39ad741cf416


1)将自己远程的framework动态组件库A clone 本地的索引库中:

Pod repo add本地索引库名A远程组件索引库A地址

2)创建本地的私有框架库及私有库测试工程,同时会生成spec脚本文件

pod lib create  私有库名B

3 进入到私有库测试工程项目路径中,将framework动态组件库的代码文件 拷贝到 Classes文件夹中;

4)在私有库测试工程的podfile文件中输入:

use_frameworks!

platform :ios,'8.0'

project '/Volumes/MacData/MacData/projects/remoteLib/UIBase/Example/UIBase.xcodeproj'

target 'UIBase_Example' do

  pod 'UIBase',:path => '../'

  target 'UIBase_Tests' do

    inherit! :search_paths

  end

end

5)修改.podspec文件 的内容;

Pod::Spec.new do |s|

  s.name            = 'UIBase'

  s.version          = '0.1.0'

  s.summary          = 'UIBase是一个测试库!!'

# 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

TODO: UIBase是一个有用的测试库!!

                       DESC

  s.homepage        = 'https://www.baidu.com'

  # s.screenshots    = 'www.example.com/screenshots_1','www.example.com/screenshots_2'

  s.license          = { :type => 'MIT',:file => 'LICENSE' }

  s.author          = { 'tian' => 'a@qq.com' }

  s.source          = { :git => 'https://github.com/tian/UIBase.git',:tag => s.version.to_s }

  # s.social_media_url = 'https://twitter.com/'

  s.ios.deployment_target = '8.0'

  s.source_files = 'UIBase/Classes/**/*'

  # s.resource_bundles = {

  #  'UIBase' =>['UIBase/Assets/*.png']

  # }

  # s.public_header_files = 'Pod/Classes/**/*.h'

  # s.frameworks = 'UIKit','MapKit'

  # s.dependency 'AFNetworking','~> 2.3'

  s.dependency 'Masonry'

6pod install 安装;

7)本地校验,(修改代码,修改.podspec文件内容),保证没有问题;

pod lib lint —allow-warnings

(8)给私有库测试工程B 创建 远程私有库, 并添加:

git remote add origin远程组件索引库B地址

git add.

git commit —m‘增加组件’

git push origin master

Git tag‘0.1.0‘//这一步必须做,都不能省

git push —tags

(9)在podspec文件所在路径中,进行远程校验:

pod spec lint

pod repo,查看本地索引库

(10)将.podspec文件提交到远程索引库A  中:

pod repo push本地索引库名A  .podspec文件名

(如,pod repo push UIBaseKit UIBase.podspec --allow-warnings)

(11)搜索组件的框架信息

pod search  私有库名B

(12)在你想要导入组件 的项目工程中(也可以新建一个测试下),podfile输入:

use_frameworks!

platform :ios,'8.0'

project '/Volumes/MacData/MacData/projects/Repos/Repos.xcodeproj'

source 'https://github.com/CocoaPods/Specs.git'

source 'https://github.com/tianlunyuche/UIBaseKit.git'

target 'Repos' do

  pod 'UIBase'

end

pod install安装,#import“组件名.h”运行测试一下

删除远程标签:

git push origin :refs/tags/标签名

再重新打:

git tag‘0.1.0‘//这一步必须做,都不能省

git push —tags

将Masonry第三方开源库从私有库测试工程的 Classes文件夹中删除;

https://www.jianshu.com/p/9096a2eb2804

相关文章

网友评论

      本文标题:打造自己的远程git私有库,进行组件化开发

      本文链接:https://www.haomeiwen.com/subject/uhachqtx.html