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
fix issue 107: make ccrb work in Windows

git-svn-id: http://cruisecontrolrb.rubyforge.org/svn/trunk@451 
c04ce798-636b-4ca8-9149-0f9336831111
zhanglin (author)
Mon Apr 09 00:12:35 -0700 2007
commit  c553d8d2c67464d6b69832d1dda823f512a0f499
tree    502327f152b09a9b3be3fd26b6179ac75a2acf1b
parent  7c2f491da980df452fd37e730dc29a6d6070660d
...
22
23
24
25
 
26
27
28
...
22
23
24
 
25
26
27
28
0
@@ -22,7 +22,7 @@ class BuilderStarter
0
   def self.begin_builder(project_name)
0
     verbose_option = $VERBOSE_MODE ? " --trace" : ""
0
     cruise_executable = File.join(RAILS_ROOT, (Platform.family == 'mswin32' ? 'cruise.cmd' : 'cruise'))
0
- command = "#{cruise_executable} build #{project_name}#{verbose_option}"
0
+ command = "\"#{cruise_executable}\" build #{project_name}#{verbose_option}"
0
     Platform.create_child_process(project_name, command)
0
   end
0
   
...
26
27
28
29
 
 
30
31
32
33
34
 
35
36
37
...
26
27
28
 
29
30
31
32
33
34
 
35
36
37
38
0
@@ -26,12 +26,13 @@ module Platform
0
   module_function :prompt
0
 
0
   def create_child_process(project_name, command)
0
- if Kernel.respond_to?(:fork)
0
+ Thread.new { system(command) } unless Kernel.respond_to?(:fork)
0
+ begin
0
       pid = fork || exec(command)
0
       pid_file = File.join(RAILS_ROOT, 'tmp', 'pids', 'builders', "#{project_name}.pid")
0
       FileUtils.mkdir_p(File.dirname(pid_file))
0
       File.open(pid_file, "w") {|f| f.write pid }
0
- else
0
+ rescue NotImplementedError # Kernel.fork exists but not implemented in Windows
0
       Thread.new { system(command) }
0
     end
0
   end
...
109
110
111
112
113
 
114
115
116
...
153
154
155
156
 
157
158
159
...
109
110
111
 
 
112
113
114
115
...
152
153
154
 
155
156
157
158
0
@@ -109,8 +109,7 @@ class BuildTest < Test::Unit::TestCase
0
       build.stubs(:execute)
0
 
0
       build.run
0
-
0
- assert_equal 'cool project settings', file('build-123-success.in1s/cruise_config.rb').contents
0
+ assert_equal 'cool project settings', file(Dir['build-123-success.in*s/cruise_config.rb'][0]).contents
0
       assert_equal 'cool project settings', Build.new(project, 123).project_settings
0
     end
0
   end
0
@@ -153,7 +152,7 @@ class BuildTest < Test::Unit::TestCase
0
       build.expects(:execute).with(build.rake, expected_redirect_options).raises(CommandLine::ExecutionError)
0
       build.run
0
       
0
- log = File.open("build-123-failed.in1s/build.log"){|f| f.read }
0
+ log = file(Dir["build-123-failed.in*s/build.log"][0]).content
0
       assert_match /trunk exists/, log
0
     end
0
   end
...
22
23
24
25
 
26
27
28
29
 
30
31
32
...
34
35
36
37
 
38
39
40
41
 
42
43
44
...
22
23
24
 
25
26
27
28
 
29
30
31
32
...
34
35
36
 
37
38
39
40
 
41
42
43
44
0
@@ -22,11 +22,11 @@ class BuilderStarterTest < Test::Unit::TestCase
0
   
0
   def test_should_use_platform_specific_executable
0
     Platform.expects(:family).returns("mswin32")
0
- Platform.expects(:create_child_process).with(@one.name, "#{RAILS_ROOT}/cruise.cmd build #{@one.name}")
0
+ Platform.expects(:create_child_process).with(@one.name, "\"#{RAILS_ROOT}/cruise.cmd\" build #{@one.name}")
0
     BuilderStarter.begin_builder(@one.name)
0
 
0
     Platform.expects(:family).returns("linux")
0
- Platform.expects(:create_child_process).with(@one.name, "#{RAILS_ROOT}/cruise build #{@one.name}")
0
+ Platform.expects(:create_child_process).with(@one.name, "\"#{RAILS_ROOT}/cruise\" build #{@one.name}")
0
     BuilderStarter.begin_builder(@one.name)
0
   end
0
 
0
@@ -34,11 +34,11 @@ class BuilderStarterTest < Test::Unit::TestCase
0
     $VERBOSE_MODE = true
0
     begin
0
       Platform.expects(:family).returns("mswin32")
0
- Platform.expects(:create_child_process).with(@one.name, "#{RAILS_ROOT}/cruise.cmd build #{@one.name} --trace")
0
+ Platform.expects(:create_child_process).with(@one.name, "\"#{RAILS_ROOT}/cruise.cmd\" build #{@one.name} --trace")
0
       BuilderStarter.begin_builder(@one.name)
0
 
0
       Platform.expects(:family).returns("linux")
0
- Platform.expects(:create_child_process).with(@one.name, "#{RAILS_ROOT}/cruise build #{@one.name} --trace")
0
+ Platform.expects(:create_child_process).with(@one.name, "\"#{RAILS_ROOT}/cruise\" build #{@one.name} --trace")
0
       BuilderStarter.begin_builder(@one.name)
0
     ensure
0
       $VERBOSE_MODE = false

Comments

    No one has commented yet.