#!/usr/bin/env ruby load "#{File.dirname(__FILE__)}/lib/cruise_control/version.rb" def start load File.dirname(__FILE__) + "/script/server" end def add load File.dirname(__FILE__) + "/script/add_project" end def builder load File.dirname(__FILE__) + "/script/builder" end def version puts <<-EOL CruiseControl.rb, version #{CruiseControl::VERSION::STRING} Copyright (C) 2007 ThoughtWorks EOL end def help command = ARGV.shift ARGV.clear << '--help' if command.nil? puts <<-EOL Usage: cruise [options] [args] CruiseControl.rb command-line client, version #{CruiseControl::VERSION::STRING} Type 'cruise help ' for help on a specific command. Type 'svn --version' to see the version number. Available commands: start - starts the web server add - adds a project build - starts the builder for an individual project CruiseControl.rb is a Continous Integration Server. For additional information, see http://cruisecontrolrb.rubyforge.org/ EOL elsif method_for_command(command) self.send(method_for_command(command)) else STDERR.puts "Type 'cruise help' for usage." exit -1 end end def method_for_command(command) case command when 'start' then :start when 'add' then :add when 'build', 'builder' then :builder when 'version', '-v', '--version' then :version when 'help', '-h', '--help', '/?', '-?' then :help else nil end end command = ARGV.shift if method_for_command(command) self.send(method_for_command(command)) elsif command.nil? STDERR.puts "Type 'cruise --help' for usage." exit -1 else STDERR.puts "Unknown command : '#{command}'" STDERR.puts "Type 'cruise --help' for usage." exit -1 end