public
Description: Remote multi-server automation tool. This repository is no longer being actively maintained. Please ask on the mailing list to find someone who has a well-maintained fork. Thanks!
Homepage: http://www.capify.org
Clone URL: git://github.com/jamis/capistrano.git
win32 fixes

don't blindly replace every "cd" with "cd /D" but only on beginning of the 
command and after &&

When executing local commands on win32, replace "cd" with "cd /D" and path 
separator / with \\
esad (author)
Fri Nov 07 08:54:38 -0800 2008
jamis (committer)
Fri Nov 07 08:54:38 -0800 2008
commit  63f0a2ca11fb91ce52c1e07d623fa58504b9d5e5
tree    61bd87f59405f8362fb05d04760cdb5323e8c949
parent  eff0e62bb7213b178aee94e1bbe8c403da395817
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 == (unreleased)
0
 
0
+* Make locally executed commands in Windows more Windows-friendly [esad@esse.at]
0
+
0
 * Added :scm_arguments variable for custom SCM arguments (subversion-only, currently) [David Abdemoulaie]
0
 
0
 * Don't emit -p for sudo when :sudo_prompt is blank [Matthias Marschall]
...
48
49
50
51
52
 
 
 
 
 
 
 
 
 
 
 
53
54
55
...
48
49
50
 
 
51
52
53
54
55
56
57
58
59
60
61
62
63
64
0
@@ -48,8 +48,17 @@ module Capistrano
0
 
0
           # A wrapper for Kernel#system that logs the command being executed.
0
           def system(*args)
0
-            logger.trace "executing locally: #{args.join(' ')}"
0
-            super
0
+            cmd = args.join(' ')
0
+            if RUBY_PLATFORM =~ /win32/
0
+              cmd.gsub!('/','\\') # Replace / with \\
0
+              cmd.gsub!(/^cd/,'cd /D') # Replace cd with cd /D
0
+              cmd.gsub!(/&& cd/,'&& cd /D') # Replace cd with cd /D
0
+              logger.trace "executing locally: #{cmd}"
0
+              super(cmd)
0
+            else
0
+              logger.trace "executing locally: #{cmd}"
0
+              super
0
+            end
0
           end
0
 
0
         private

Comments