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

  1. $ 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:

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

<3. Add your Podspec to your repo

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

  1. $ 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:

  1. .
  2. ├── Specs
  3. └── [SPEC_NAME]
  4. └── [VERSION]
  5. └── [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:

  1. 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

  1. $ cd /opt/git
  2. $ mkdir Specs.git
  3. $ cd Specs.git
  4. $ 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

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

Check your installation is successful and ready to go:

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

<3. Add your Podspec to your repo

Create your Podspec

  1. cd ~/Desktop
  2. touch Artsy+OSSUIFonts.podspec

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

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

Save your Podspec and add to the repo

  1. 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

  1. .
  2. ├── Specs
  3. └── Artsy+OSSUIFonts
  4. └── 1.1.1
  5. └── 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. BOM、DOM学习笔记——JavaScript

    1.BOM的概述    browser object modal :浏览器对象模型.    浏览器对象:window对象.    Window 对象会在 <body> 或 <fram ...

  2. SpringNote02.Blog系统迁移到Linux下

    基于SpringMVC-Hibernate的博客系统还在继续开发中 . 项目地址:https://github.com/defshine/SpringBlog 整个项目迁移到linux下开发,安装in ...

  3. shell 脚本执行日志通用模块

    目标 实现记录SHELL执行的開始时间,结束时间.执行状态,错误信息等,以函数封装日志记录的方式,脚本调用函数 源代码 通用函数脚本program_log_new.sh function init_l ...

  4. oracle3

    查看表结构 DESC emp; 查询所有列 SELECT * FROM dept; 切忌动不动就用select * set timing on; 打开显示操作时间的开关,在下面显示查询时间. CREA ...

  5. WIN32 根据程序名(映像名称)终止外部程序

    场景: 1.有时候需要调用外部程序,但是外部程序有可能崩溃挂起,这样这个进程就没法结束,所以再在下次调用前需要先结束之前调用的. 2.没考虑到权限问题,应该是只能终止当前用户启动的进程. #inclu ...

  6. Java 反射学习笔记

    要学反射,先要了解Class这个类,Class是所有Java类的一个总称,Class的实例中存储的是一个类的字节码,获取Class的实例有三种方式: System.class new Date().g ...

  7. AS3性能及Flex-Formatting设置问题

    1.支持Vector 2.for each in更是从Flash Player 9 3.Flash原生的bitmap.encode 4.如打开位图缓存:使用bitmapData.lock:把bitma ...

  8. Ubuntu16.04下Intellij IDEA不能输入中文的问题

    最近Ubuntu升级到16.04后发现IDEA的中文输入法不能正常切换了. 之前用的是fcitx安装的输入法, 折腾了半天才解决. 只需要修改idea.sh文件即可. 不需要折腾fcitx中的配置. ...

  9. Mybaitis配置总结

    在mybatis-config.xml中配置分页插件,插件配置必须放在mapper前面 <plugins> <plugin interceptor="com.rrtong. ...

  10. SET NOCOUNT 的意义.

    SET NOCOUNT 使返回的结果中不包含有关受 Transact-SQL 语句影响的行数的信息. 语法 SET NOCOUNT { ON | OFF } 当 SET NOCOUNT 为 ON 时, ...