Skip to main content

CocoaPods Repositories

Introduction

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.

Warning

Because of a limitation in the spec for Cocoapods, NXRM does not currently check authentication for spec files. This means that an informed user could potentially list the contents of proxy repositories without authenticating. This will be resolved in a future release. For more information see https://github.com/CocoaPods/CocoaPods/issues/9151.

Support Information

  • CocoaPods client support: 1.7.2 and greater

  • Cocoapods client OS: MacOS

  • Spec repositories: CDN only. Content delivery network mirror of master Specs repository https://github.com/cocoapods/specs is https://cdn.cocoapods.org/. It is possible to work with custom Specs repositories only after CDN mirror creation.

  • Pods repositories: GoogleSource.com (Git at Google), Bitbucket, direct http(s) link to archive with source code

  • SSL: CocoaPods client can only work with CDN mirror by https protocol. Http protocol is not supported. See configuration details for more about setting up SSL in NXRM.

  • Authentication to remote resources: authentication to remote cdn spec repositories and pod repositories not supported.

  • Nexus Repository Manager single node deployment required: Format is not enabled in Repository Manager Pro HA-C deployments.

Proxying CocoaPods Repositories

CocoaPods proxy repositories cache metadata .podspec.json files from CDN mirrors of Specs repositories. Links to such mirrors should be configured in the Remote storage field. After fetching of Spec file, NXRM parses the source link from the metadata file. Such sources can be GitHub, BitBucket or direct https link. Pod library source code will be cached as an archive file such as tar.gz or zip. Https source will be downloaded directly while in the case of GitHub or BitBucket source, the Pod library will be downloaded by REST API call.

To proxy a CocoaPods repository, you simply create a new CocoaPods (proxy) as documented in Repository Management.

Minimal configuration steps are:

  • Define Name e.g. cocoapods-proxy

  • Define URL for Remote storage e.g. https://cdn.cocoapods.org/

  • Pick a Blob store for Storage

Configure CocoaPods Client

In Swift or Objective-C Cocoa project source folder, update Podfile and set the source as a link to NXRM CocoaPods repository. Example:

$cat Podfile
require 'cocoapods'
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://localhost:8443/repository/cocoapods-proxy/'
target 'CocoaPodsTest' do
use_frameworks!
  
pod 'Alamofire', '~>5.0.0-beta.5'
pod 'Igor'
pod 'SafetySDK'
pod 'DSTestDR'
end

Configure SSL

CocoaPods client can work with CDN mirror only by https protocol. One of two points below should be configured:

  • Configure NXRM to use trusted SSL certificate. Self signed ones will not work.

  • As the CocoaPods client uses the curl command to download Pod files from NXRM, setup curl to work with self signed certificates by adding the --insecure option into the .curlrc file at your home directory. If no such file exists, then just create it. Example:

$cat ~/.curlrc
--insecure

You may also need to setGIT_SSL_NO_VERIFY=true environment variable when using untrusted certificates.

Configure Nexus Repository Authentication

The CocoaPods client uses the curl command to download Pod files from Sonatype Nexus Repository. Therefore, if anonymous access is not enabled in Sonatype Nexus Repository, you need to configure authentication for curl.

Configure login and password in the .netrc file in the home folder of your workstation. Use the themache option to configure the hostname or IP address.

If no such file exists, you can create it. An example is displayed below:

$cat ~/.netrc
machine localhost
login admin
password admin123