pod Spec 为自己的项目添加pod管理功能.
前言:
上一篇文章中提到,因为自己在操作的时候遇到很多坑,所在在此做一个记录,同样也希望可以帮到在这个操作上遇到坑的人。
本文将采用配图和加文字的方式,以最直观的方式呈现操作细节。如果文中有错误的地方,请大家指出以便即时做出调整。
一、首先在自己的github中添加新的管理目录
1.进入github账号管理中心,创建管理目录。
以上过程请参考下图:





2.上述创建目录完成,接下来做上传代码至github仓库。在此将按照空仓库的方式,在终端进行上传。操作的命令请参数github官网信息



> ``echo "# XLJSegScrollView" >> README.md``
> ``git init``
> ``git add README.md``
> ``git commit -m "first commit"``
> ``git remote add origin https://github.com/marlonxlj/XLJSegScrollView.git``
> ``git push -u origin master``

请参考下图:
打开终端切换到本地工程的目录下面;

二、创建pod Spec文件
根据上面的步骤操作完成,github仓库中有了你上传的代码。接下来要做的就是创建pod spec 文件,同样终端操作。pod 里面有一些命令,不在此做介绍,具体的使用方法:pod --help查看所有的命令。
>`` pod spec create XLJSegScrollView ``
>``其中XLJSegScrollView.podspec 这个命令可以自行定义``

三、配置spec文件
创建完成生会生成``XLJSegScrollView.podspec``这个文件。
可以使用vim 方式打开,或使用工具打开这个文件进行配置。

#
# Be sure to run `pod spec lint XLJSegScrollView.podspec' to ensure this is a
# valid spec and to remove all comments including this before submitting the spec.
#
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/
#

Pod::Spec.new do |s|

# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# These will help people to find your library, and whilst it
# can feel like a chore to fill in it's definitely to your advantage. The
# summary should be tweet-length, and the description more in depth.
#

# ---- Spec 元数据-----------
s.name = "XLJSegScrollView" #这里的名字会跟pod search 中的名字一样,和AFNetworking的名字一样
s.version = "0.0.1" #版本号一定要和push tag的版本号一至
s.summary = "快速实现标题和下划线一起滚动的功能" #这里的描述不要和description描述相同,否则发报警告

# 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 = "标题内容滚动的封装,可快速实现功能模块。" #描述信息

# 主页地址
s.homepage = "https://github.com/marlonxlj/XLJSegScrollView" #github仓库的目录
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif"


# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Licensing your code is important. See http://choosealicense.com for more info.
# CocoaPods will detect a license file if there is a named LICENSE*
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'.
#

# s.license = "MIT (example)"
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
# -- Spec 授权协议----
s.license = { :type => "MIT", :file => "LICENSE" }


# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the authors of the library, with email addresses. Email addresses
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also
# accepts just a name if you'd rather not provide an email address.
#
# Specify a social_media_url where others can refer to, for example a twitter
# profile URL.
#

# 作者信息
s.author = { "marlonxlj" => "marlonxlj@163.com" }
# Or just: s.author = "marlonxlj"
# s.authors = { "marlonxlj" => "" }
# s.social_media_url = "http://twitter.com/marlonxlj"

# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If this Pod runs only on iOS or OS X, then specify the platform and
# the deployment target. You can optionally include the target after the platform.
#

# s.platform = :ios
# 平台信息
s.platform = :ios, "7.0"

# When using multiple platforms
# s.ios.deployment_target = "5.0"
# s.osx.deployment_target = "10.7"
# s.watchos.deployment_target = "2.0"
# s.tvos.deployment_target = "9.0"


# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Specify the location from where the source should be retrieved.
# Supports git, hg, bzr, svn and HTTP.
#
# -- 资源在github的位置 ---
s.source = { :git => "https://github.com/marlonxlj/XLJSegScrollView.git", :tag => s.version }


# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# CocoaPods is smart about how it includes source code. For source files
# giving a folder will include any swift, h, m, mm, c & cpp files.
# For header files it will include any header in the folder.
# Not including the public_header_files will make all headers public.
#
# --源代码位置---
s.source_files = "Classes", "XLJSegScrollView/Classes/XlJSegScrollviews/**/*.{h,m}"
# s.exclude_files = "Classes/Exclude"

# s.public_header_files = "Classes/**/*.h"


# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# A list of resources included with the Pod. These are copied into the
# target bundle with a build phase script. Anything else will be cleaned.
# You can preserve files from being cleaned, please don't preserve
# non-essential files like tests, examples and documentation.
#
# -- 资源,一般较少用---
# s.resource = "icon.png"
# s.resources = "Resources/*.png"

# s.preserve_paths = "FilesToSave", "MoreFilesToSave"


# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# Link your library with frameworks, or libraries. Libraries do not include
# the lib prefix of their name.
#

# ---项目链接---
# 一般是framework和library等
# s.framework = "SomeFramework"
# s.frameworks = "SomeFramework", "AnotherFramework"

# s.library = "iconv"
# s.libraries = "iconv", "xml2"


# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
# If your library depends on compiler flags you can set them in the xcconfig hash
# where they will only apply to your library. If you depend on other Podspecs
# you can include multiple dependencies to ensure it works.

# ----项目依赖设置----
# 是否为ARC
s.requires_arc = true

# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" }
# 项目依赖其它的第三方库
# s.dependency "JSONKit", "~> 1.4"

end

四、上传到pod服务器
上面的步骤做完了,在上传到pod服务之前需要对配置文件进行验证,也就是对本地的`XLJSegScrollView.podspec `进行正确性验证。如下图:

命令:`pod spec lint --verbose`

错误原因是没有在pod服务器中添加版本号信息.
很重要
给pod添加tag信息,及版本号信息:

`git tag 0.0.1`

`git push --tag`

五、验证pod功能添加是否成功
`pod search XLJSegScrollView`

`pod trunk push`

当出现下面这个错误的时候,心里就像出现了好多好多的马,因为在`pod spec lint`的时候都是成功。在google了很多后,得到一个信息那就是等,耐心的等,为此我重复的等了40分钟后成功上传。
`[!]There was an error pushing a new version to trunk: getaddrinfo: nodename nor servname provided, or not known
`

网络不好的情况下,请翻....,在不知重复了多少次后总算成功了。

Email:marlonxlj@163.com

pod Spec管理配置的更多相关文章

  1. Spring Cloud Config整合Spring Cloud Kubernetes,在k8s上管理配置

    1 前言 欢迎访问南瓜慢说 www.pkslow.com获取更多精彩文章! Kubernetes有专门的ConfigMap和Secret来管理配置,但它也有一些局限性,所以还是希望通过Spring C ...

  2. 用 ConfigMap 管理配置 - 每天5分钟玩转 Docker 容器技术(159)

    Secret 可以为 Pod 提供密码.Token.私钥等敏感数据:对于一些非敏感数据,比如应用的配置信息,则可以用 ConfigMap. ConfigMap 的创建和使用方式与 Secret 非常类 ...

  3. 用 ConfigMap 管理配置

    1. ConfigMap介绍管理配置 ConfigMap介绍 Secret 可以为 Pod 提供密码.Token.私钥等敏感数据:对于一些非敏感数据,比如应用的配置信息,则可以用 ConfigMap ...

  4. 用ConfigMap管理配置(10)

    一.ConfigMap介绍管理配置:   ConfigMap介绍 Secret 可以为 Pod 提供密码.Token.私钥等敏感数据:对于一些非敏感数据,比如应用的配置信息,则可以用 ConfigMa ...

  5. 用configmap管理配置

    一.ConfigMap介绍管理配置: ConfigMap介绍 Secret 可以为 Pod 提供密码.Token.私钥等敏感数据:对于一些非敏感数据,比如应用的配置信息,则可以用 ConfigMap ...

  6. 第10篇用 ConfigMap 管理配置

        一.ConfigMap介绍管理配置: ConfigMap介绍 Secret 可以为 Pod 提供密码.Token.私钥等敏感数据:对于一些非敏感数据,比如应用的配置信息,则可以用 Config ...

  7. 用 ConfigMap 管理配置【转】

    Secret 可以为 Pod 提供密码.Token.私钥等敏感数据:对于一些非敏感数据,比如应用的配置信息,则可以用 ConfigMap. ConfigMap 的创建和使用方式与 Secret 非常类 ...

  8. k8s用 ConfigMap 管理配置(13)

    一.ConfigMap介绍 Secret 可以为 Pod 提供密码.Token.私钥等敏感数据:对于一些非敏感数据,比如应用的配置信息,则可以用 ConfigMap ConfigMap 的创建和使用方 ...

  9. spring,mybatis事务管理配置与@Transactional注解使用[转]

    spring,mybatis事务管理配置与@Transactional注解使用[转] spring,mybatis事务管理配置与@Transactional注解使用 概述事务管理对于企业应用来说是至关 ...

随机推荐

  1. 死磕内存篇 --- JAVA进程和linux内存间的大小关系

    运行个JAVA 用sleep去hold住 package org.hjb.test; public class TestOnly { public static void main(String[] ...

  2. 匹夫细说C#:庖丁解牛迭代器,那些藏在幕后的秘密

    0x00 前言 在匹夫的上一篇文章<匹夫细说C#:不是“栈类型”的值类型,从生命周期聊存储位置>的最后,匹夫以总结和后记的方式涉及到一部分迭代器的知识.但是觉得还是不够过瘾,很多需要说清楚 ...

  3. LeetCode-5LongestPalindromicSubstring(C#)

    # 题目 5. Longest Palindromic Substring Given a string S, find the longest palindromic substring in S. ...

  4. iPhone Anywehre虚拟定位提示“后台服务未启动,请重新安装应用后使用”的解决方法

    问题描述: iPhone越狱了,之后在Cydia中安装Anywhere虚拟定位,但是打开app提示:后台服务未启动,请重新安装应用后使用. 程序无法正常使用... 解决方法: 打开Cydia-已安装, ...

  5. django server之间通过remote user 相互调用

    首先,场景是这样的:存在两个django web应用,并且两个应用存在一定的联系.某些情况下彼此需要获取对方的数据. 但是我们的应用肯经都会有对应的鉴权机制.不会让人家随随便便就访问的对吧.好比上车要 ...

  6. JavaScript之职责链模式

    一.概述 职责链模式(Chain of responsibility),就是使多个对象都有机会处理请求,从而避免请求的发送者和接受者之间的耦合关系.将这个对象连成一条链,并沿着这条链传递该请求,直到有 ...

  7. C#中如何给Excel添加水印

    我们知道Microsoft Excel并没有内置的功能直接给Excel表添加水印,但是其实我们可以用其他变通的方式来解决此问题,如通过添加页眉图片或艺术字的方法来模仿水印的外观.所以在这篇文章中,我将 ...

  8. 当web.config文件放置在共享目录下(UNC),启动IIS会提示有错误信息500.19,伴随有错误代码0x80070003和错误代码0x80070005的解决办法

    最近遇到一个很有意思的使用环境,操作人员将所有的网站应用内容投放到共享存储里面,并且使用微软的SMB协议将其以CIFS的方式共享出来,使用Windows Server 2008 R2的IIS将其连接起 ...

  9. Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part2:clusterware安装和升级

    Linux平台 Oracle 10gR2(10.2.0.5)RAC安装 Part2:clusterware安装和升级 环境:OEL 5.7 + Oracle 10.2.0.5 RAC 3.安装Clus ...

  10. javascript 笔记!

    1.通过javascript向文档中输出文本 document是javascript的内置对象,代表浏览器的文档部分 document.write("Hello Javascript&quo ...