Add Cocoapods support and githubcocoapods support to the Code on Github.

Source: Internet
Author: User

Add Cocoapods support and githubcocoapods support to the Code on Github.

 

Reprinted, please specify the original link: Success. See the cocoapods official website's support for adding, but the introduction of (ying) than (yu) than (tai) Simple (cha), and some steps are not written, as a result, it was not successful to look at the official documentation. Later I checked the short book, CocoaChina, and so on, and it was close to a crash. There is no complete introduction. Simply compare and test multiple documents, and finally let your Github library successfully support Cocoapods installation. 2. At the beginning, I will introduce it from the very beginning, including creating a project on Github and uploading the project to the final support for Cocoapods. The procedure is as follows:
  • Code upload Github
  • Create a podspec file and verify whether the file passes
  • Create a release version on Github
  • Register a CocoaPods account
  • Upload code to CocoaPods
  • Check whether the upload is successful
1. Upload the code to Github. First open github.com and then create your own project:

 

Pay attention to the MIT License, which will be used later when Cocoapods support is added (will be introduced later ). Click create. Then, use SouceTree to run the code down to the local device and put your project in the folder:

 

The LICENSE here is the file added by the MIT License just mentioned. RSADemo is a sample project, and ZGRSAEncryptor is a library provided to others for use. (ZGEncrptor (For java).zip is the back-end code) and then submit it to Github. 2. Create a podspec file. Use the terminal to go to the project directory:

 

Then run the following command:
pod spec create ZGRSAEncryptor
The ZGRSAEncryptor here is the name of the market added to the pod (for example, MBProgressHUD ). Result After execution:

 

In this case, a ZGRSAEncryptor. podspec file is added to the project folder. Here I open it with Sublime Text and edit it as follows:
Pod::Spec.new do |s|  s.name         = "ZGRSAEncryptor"  s.version      = "1.0.0"  s.summary      = "A Library for iOS to use for RSA encryptor."  s.homepage     = "https://github.com/ScottZg/ZGRSAEncryptor"  s.license      = "MIT"  s.author             = { "scottzg" => "scottzg@126.com" }  s.source       = { :git => "https://github.com/ScottZg/ZGRSAEncryptor.git", :tag => "#{s.version}" }  s.source_files  = "ZGRSAEncryptor/*.{h,m}"end
Name: the name of the class library. Here the field is described as follows: version: the Library version summary is the introduction language, that is:

 

Homtepage: Github Project address license: license author: author source: Project's https link address source_files: code to be shared. Here is all the code under ZGRSAEncryptor. Next, run the following command for verification:
pod lib lint ZGRSAEncryptor.podspec
The results are diverse. If there are any errors, follow the prompts to correct them. Here, the result of my execution is as follows:

 

Multiple Warnings are detected, as long as they are not errors. The warning can be ignored directly (Red also shows how to ignore ):
pod lib lint ZGRSAEncryptor.podspec —allow-warnings
The result is as follows: After ZGRSAEncryptor passed validation is displayed, the verification is successful. 3. Create a release version on Github. Open the project directory and create a class library of the release version:

 

Click the arrow to start creating the release version (Click Create a new release ):

 

Click Publish release. After the creation is complete: Step 3 completes Step 4 register the CocoaPods account and execute the command line:
Pod trunk register email address 'user name'-description = 'descriptive information'
The result is as follows:

 

The yellow prompt indicates that a verification code has been sent to the mailbox. You can open your mailbox for verification. The link in the email is as follows:

 

In this way, the Cocoapods account is successfully registered. Available
pod trunk me

Check whether the creation is successful. The successful result is as follows:

5. upload code to CocoaPods

First, check the validity of the file format:
pod spec lint
The result is as follows:

 

There is no error, but there is a warning. You can ignore it using-allow-warnings:

 

The passed validation is successful. Then execute:
pod trunk push ZGRSAEncryptor.podspec —allow-warnings
The execution result is as follows: (the speed should be slow)

 

Indicates that the upload is successful. 6. Check whether the upload is successful.
pod search ZGRSAEncryptor
The result is as follows: OK. In this way, other people can search and use it. 3. Summarize Baidu and Google's documents and summarize them to build your own Cocoapods database. In the future, I will continue to learn how to build locally and how to develop private libraries when many people in the company develop. Iv. References: 1. Documents/

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.