rubycruisecontrol

Is Rails environment the prerequisite for cruisecontrol.rb


I have no rails environment but I want to use cruisecontrol.rb as my Continous Integration environment.

After following the instrcution from http://cruisecontrolrb.thoughtworks.com/documentation/getting_started and then

./cruise start 

I got the error here: (sorry, but the formatter is better than posting it here directly) http://pastebin.ca/1487868

It seems the CC.rb is doing some data migration/backup work when start up, and I could resolve this by comment out corresponding code :

#cruisecontrolrb / db / migrate / 002_move_custom_files_to_directory_in_user_home.rb         
DATA_ROOT = ARGV[0]
RAILS_ROOT = File.expand_path(".")     
if File.directory? 'projects'          
  #mv 'projects', DATA_ROOT + '/projects'  #comment out this line, it will work perfect fine
else
  mkdir_p DATA_ROOT + '/projects'
end

I debugged a litter bit and found when above code executing, the DATA_ROOT and Dir.pwd are ~/.cruise. So

mv 'projects', DATA_ROOT + '/projects' would become 
mv ~/.cruise/projects ~/.cruise/projects which is obvious not correct

What would you recommend to solve this? To redfine DATA_ROOT to what even place I want?


Solution

  • There are several ways around this, the easiest is probably to create a cruise_config.rb file in the root of your project. It should look something like this :

    Project.configure do |project|
      project.rake_task = "spec"
    end
    

    just replace "spec" with whatever rake task you have. if you're not using rake (say you're using ant) you can instead do something like this :

    Project.configure do |project|
      project.build_command = "ant test"
    end
    

    just replace "ant test" with command line command that will return 0 if successful and 1 otherwise. (ant, make, rake, all do this)