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
Hacked together git support for cruisecontrolrb
benburkert (author)
Mon Feb 11 22:07:16 -0800 2008
commit  2a51723432b357e3fc792a1d489a7c974c27289d
tree    79aab8c97f744de2f801fe4e3c3d0fb3a5ded1db
parent  c4efd1a65235f7989268f80409700dd409f8e71f
...
6
7
8
9
10
11
12
...
6
7
8
 
9
10
11
0
@@ -6,7 +6,6 @@ class ChangeInSourceControlTrigger
0
   def build_necessary?(reasons)
0
     p = @triggered_project
0
     p.notify :polling_source_control
0
-
0
     if !p.source_control.up_to_date?(reasons)
0
       p.notify :new_revisions_detected, reasons.flatten.find_all{|reason| reason.is_a? Revision}
0
       return true
...
8
9
10
11
 
12
13
14
...
8
9
10
 
11
12
13
14
0
@@ -8,7 +8,7 @@ class Project
0
   end
0
 
0
   def self.read(dir, load_config = true)
0
- @project_in_the_works = Project.new(File.basename(dir))
0
+ @project_in_the_works = Project.new(File.basename(dir), File.exists?("#{dir}/work/.git") ? Git.new : Subversion.new)
0
     begin
0
       @project_in_the_works.load_config if load_config
0
       return @project_in_the_works
...
10
11
12
13
 
 
14
15
16
17
 
18
19
 
20
 
 
 
 
 
 
 
21
22
 
23
24
25
...
47
48
49
50
51
52
53
54
55
56
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
59
60
...
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
...
57
58
59
 
 
 
 
 
 
 
 
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
0
@@ -10,16 +10,26 @@ trace = false
0
 scm_options = {:interactive => true}
0
 
0
 ARGV.options do |opts|
0
- opts.banner = "usage: cruise add <project-name> --url <URL> [subversion options]"
0
+ opts.banner = "usage: cruise add <project-name> --svn-url <URL> [subversion options]"
0
+ opts.banner << "\n cruise add <project-name> --git-url <URL> [git options]"
0
 
0
   opts.separator ""
0
 
0
- opts.on("-u", "--url url", String,
0
+ opts.on("-s", "--svn-url url", String,
0
           "The subversion url for the project (eg. svn://rubyforge.org/var/svn/cruisecontrolrb)") do |v|
0
     scm_options[:url] = v
0
+ scm_options[:svn] = true
0
   end
0
+
0
+ opts.on("-g", "--git-url url", String,
0
+ "The git url for the project (eg. git://github.com/benburkert/cruisecontrolrb.git)") do |v|
0
+ scm_options[:url] = v
0
+ scm_options[:git] = true
0
+ end
0
+
0
   opts.on("--username username", String, "Specify a username for source control") { |v| scm_options[:username] = v }
0
   opts.on("--password password", String, "Specify a password for source control") { |v| scm_options[:password] = v }
0
+ opts.on("-b", "--branch", String, "Specify a branch to track(git only)") { |v| scm_options[:branch] = v}
0
   opts.on('-t', '--trace', 'Print out exception stack traces') { trace = true }
0
 
0
   opts.separator ""
0
@@ -47,14 +57,21 @@ end
0
 puts "Adding project '#{project_name}' (this may take a while)..."
0
 
0
 begin
0
- require RAILS_ROOT + "/config/environment"
0
-
0
- source_control = Subversion.new(scm_options)
0
- project = Project.new(project_name, source_control)
0
- projects = Projects.load_all
0
- projects << project
0
-
0
- if source_control.url =~ /^svn\+ssh\:\/\//
0
+ require RAILS_ROOT + "/config/environment"
0
+
0
+ if scm_options.has_key?(:svn)
0
+ source_control = Subversion.new(scm_options)
0
+ elsif scm_options.has_key?(:git)
0
+ source_control = Git.new(scm_options)
0
+ else
0
+ raise "Unsupported SCM"
0
+ end
0
+
0
+ project = Project.new(project_name, source_control)
0
+ projects = Projects.load_all
0
+ projects << project
0
+
0
+ if source_control.url =~ /^svn\+ssh\:\/\//
0
     puts "IMPORTANT!!! - It looks like you are connecting to your repository with an svn+ssh connection. " +
0
          "For cruise to build this project, you need to have set up authentication caching for ssh, see this article"
0
     puts " http://subversion.tigris.org/faq.html#ssh-auth-cache"
...
9
10
11
12
 
13
14
15
...
9
10
11
 
12
13
14
15
0
@@ -9,7 +9,7 @@ require 'optparse'
0
 CRUISE_OPTIONS = { :verbose => false }
0
 
0
 ARGV.options do |opts|
0
- opts.banner = "Usage: cruise builder <project_name> []options]"
0
+ opts.banner = "Usage: cruise builder <project_name> [options]"
0
 
0
   opts.separator ""
0
 

Comments

    No one has commented yet.