美文网首页
组件化3-创建远程索引库和私有库

组件化3-创建远程索引库和私有库

作者: AlanGe | 来源:发表于2020-11-14 08:58 被阅读0次

    一、在码云上创建远程私有索引库

    1、新建创库

    2、填写相关信息

    3、打开终端,将远程私有库关联到本地

    pod repo add + 索引库名称 + 远程索引库地址
    
    pod repo add alangeitSpec https://gitee.com/alangeit/alangeit-spec.git
    

    如果没有权限,请配置码云的ssh公钥

    4、查看是否成功关联到本地

    或者终端输入:pod repo


    二、创建本地私有库

    1、在本地创建一个文件夹:AlanGeLib

    2、打开终端,cd到AlanGeLib:

    cd /Users/alange/Desktop/AlanGeLib
    

    3、利用模板库创建私有库

    pod lib create AlanGeLib
    

    4、删除 ReplaceMe.m,将自己需要的功能添加到这里

    5、cd到测试工程目录,安装添加进来的内容

    cd /Users/alange/Desktop/AlanGeLib/AlanGeLib/Example
    
    pod install
    

    这个只是创建了本地索引库

    三、 创建远程代码库

    1、新建一个远程AlanGeLib库

    2、填写信息,并选择“导入已有创库”,点击创建

    3、将本地私有库推送到远程私有库

    cd到AlanGeLib(Example工程的上一层目录)

    cd /Users/alange/Desktop/AlanGeLib/AlanGeLib
    git add .
    git commit --m "创建测试工程"
    
    // 推送代码到远程仓库
    git remote add origin git@gitee.com:alangeit/alan-ge-lib.git
    
    git push -u origin master
    
    // 打tag 
    git tag '0.1.0'
    git push --tags
    

    提交成功,刷新码云创库

    4、配置.podspec文件

     // 创库地址,没有“ /ge-categoryi-os.git”这后一段
    s.homepage        = 'https://gitee.com/alangeit’     
    //  完整代码下载地址
    s.source          = { :git => 'https://gitee.com/alangeit/ge-categoryi-os.git', :tag => s.version.to_s }   
    

    5、检查配置是否成功

    检查本地:pod lib lint

     -> AlanGeLib (0.1.0)
    
        - NOTE  | xcodebuild:  note: Using new build system
    
        - NOTE  | xcodebuild:  note: Building targets in parallel
    
        - NOTE  | xcodebuild:  note: Using codesigning identity override: -
    
        - NOTE  | [iOS] xcodebuild:  note: Planning build
    
        - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    
        - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99\. (in target 'Pods-App' from project 'Pods')
    
        - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99\. (in target 'App' from project 'App')
    
        - 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  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99\. (in target 'AlanGeLib' from project 'Pods')
    
    AlanGeLib passed validation.
    

    AlanGeLib passed validation. 表示成功

    远程:pod spec lint

     -> AlanGeLib (0.1.0)
    
        - NOTE  | xcodebuild:  note: Using new build system
    
        - NOTE  | xcodebuild:  note: Building targets in parallel
    
        - NOTE  | xcodebuild:  note: Using codesigning identity override: -
    
        - NOTE  | [iOS] xcodebuild:  note: Planning build
    
        - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    
        - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99\. (in target 'App' from project 'App')
    
        - 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  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99\. (in target 'Pods-App' from project 'Pods')
    
        - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99\. (in target 'AlanGeLib' from project 'Pods')
    
    Analyzed 1 podspec.
    
    AlanGeLib.podspec passed validation.
    

    AlanGeLib.podspec passed validation. 表示成功

    6、把本地索引库提交到远程索引库

    cd到库的测试工程目录(Example的上一层):

    cd /Users/alange/Desktop/AlanGeLib/AlanGeLib
    

    将AlanGeLib.podspec索引库推送到远程:

    pod repo push alangeitSpec AlanGeLib.podspec
    
    Validating spec
    
     -> AlanGeLib (0.1.0)
    
        - NOTE  | xcodebuild:  note: Using new build system
    
        - NOTE  | xcodebuild:  note: Building targets in parallel
    
        - NOTE  | xcodebuild:  note: Using codesigning identity override: -
    
        - NOTE  | [iOS] xcodebuild:  note: Planning build
    
        - NOTE  | [iOS] xcodebuild:  note: Constructing build description
    
        - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99\. (in target 'AlanGeLib' from project 'Pods')
    
        - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99\. (in target 'Pods-App' from project 'Pods')
    
        - NOTE  | [iOS] xcodebuild:  warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99\. (in target 'App' from project 'App')
    
        - 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')
    
    Updating the `alangeitSpec' repo
    
    Adding the spec to the `alangeitSpec' repo
    
     - [Add] AlanGeLib (0.1.0)
    
    Pushing the `alangeitSpec' repo
    

    如上表示成功

    7、检查库是否制作成功

    pod search AlanGeLib
    
    -> AlanGeLib (0.1.0)
    
       AlanGeLib
    
       pod 'AlanGeLib', '~> 0.1.0'
    
       - Homepage: [https://gitee.com/alangeit](https://gitee.com/alangeit)
    
       - Source:   [https://gitee.com/alangeit/alan-ge-lib.git](https://gitee.com/alangeit/alan-ge-lib.git)
    
       - Versions: 0.1.0 [alangeitSpec repo]
    

    四、测试

    1、打开测试工程:Example的Podfile文件,

    1.1、添加索引库源地址:

    source 'https://gitee.com/alangeit/alangeit-spec.git'
    

    注意:是alangeitSpec这个索引库的地址

    1.2、把

    pod 'AlanGeLib', :path => '../‘
    

    改为

    pod ‘AlanGeLib'
    

    2、cd到Example目录进行安装

    pod install
    
    alange@Alan16 Example % pod install
    
    Analyzing dependencies
    
    Downloading dependencies
    
    Installing AlanGeLib (0.1.0)
    
    Generating Pods project
    
    Integrating client project
    
    Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
    

    安装成功

    相关文章

      网友评论

          本文标题:组件化3-创建远程索引库和私有库

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