上一篇:IOS持续集成-之-地址集合
根据上篇博客的一些文章,这篇文章的主要目的是搞通‘IOS持续集成’,完成后也可以用来指导他人完成‘持续集成’。
持续集成是个“一次配置长期受益”的工作。
一、安装Homebrew,用Homebrew安装Jenkins
(linux系统有个让人蛋疼的通病,软件包依赖,好在当前主流的两大发行版本都自带了解决方案,Red hat有yum,Ubuntu有apt-get,而Mac OX只有第三方支持:Homebrew,Homebrew简称brew,是Mac OSX上的软件包管理工具,能在Mac中方便的安装软件或者卸载软件,可以说Homebrew就是mac下的apt-get、yum神器)
1.0 第一步是安装Homebrew,拷贝下面的命令到终端(命令的功能是下载并安装):
1.1 第二步使用Homebrew来安装Jenkins,运行下面的命令:
brew install jenkins
1.2 第三步启动Jenkins,运行下面的命令:
java -jar jenkins.war
下面是运行成功后的输出,截取了最后几行
三月 28, 2016 4:11:00 下午 hudson.model.UpdateSite updateData
信息: Obtained the latest update center data file for UpdateSource default
三月 28, 2016 4:11:02 下午 hudson.model.DownloadService$Downloadable load
信息: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
三月 28, 2016 4:11:05 下午 hudson.model.DownloadService$Downloadable load
信息: Obtained the updated data file for hudson.tasks.Ant.AntInstaller
三月 28, 2016 4:11:19 下午 hudson.model.DownloadService$Downloadable load
信息: Obtained the updated data file for hudson.tools.JDKInstaller
此时,在浏览器里输入网址: ‘http://localhost:8080’, 即可进入Jenkins界面。
二、使用Homebrew安装ruby-install 和 chruby,ruby-install 只负责下载、编译和安装多个 Ruby 版本,chruby 负责切换不同版本的Ruby。
(为什么不用 RVM 或者 rbenv:因为chruby更简单灵活地管理 Ruby 版本)
2.0 使用Homebrew安装ruby-install,运行下面的命令
brew install ruby-install
下面是终端运行后的输出
==> Downloading https://homebrew.bintray.com/bottles/ruby-install-0.6.0.el_capit
######################################################################## 100.0%
==> Pouring ruby-install-0.6.0.el_capitan.bottle.tar.gz
�� /usr/local/Cellar/ruby-install/0.6.0: 26 files, 63.3K
2.1 用Homebrew安装chruby,安装前先判断是否已经装了ruby(因为极有可能已经装了,并且可以装多个版本),执行ruby -v命令查看版本,如果没有版本信息
则代表未安装。如果未安装,运行命令
brew install chruby
下面是终端运行后的输出
username:~ username $ brew install chruby
==> Downloading https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz
==> Downloading from https://codeload.github.com/postmodern/chruby/tar.gz/v0.3.9
######################################################################## 100.0%
==> make install PREFIX=/usr/local/Cellar/chruby/0.3.9
==> Caveats
Add the following to the ~/.bashrc or ~/.zshrc file:
source /usr/local/opt/chruby/share/chruby/chruby.sh
By default chruby will search for Rubies installed into /opt/rubies/ or
~/.rubies/. For non-standard installation locations, simply set the RUBIES
variable after loading chruby.sh:
RUBIES+=(
/opt/jruby-1.7.0
$HOME/src/rubinius
)
If you are migrating from another Ruby manager, set `RUBIES` accordingly:
RVM: RUBIES+=(~/.rvm/rubies/*)
rbenv: RUBIES+=(~/.rbenv/versions/*)
rbfu: RUBIES+=(~/.rbfu/rubies/*)
To enable auto-switching of Rubies specified by .ruby-version files,
add the following to ~/.bashrc or ~/.zshrc:
source /usr/local/opt/chruby/share/chruby/auto.sh
==> Summary
�� /usr/local/Cellar/chruby/0.3.9: 11 files, 48.8K, built in 12 seconds
.....未完待续
2.2 使用ruby-install 安装ruby
ruby-install ruby
安装过程有3~5分钟,安装成功后,截取尾部日志:
installing rdoc: /Users/name/.rubies/ruby-2.3.0/share/ri/2.3.0/system
installing capi-docs: /Users/name/.rubies/ruby-2.3.0/share/doc/ruby
>>> Successfully installed ruby 2.3.0 into /Users/name/.rubies/ruby-2.3.0
项目名称:Git
源码管理->repository URL:https://github.com/name/HelloWorld.git
Build periodically :
每隔5分钟: H/5 * * * *
每月1号、15号: H H 1,15 1-11 *
构建 :Xcode
General build setting
Target: HelloWorld
Clean before build? yes
Configuration : Release
√ Pack application and build .ipa? 在选框上打钩:√
.ipa filename pattern : HelloWorld
Output directory : ${WORKSPACE}/build/
Code signing & OS X keychain options
√ Unlock Keychain? 在选框上打钩:√
Keychain path : ${HOME}/Library/Keychains/login.keychain
Keychain password : 任意
Advanced Xcode build options
Xcode Schema File : HelloWorld
Xcode Workspace File : HelloWorld
Build output directory : ${WORKSPACE}/build/
构建后的步奏,添加:Execute a set of scripts
Build steps 在:Add build step 中,选择:Execute shell
Command :
fir p ${WORKSPACE}/build/HelloWorld.ipa -T 'firapiToken'