使用Artifactory6.x ?
JFrog Artifactory 6.x User Guide
Have a question? Want to report an issue?Contact JFrog support![]()
Overview
Artifactory supportsCocoaPodsrepositories on top its现有的支持for advanced artifact management.
Artifactory support for CocoaPods provides:
- The ability to provision CocoaPods packages from Artifactory to the pod command line tool from local and remote repositories.
- Calculation of Metadata for pods hosted in Artifactory's local repositories.
- Access to remote CocoaPods Specs repositories (such as
https://github.com/CocoaPods/Specs) throughRemote Repositorieswhich provide the usual proxy and caching functionality. - The ability to assign access privileges according to projects or development teams.
配置
局部存储库
To enable calculation of CocoaPods package metadata setCocoaPodsto be thePackage Typewhen you create your local CocoaPods repository.
Deploying Pods
The CocoaPods client does not provide a way to deploy packages and mostly (though not only) relies on a Git repository to host the pod's code.
To deploy a pod into Artifactory, you need to use Artifactory'sREST APIor theWeb UI.
A pod is a simpletar.gzfile which contains your project code as well as a.podspec or .podspec.jsonfile describing the package metadata.
Pod filetypes
Although more extensions are supported by the client, the Artifactory CocoaPods local repositories currently only support pods that are archived as tar.gz
Remote Repositories
The publicCocoaPods Specs repodoes not contain any actual binary packages; it is a git repository containingpodspec.jsonfiles pointing from a package name and version to its storage endpoint.
Since the majority of the packages are hosted on GitHub, you need to create aRemote Repositorywhich serves as a caching proxy forgithub.com. If necessary, you can do the same forbitbucket.orgor any otherremote repository you want to access.
Working with Stash with a version lower than 5.1?
If your packages are hosted on Bitbucket (formerly Stash), you need to ensure that the Stash Archive Plugin is installed on your Bitbucket server.
Artifacts (such as tar.gz files) requested from a remote repository are cached on demand. You can remove downloaded artifacts from the remote repository cache, however you can not manually deploy artifacts to a remote repository.
To define a remote repository to proxy github.com as well as the public Specs repo follow the steps below:
- Create a new remote repository and setCocoaPodsto be itsPackage Type
- Set theRepository Keyvalue, and enter
https://github.comin theURLfield as displayed below - In theCocoaPods Settingssection, selectGitHubas theGit Provider, and leave the leave the defaultRegistry URL(https://github.com/CocoaPods/Specs).
Finally, click "Save & Finish"
Specs Repo URL
Usually, you will point theSpecs Repo URLfield at the public Specs repo as displayed above.
However, if you are using a private Specs repo - set the URL to be the same as the the one configured in theURLfield.
If the remote URL is an Artifactory instance you need to append it's url with/api/pods/
Private Bitbucket server
Working with a private Bitbucket server? set the "Git Provider" to be Stash, andnotBitbucket. The public Bitbucket endpoint answers some API calls that a private Bitbucket server doesn't, hence, it is important to set the Git Provider to be Stash when working with a private Bitbucket server. In this case, the URL field should be the root of your Bitbucket server, and the Specs Repo URL should be the full URL to the Specs repo in Bitbucket.
Using the Pod Command Line
CocoaPods repositories must be prefixed with api/pods in the path
When accessing a CocoaPods repository through Artifactory, the repository URL must be prefixed withapi/podsin the path. This applies to thepod repo-art addcommand.
For example, if you are using Artifactory standalone or as a local service, you would access your CocoaPods repositories using the following URL:
http://localhost:8081/artifactory/api/pods/
Or, if you are using Artifactory SaaS, the URL would be:
https://
Artifactory has been updated to work seamlessly with the latest version of the CocoaPods client from version 0.39.0
Using cocoapods-art
In order to use CocoaPods with Artifactory, you need the cocoapods-art plugin which presents Artifactory repositories as Specs repos and pod sources.
You can download thecocoapods-artplugin as a Gem, and its sources can be found onGitHub.
To use Artifactory with CocoaPods, execute the following steps:
Install the cocoapods-art plugin:
gem install cocoapods-art
Using Hombrew?
We recommend installing both the CocoaPods client and the cocoapod-art plugin as gems. Installing with Homebrew may cause issues with the CocoaPods hooks mechanism that the plugin relies on.
The next step is to add an Artifactory repository by using thepod 'repo-art add'command:
pod repo-art add
http://localhost:8081/artifactory/api/pods/ Once the repository is added, add the following in yourPodfile:
Adding an Artifactory source in the Podfileplugin 'cocoapods-art', :sources => [ '
' ]
Working without the Master repository?
Where the local repo name is the name you gave the specs repo locally when adding it.
pod repo-art commands
Thecocoapods-artplugin exposes most commands that are normally invoked withpod repo(i.e. add, update, list etc.).Usepod repo-artinstead ofpod repowhenever dealing with Artifactory-backed Specs repositories.
CocoaPods local Specs repos location
~/.cocoapods/repos
Once the pod command line tool is configured, everypod installcommand will fetch pods from the CocoaPods repository specified above.
Synchronizing thecocoapods-artPlugin's repositories with Artifactory
As opposed to the cocoapods client's default behavior, the cocoapods-art plugin does not automatically update its index whenever you run client commands (such as install). To keep your plugin's index synchronized with your CocoaPods repository, you need to update it by executing the following command:
pod repo-art update
Working with Artifactory without Anonymous Access
By default, Artifactory allows anonymous access to CocoaPods repositories. This is defined underSecurity | General Configuration. For details please refer toAllow Anonymous Access.
If you want to be able to trace how users interact with your repositories you need to uncheck theAllow Anonymous Accesssetting. This means that users will be required to enter their username and password.
Unfortunately, the pod command line tool does not support authentication against http endpoints. Thecocoapods-artplugin solves this by forcing curl (which pod uses for all http requests) to use the.netrcfile:
machine art-prod.company.com login admin password password
Since Artifactory also supports basic authentication using yourAPI key, you could use that instead of your password:
machine art-prod.company.com login admin password AKCp2TfQM58F8FTkXo8qSJ8NymwJivmagefBqoJeEBQLSHCZusEH6Z2dmhS1siSxZTHoPPyUW
Use an encrypted password
We recommend using an encrypted password instead of clear-text. For details, please refer toCentrally Secure Passwords.
Cleaning Up the Local Pod Cache
The pod client saves caches of pods that were downloaded, as well as metadata.
We recommend removing the CocoaPods caches (both packages and metadata responses) before using Artifactory for the first time. This is to ensure that your caches only contain elements that are due to requests from Artifactory and not directly from other Specs repos.
To clear the pod cache use:
pod cache clean
Watch the Screencast
看这个简短的视频学习我多么容易s to host RPMs in Artifactory.

