CocoaPods Repositories

CocoaPods Repositories

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

Support Information

    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](https://help.sonatype.com/en/configuring-ssl.html#inbound-ssl---configuring-to-serve-content-via-https "Inbound SSL - Configuring to Serve Content via HTTPS") for more about setting up SSL in Nexus Repository.
- **Authentication to remote resources:** authentication to remote CDN spec repositories and pod repositories is not supported.

## Proxying CocoaPods Repositories

CocoaPods proxy repositories cache metadata `.podspec.json` files from CDN mirrors of specs repositories. Links to such mirrors are configured in the _Remote storage_ field. After fetching of Spec file, Nexus Repository 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)_.

Use the following configuration steps:

- Define the proxy name.
cocoapods-proxy
```
    https://cdn.cocoapods.org/
    ```

- Select 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 Nexus Repository 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:

    $cat ~/.curlrc
    --insecure
    ```

Set the `GIT_SSL_NO_VERIFY=true` environment variable when using untrusted certificates.

### Configure Nexus Repository Authentication

The CocoaPods client uses curl to download Pod files from the Nexus Repository. You must provide authentication in the request when anonymous access is not enabled.

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

Create the `.netrc` file in the following format when not present:
$cat ~/.netrc
machine localhost
login admin
password admin123
```

See the CocoaPods project for more information.