Uploading and Downloading a CocoaPods Package on the Client
CodeArts Artifact can connect to local CocoaPods clients. You may upload your private packages from your local CocoaPods client to self-hosted repos and share them with others, who can download these CocoaPods packages through their clients.
CocoaPods Pod
CocoaPods is a dependency manager for iOS and macOS projects. It helps developers easily integrate and manage required libraries efficiently.
Constraints
The repository password for a self-hosted repo is account-specific. If you are prompted for a password while using a different account, download the configuration file from the repository's Tutorial tab to obtain it.
Prerequisites
- You have installed the Ruby client and cocoapods-art plug-in.
- You have created a CocoaPods repository.
- You have the Download/View permission on the current repository. For details about how to obtain this permission, see Configuring Repository Permissions.
Uploading a CocoaPods Package from the Client
Uploading a CocoaPods package to self-hosted repos by provided configuration file
- Access self-hosted repos using your Huawei Cloud account.
- In the left pane, click the target CocoaPods repository.
- Click Tutorial on the right of the page.
- In the displayed dialog box, select Download the provided configuration file and click Download Configuration File to download the cocoapods.txt file.
- Obtain {username} and {password} from the downloaded file.
- Run the following command on your local client to upload the local CocoaPods package to the target self-hosted repo.
curl -k -u "<USERNAME>:<PASSWORD>" -XPUT "{url}/<TARGET_FILE_PATH>/" -T <PATH_TO_FILE>/<FILE_NAME>- USERNAME: {username} obtained in 5.
- PASSWORD: {password} obtained in 5.
- url: repository address of the CocoaPods repository.
- TARGET_FILE_PATH: name of the self-hosted repo folder to be stored.
- PATH_TO_FILE: local path of the package to be uploaded.
- FILE_NAME: name of the self-hosted repo to which the package is uploaded.
- Check the uploaded package in the CocoaPods repository.
Uploading a CocoaPods package to self-hosted repos by command-line configuration
- Access self-hosted repos using your Huawei Cloud account.
- In the left pane, click the target CocoaPods repository.
- Click Tutorial on the right of the page.
- In the displayed dialog box, select Follow the command line configuration.
- Check whether the Ruby client has been installed.
ruby -v
- Install the cocoapods-art plug-in.
sudo gem install cocoapods-art
- Add the self-hosted repo to your CocoaPods client.
pod repo-art add <repo_name> "{url}"- repo_name: name of the folder for storing packages of self-hosted repos on your local client.
- url: repository address of the CocoaPods repository.
- In the Select purpose area, click Publish.
- Upload the local package to the target CocoaPods repository.
curl -k -u "<USERNAME>:<PASSWORD>" -XPUT "{url}/<TARGET_FILE_PATH>/" -T <PATH_TO_FILE>/<FILE_NAME>- USERNAME: {username} obtained in 5.
- PASSWORD: {password} obtained in 5.
- url: repository address of the CocoaPods repository.
- TARGET_FILE_PATH: name of the self-hosted repo folder to be stored.
- PATH_TO_FILE: local path of the package to be uploaded.
- FILE_NAME: name of the self-hosted repo to which the package is uploaded.
- Check the uploaded package in the CocoaPods repository.
Downloading a CocoaPods Package to the Client
Downloading a CocoaPods package by provided configuration file
- Access self-hosted repos using your Huawei Cloud account.
- Select the target CocoaPods repository from the self-hosted repo page and click Tutorial on the right of the page.
- In the displayed dialog box, select Download the provided configuration file.
- In the Select purpose area, click Download.
- Run the following commands to download files to your local client.
- Download the package from the remote repository.
pod repo-art add {package_name} {url}package_name: name of the CocoaPods dependency to be downloaded.
url: repository address of the self-hosted repo.
Change the address of the CocoaPods repository.
pod repo-art update {package_name} {url}package_name: The CocoaPods dependency cannot be modified.
url: enter the repository address of the target self-hosted repo.
Query the downloaded dependency.
pod repo-art list
Remove the local dependency.
pod repo-art remove <repo-name>//repo_name: name of the CocoaPods dependency
Downloading a CocoaPods package by command-line configuration
- Access self-hosted repos using your Huawei Cloud account.
- Select the target CocoaPods repository from the self-hosted repo page and click Tutorial on the right of the page.
- In the displayed dialog box, select Follow the command line configuration.
- Check whether the Ruby client has been installed.
ruby -v
- Install the cocoapods-art plug-in.
sudo gem install cocoapods-art
- Add the self-hosted repo to your CocoaPods client.
pod repo-art add <repo_name> "{url}"- repo_name: name of the folder for storing packages of self-hosted repos on your local client.
- url: repository address of the CocoaPods repository.
- In the Select purpose area, click Download.
- Run the following commands to download files to your local client.
Download the package from the remote repository.
pod repo-art update {package_name}//package_name: package name.Query the downloaded package.
pod repo-art list
Remove the local dependency.
pod repo-art remove <repo-name>//repo-name: name of the CocoaPods dependency
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot