-
Notifications
You must be signed in to change notification settings - Fork 11
/
cruise
executable file
·77 lines (64 loc) · 1.76 KB
/
cruise
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
#!/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