Private Pods

CocoaPods is a great tool not only for adding open source code to your project, but also for sharing components across projects. You can use a private Spec Repo to do this.

There are a few steps to getting a private pods setup for your project; creating a private repository for them, letting CocoaPods know where to find it and adding the podspecs to the repository.

<1. Create a Private Spec Repo

To work with your collection of private pods, we suggest creating your own Spec repo. This should be in a location that is accessible to all who will use the repo.

You do not need to fork the CocoaPods/Specs Master repo. Make sure that everyone on your team has access to this repo, but it does not need to be public.

<2. Add your Private Repo to your CocoaPods installation

$ pod repo add REPO_NAME SOURCE_URL

Note: If you plan on creating pods locally, you should have push access to SOURCE_URL

To check if your installation is successful and ready to go:

$ cd ~/.cocoapods/repos/REPO_NAME
$ pod repo lint .

<3. Add your Podspec to your repo

Make sure you've tagged and versioned your source appropriately, then run:

$ pod repo push REPO_NAME SPEC_NAME.podspec

This will run pod spec lint, and take care of all the little details for setting up the spec in your private repo.

The structure of your repo should mirror this:

.
├── Specs
└── [SPEC_NAME]
└── [VERSION]
└── [SPEC_NAME].podspec

<That's it!

Your private Pod is ready to be used in a Podfile. You can use the spec repository with the source directive in your Podfile as shown in the following example:

source 'URL_TO_REPOSITORY'

<An Example

<1. Create a Private Spec Repo

Create a repo on your server. This can be achieved on Github or on your own server as follows

$ cd /opt/git
$ mkdir Specs.git
$ cd Specs.git
$ git init --bare

(The rest of this example uses the repo at https://github.com/artsy/Specs)

<2. Add your repo to your CocoaPods installation

Using the URL of your repo on your server, add your repo using

$ pod repo add artsy-specs git@github:artsy/Specs.git

Check your installation is successful and ready to go:

$ cd ~/.cocoapods/repos/artsy-specs
$ pod repo lint .

<3. Add your Podspec to your repo

Create your Podspec

cd ~/Desktop
touch Artsy+OSSUIFonts.podspec

Artsy+OSSUIFonts.podspec should be opened in the text editor of your choice. Typical contents are

Pod::Spec.new do |s|
s.name = "Artsy+OSSUIFonts"
s.version = "1.1.1"
s.summary = "The open source fonts for Artsy apps + UIFont categories."
s.homepage = "https://github.com/artsy/Artsy-OSSUIFonts"
s.license = 'Code is MIT, then custom font licenses.'
s.author = { "Orta" => "orta.therox@gmail.com" }
s.source = { :git => "https://github.com/artsy/Artsy-OSSUIFonts.git", :tag => s.version }
s.social_media_url = 'https://twitter.com/artsy' s.platform = :ios, '7.0'
s.requires_arc = true s.source_files = 'Pod/Classes'
s.resources = 'Pod/Assets/*' s.frameworks = 'UIKit', 'CoreText'
s.module_name = 'Artsy_UIFonts'
end

Save your Podspec and add to the repo

pod repo push artsy-specs ~/Desktop/Artsy+OSSUIFonts.podspec

Assuming your Podspec validates, it will be added to the repo. The repo will now look like this

.
├── Specs
└── Artsy+OSSUIFonts
└── 1.1.1
└── Artsy+OSSUIFonts.podspec

See this Podfile for an example of how the repo URL is included

<How to remove a Private Repo

pod repo remove [name]

<<External resources

FROME: https://guides.cocoapods.org/making/private-cocoapods.html

CocoaPods ADD private Spec Repo的更多相关文章

  1. 利用cocoapods创建基于git的私有库Spec Repo

    上一篇文章记录了我利用cocoapods创建基于SVN的私有库的全部过程,今天我再记录一下基于git创建的过程. 整体先说明一下创建一个私有的podspec包括如下那么几个步骤: 创建并设置一个私有的 ...

  2. cocoapods安装好后repo换源

    1.pod repo 然后会出现以下内容,如下是我已经换了之后的,而你的URL还是github的 master - Type: git (master) - URL:  https://git.cod ...

  3. CocoaPods不更新spec仓库进行install/update

    最近使用CocoaPods来添加第三方类库,无论是执行pod install还是pod update都卡在了Analyzing dependencies不动 原因在于当执行以上两个命令的时候会升级Co ...

  4. 使用CocoaPods出现 The `master` repo requires CocoaPods 0.32.1 - 问题解决

    近期在使用CocoaPods为project配置第三方类库时出现了例如以下问题: [!] The `master` repo requires CocoaPods 0.32.1 - 明显是由于Coco ...

  5. To add private variable to this Javascript literal object

    You can use number as function/variable name, the numberic name can't be accessed from parent scope, ...

  6. 【原+转】创建CocoaPods私有podspec

    在我的上一篇文章<iOS 手把手教你发布代码到CocoaPods>中着重介绍如何将自己的代码索引添加到公开的CocoaPods中,当你需要主动地向大众开源你的代码时需要那么做.但在现实中我 ...

  7. 使用私有Pod Spec的类库--提高公司开发效率

    前言 找了这么长时间,再次开始去尝试Cocoapods了.前面已经写过一篇关于如何把自己的Github上的代码库添加Cocoapods支持.现在就让我们看一下如果搭建私有的Spec吧. 之所以构建私有 ...

  8. 基于 svn 服务器及 cocoapods-repo-svn 插件进行组件化私有库的创建

    一.准备 组件化 随着业务需求的增长,在单工程 MVC 模式下,app 代码逐渐变得庞大,面对的高耦合的代码和复杂的功能模块,我们或许就需要进行重构了,以组件化的形式,将需要的组件以 pod 私有库的 ...

  9. cocoapods 无法 升级 repo 无法执行pod install命令

    首先MAC自带了ruby,他是用rvm 管理的, 如果你用homebrew又安装了一个新版,很可能在升级cocoapods时遇到问题,明明自己用homebrew升级到最新版本了,页配置环境变量了,为什 ...

随机推荐

  1. PHP开发APP接口(二)

    这里将会调用前面博客的数据库连接单例.文件缓存类和开发APP接口(一) <?php // http://app.com/list.php?page-=1&pagesize=12 requ ...

  2. linux使用FIO测试磁盘的iops 【转载】

     linux使用FIO测试磁盘的iops 2013-09-23 10:59:21 分类: LINUX FIO是测试IOPS的非常好的工具,用来对硬件进行压力测试和验证,支持13种不同的I/O引擎,包括 ...

  3. SpringMVC项目接入Springfox实战遇到的问题集合

    为了方便的管理项目中API接口,目前总是会写好接口后,然后又要去维护一个文档,这对于开发者来说太心累了, 在网上找了好多关于API接口管理和生成文档的资料,一次偶然跟51的大神交流发现了Swagger ...

  4. BA Practice Lead Handbook 1 - Why Is Business Analysis Taking The World By Storm?

    The articles in this series are focused on individual Business Analysts and their managers. https:// ...

  5. Android中利用OpenMax 编程的基本流程

    近期因为公司在做数字电视,播放器和模块由供应商打包一起卖,驱动调通了,但是播放器要硬件解码,和平台差异,原厂又没有相关文档,就自己试着看了一个系统的播放器流程,顺便整理了一下,也方便以后查询,希望对播 ...

  6. Java中List和ArrayList的区别(转)

    List是一个接口,而ListArray是一个类.  ListArray继承并实现了List.  所以List不能被构造,但可以向上面那样为List创建一个引用,而ListArray就可以被构造.  ...

  7. 基于AFNetworking3.0网络封装

    概述 对于开发人员来说,学习网络层知识是必备的,任何一款App的开发,都需要到网络请求接口.很多朋友都还在使用原生的NSURLConnection一行一行地写,代码到处是,这样维护起来更困难了. 对于 ...

  8. 插入ts以及判断列是否存在(支持多数据库)

    1:增加ts.dr字段,先判断ts.dr字段是否存在,其中ts字段插入的是日期,默认值为当前插入的时间,dr字段是数值型,默认值为0 * 增加ts/dr字段 * * @param tableList ...

  9. JavaScript 开发规范要求详解

    作为一名开发人员(We前端JavaScript开发),不规范的开发不仅使日后代码维护变的困难,同时也不利于团队的合作,通常还会带来代码安全以及执行效率上的问题.本人在开发工作中就曾与不按规范来开发的同 ...

  10. Google Map API v2 (四)----- 导航路径

    仍然是建议个异步小任务 private GetPathTask mGetPathTask = null; private void getGuidePath(LatLng origin){ if(mG ...