CocoaPods Repositories

Introduction

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

This format is disabled by default in NXRM Pro HA-C environments.

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 futre 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: GitHub, 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.

Proxying CocoaPods Repositories

NXRM CocoaPods proxy repository caches metadata .podspec.json files from CDN mirror of Specs repository. Link 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

Configure NXRM Authentication

The CocoaPods client uses the curl command to download Pod files from NXRM. Therefore if anonymous access is not enabled on the NXRM side, then you need to configure authentication for curl. Configure loginandpassword in .netrc file in the home folder of your workstation and use themachine option to configure hostname or IP address. If you haven't such file then just create it. Example:

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