iOS Project automatically packs and publishes script implementations

Source: Internet
Author: User

http://blog.csdn.net/ccf0703/article/details/8588667

Article starting address: http://webfrogs.me/2013/02/18/ios-automation/

Webfrogs

Reprint please indicate the source.

Objective

In the development of iOS, it is very inefficient to use Xcode directly when you need to release a test package to testers. Especially when there's a small change that needs to be re-made, it's a job for a tortured person. After a study, the decision was made to write a series of scripts to replace the manual completion of the packaging and publishing process.

The script is now complete, basically to meet my current needs. Now open it up, hosted on GitHub, Project address: click here

Ideas

With command line Tools, which is included with Xcode, you can complete the compilation and packaging of your iOS project from the shell. This is exactly what the script is doing.

This set of scripts is divided into three parts: the script ipa-build responsible for compiling the project and packaging, the script ipa-publish responsible for generating the Itms-services protocol file, and the script upload that is responsible for uploading ipa-publish script generation files to the server.

Among them, because my own situation is the server side of the colleague gave me the internal test server SFTP upload permissions, so this upload script mainly implemented using SFTP to upload features. Concrete can be changed by actual situation.

For some of the contents of the Itms-services protocol, refer to my previous article: "Shell script implementation of the IPA one-click installation (Itms-services protocol)"

Note: The default installation of Xcode does not bring "Command line Tools", it needs to be downloaded in Xcode to use

Realize

After you open the project, you'll find that the script contains several shell files. Here's how it functions:

ipa-build:  编译xcode工程并生成ipa文件ipa-publish: 生成符合itms-services协议的文件,并发布到服务器。sendEmail:  stmp发送email的脚本。(别人写的)sftpDownloadFile: 通过sftp协议下载文件sftpUploadFile: 通过sftp协议上传文件updateLocalIndexHtml:   对索引文件进行处理(二进制文件,非shell脚本)uploadItemsServicesFiles:   将itms-services协议文件上传到服务器

The actual scripts used are only "ipa-build" and "ipa-publish" of these two. Other files will be ipa-publish by this script to invoke the dependent files. The "updatelocalindexhtml" is a compiled binary file that I wrote with OBJC for text processing, and the rest are shell scripts.

Shell scripting implementation, you can open the script to see, the inside of the comments is very detailed. Don't need too much explanation.

It is worth mentioning that when I write the SFTP protocol upload function, encountered a problem is to use the script to automatically enter the password, that is, the writing of interactive scripts. Finally chose expect to complete, because I found the Mac system with the expect command.

Use

As I was writing the script, I had to think about making this script as easy as possible to use. If you only need to package, then just use the Ipa-build script. If you need to publish with the Itms-services protocol, run the Ipa-publish script again. The upload script is called in the Ipa-publish script, so the upload script does not need to be used alone.

Ipa-build How to use the script:

ipa-build脚本绝对路径 参数1 参数2

Where parameter 1 is the root path of the iOS project and is a must-lose. Parameter 2 can not be entered, is optional, meaning is the compile-time project configuration type, there are 4 types of optional: Debug, adhoc,release, distribution. The default is release.

After the Ipa-build script runs, a folder named "Build" is generated under the iOS project root path, and in this folder there is a folder called "Ipa-build", in which the latest IPA package generated is packaged.

Ipa-publish How to use the script:

ipa-publish脚本绝对路径 参数1 参数2

Parameter 1 is the root path of the iOS project and is a must-lose item. Parameter 2 is optional, meaning whether to send an email notification when the file is successfully uploaded, y to send, n to not send, and the default value to not send.

After the Ipa-publish script runs, a folder with the project's targetname name is generated in the "Build" folder. Where all the files required for the Itms-services protocol are stored. The script will upload all of the contents to the server.

Precautions

1. Run script requires absolute path, cannot use relative path.

2, after the script download, to use, some scripts need some changes.

Where the Ipa-build script does not need to be changed. can be used directly. Ipa-publish scripts need to configure some information before they can be used normally.

After opening the Ipa-publish script with text, there is a place in the shell where it needs to be configured, as follows:

#须配置内容  start#sftp参数设置sftp_server=192.168.xx.xxsftp_username=xxsftp_password=xxsftp_workpath="/usr/share/xx/xx/xx"#发布应用的url地址pulish_url="http://xx.com/xx"#以下是邮箱的相关设置#收件人[email protected]#发送者邮箱[email protected]#邮箱用户名email_username=xx#邮箱密码email_password=xx#smtp服务器地址email_smtphost=smtp.exmail.qq.com#可配置内容  end

According to the actual situation configuration can.

Webfrogs

iOS Project automatically packs and publishes script implementations

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.