By default, CC.rb assumes that your project is a Rails application built by
Rake, and Rakefile is in the root directory of the project. Under these assumptions, just
running default Rake task is not good enough, because in a normal Rails application this task needs an
up-to-date development database to work. On a continuous build server there is usually no such thing.
Therefore, CC.rb uses the following logic to determine what to build:
1. First, CC.rb loads all *.rake files from [cruise]/tasks/, and then the Rakefile of your_project.
Then it invokes cc:build task (defined in [cruise]/tasks/cc_build.rake). This task looks at all other
Rake tasks (defined in your_project), and decides what to do.
2. If there is cruise target, it simply invokes that target.
3. If there is no cruise target, then it will try to prepare the test database by executing
db:test:purge and db:migrate tasks (if they are defined in your build), then calling
test target.
p(hint) Operating system variable RAILS_ENV is set to “test” before calling other default Rails tasks. This is to make sure that db:migrate connects to the appropriate database.
4. Finally, if there is no test target, CC.rb will try to invoke default target.
cruise task in your_project, you should make it dependent on
db:test:purge and db:migrate, and/or whatever is necessary to bring test environment up
to date.
Hint: You can configure CruiseControl.rb to build any kind of application. It doesn’t need to be Rails.