public
Description: CruiseControl.rb is a continuous integration tool, written in Ruby. It is quick to install, simple to use and easy to hack.
Homepage: http://cruisecontrolrb.thoughtworks.com/
Clone URL: git://github.com/benburkert/cruisecontrolrb.git
cruisecontrolrb / cruise
100755 78 lines (64 sloc) 1.8 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env ruby
 
load "#{File.dirname(__FILE__)}/lib/cruise_control/version.rb"
 
def start
  load "./script/server"
end
 
def add
  load "./script/add_project"
end
 
def builder
  load "./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 <command> [options] [args]
 
CruiseControl.rb command-line client, version #{CruiseControl::VERSION::STRING}
Type 'cruise help <command>' 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)
  require 'fileutils'
  FileUtils.cd(File.dirname(__FILE__)) do
    self.send(method_for_command(command))
  end
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