• 添加Pods依赖


    1. 添加所需文件

    1.1. 添加 .podspec 文件

    1.1.1.  创建

    • 必须文件
    • 使用命令 pod spec create name.podspec
    • 或者直接拷贝一份

    1.1.2.  添加内容

    • 必须
    • 来到仓库根目录
    • 添加pods依赖库需要一个描述文件,并且文件名要和依赖库的名称一样。
    • s.source_files 是源文件路径
    Pod::Spec.new do |s|
    
      s.name         = "GuidePagesIOS"
      s.version       = "1.0.0"
    
      s.summary      = "A short description of GuidePagesIOS."
      s.description  = <<-DESC
                       DESC
    
      s.homepage     = "https://github.com/gs01md/GuidePagesIOS"
    
      s.license      = "MIT"
    
      s.author             = { "gs01md" => "gs01md@163.com" }
    
      s.platform     = :ios, "5.0"
    
    
      s.source       = { :git => "https://github.com/gs01md/GuidePagesIOS.git", :tag => s.version.to_s }
      
      s.requires_arc = true
    
    
      s.source_files  ='GuidePagesIOS/*
    
    
      # s.frameworks = "SomeFramework", "AnotherFramework"
    
      # s.exclude_files = "Classes/Exclude"
      # s.public_header_files = "Classes/**/*.h"
      # s.resource  = "icon.png"
      # s.resources = "Resources/*.png"
      # s.preserve_paths = "FilesToSave", "MoreFilesToSave"
      
    
    end

    1.2. LICENSE 文件

    • 必须文件
    • 在github网站创建时已经选择,例如 "MIT" 类型。

    1.3. 主类文件

      即要共享的类。

    1. 必须文件
    2. 根目录下创建同名文件夹
    3. 在该文件夹下创建同名的类

    1.4. demo 工程

    1. 可选项
    2. 创建文件夹 同名+Demo
    3. 加入demo工程,应该是同名的。

    1.5. README.md

    • 可选
    • 仓库说明

    2. 提交到 github

    2.1. pod 验证

    2.1.1. 为 pod 添加版本号并打上tag

    set the new version to 1.0.0
    set the new tag to 1.0.0

    2.1.2. pod 验证命令

    pod lib lint

    如果输出类似,则成功了:

    -> name (1.0.0)
    name passed validation.

    但打印任何 warning 或者 error 信息,都表示验证失败。

    2.1.2.1. error
    2.1.2.1.1. file: no .<digit> floating literal anymore; put 0 before dot 

      找到问题行,查看是否是用来中文的 引号

          发现的错误都是单引号和双引号引起的错误。直接拷贝吧,好像怎么输都会有错。

    2.1.2.2. warning
         - WARN  | The summary is not meaningful.    无意义的注释
         - WARN  | The description is shorter than the summary. 描述比简述要短

    2.2. 上传到 github 仓库

    2.3. 上传podspec文件到CocoaPods官方仓库中

    2.3.1. fork一份CocoaPods官方的Specs仓库

    2.3.1.1. 打开CocoaPods的Specs仓库

           https://github.com/CocoaPods/Specs

    2.3.1.2. Fork

      点击右上角的 Fork 按钮,并 Clone到本地。

    2.3.1.2. 加入自己的文件夹
    • 创建一个共享类同名的文件夹(如 GuidePagesIOS)
    • 在其下创建版本号文件夹(如 1.0.0)
    • 放入podspec文件
    2.3.1.3. 上传修改

      简单的方式就是用github客户端

     

      可以使用控制台命令

      $ git add -A && git commit -m "Add GuidePagesIOS podspec file"  

      $ git push origin master

    2.3.1.4. pull 修改
    • 上传之后进入网页中自己fork 的 Specs库,点击左上角的绿色按钮。
    • 点击完后进入另一个页面,点击 “Create Pull Request” 按钮。
    • 之后就是等待结果了。一天左右会邮件通知。
  • 相关阅读:
    One网络模拟器探索之七:路由模块的工作原理
    An Intuitive Explanation of GraphSAGE
    《k8s 源码分析》- Custom Controller 之 Informer
    《k8s-1.13版本源码分析》-抢占调度
    《k8s-1.13版本源码分析》- Informer 机制
    《k8s-1.13版本源码分析》-调度器初始化
    《k8s-1.13版本源码分析》-源码调试
    《k8s-1.13版本源码分析》-调度优选
    《k8s-1.13版本源码分析》-调度预选
    《k8s-1.13版本源码分析》-调度器框架
  • 原文地址:https://www.cnblogs.com/SimonGao/p/4987668.html
Copyright © 2020-2023  润新知