---
title: "CruiseControl.rb配置"
author: "brian80s"
date: "2010-04-13T10:34:34Z"
tags: ["Ruby", "SVN", "subversion", "vim", "脚本"]
categories: ["编程语言"]
slug: "cruisecontrol-rb"
draft: false
lastmod: "2010-04-13T11:48:47Z"
id: 642511
url: "https://brian80s.iteye.com/blog/642511"
---

下载[CruiseControl.rb](http://rubyforge.org/frs/download.php/59598/cruisecontrol-1.4.0.tgz "cruisecontrol.rb")

 

解压

 

```
tar xzvf cruisecontrol-1.4.0.tgz
```

 

 

重命名

 

```
mv cruisecontrol-1.4.0 /var/www/ccrb
```

 

 

后台启动ccrb

 

```
/var/www/ccrb/cruise start -d
```

 

 

注意访问权限( chmod -R 777 /var/www/ccrb )

 

启动后，可以通过http://YourIP:3333访问ccrb

 

将ccrb设置成自启动

 

新建脚本 ccrb\_start.sh

 

在脚本中输入以下内容：

 

```
PATH=/usr/local/ruby/bin:/usr/java/jdk1.5.0_11/bin:$PATH
HOME=/root
export PATH HOME

rm -rf /var/www/ccrb/tmp/pids/mongrel.pid*

/var/www/ccrb/cruise start -d
```

 

 

 

在/etc/rc.local加入自启动

 

```
sh /root/ccrb_start.sh
```

 

 

新增ccrb工程

 

```
 ./cruise add test --url svn://yourIP/trunk --username xx --password xxx
```

 

 

修改项目配置文件

 

```
vim /root/.cruise/projects/eb/cruise_config.rb
```

 

```
Project.configure do |project|
  # Send email notifications about broken and fixed builds to email1@your.site, email2@your.site (default: send to nobody)
  # project.email_notifier.emails = ['email1@your.site', 'email2@your.site']

  # Set email 'from' field to john@doe.com:
  # project.email_notifier.from = 'john@doe.com'

  # Build the project by invoking rake task 'custom'
  # project.rake_task = 'custom'

  # Build the project by invoking shell script "build_my_app.sh". Keep in mind that when the script is invoked,
  # current working directory is <em>[cruise&nbsp;data]</em>/projects/your_project/work, so if you do not keep build_my_app.sh
  # in version control, it should be '../build_my_app.sh' instead
  project.build_command = './build_eb.sh'

  # Ping Subversion for new revisions every 5 minutes (default: 30 seconds)
   project.scheduler.polling_interval = 30.minutes

end

```