[Capistrano] Re: Problem with :deploy_via, :copy and windows

2009-01-29 Thread Chris

Thanks for this hack!  This helped me out quite a bit.  For as long
capistrano has been out there, I can't believe there are still so many
issues with deploying from a Windows machine!!

I had to make this change with the backslashes and I had to correct
the zip problem too (made a zip.bat and an unzip.bat file with the
proper commands so it would pass the deploy:check tests).  Finally it
is could checkout my project and is now compressing all the files to
transfer up to my production server.

Thanks for your work!


On Jan 13, 4:39 pm, Tilendor tilen...@gmail.com wrote:
 Hey there.  I am just getting started with using Capistrano for our
 first Rails app ever.  We are developing onWindowsboxes on a company
 network.  We are deploying to a Virtual Private Server running linux,
 Fedora Core 7.  We are also using Subversion.  I don't want to poke
 holes through our firewall to give access to svnserve(and I couldn't
 figure out how).  So its very necessary for us to use the :copy
 option.  I was running into a problem with a command that was
 incorrectly switching slashes.

 The repository lives at svn://192.xxx.xxx.xxx:xxx/.  When trying to
 get a local copy of the repository, it would execute this command: svn
 checkout -q --username x --password --no-auth-cache -r2005 svn:\
 \192.xxx.xxx.xxx:\ c:\Docume~1\tilendor\locals~1\temp
 \20090113204628

 The script blindly flip slashes on the URL the same as the filepath
 and fail, because the svn URL wasn't valid.

 I made a patch which worked for me.
 In capistrano\recipes\deploy\stategy\base.rd on line 50 is the method:
        def system(*args)
             cmd = args.join(' ')
             if RUBY_PLATFORM =~ /win32/
               cmd.gsub!('/','\\') # Replace / with \\
               cmd.gsub!(/^cd /,'cd /D ') # Replace cd with cd /D
               cmd.gsub!(/ cd /,' cd /D ') # Replace cd with cd /D
               logger.trace executing locally: #{cmd}
               super(cmd)
             else
               logger.trace executing locally: #{cmd}
               super
             end
           end

 The problem line is cmd.gsub!('/','\\') #replace / with \\ that
 blindly alters the URL and the filepath.

 I made the following change:

             if RUBY_PLATFORM =~ /win32/
                 parts = cmd.split(' ')
                 parts.collect! do |part|
                         part.gsub!('/','\\') unless /\/\// =~ part # if the
 string has // is probably a url, don't change.
                         part
                     end
                 cmd = parts.join(' ')
               cmd.gsub!(/^cd /,'cd /D ') # Replace cd with cd /D
               cmd.gsub!(/ cd /,' cd /D ') # Replace cd with cd /D
               logger.trace executing locally: #{cmd}
               super(cmd)

 I be there are otherwindowsusers that face this issue.  What would
 it take to get this included in a future version of Capistrano?

 Thanks,
 ~Tilendor

--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: Problem with :deploy_via, :copy and windows

2009-01-29 Thread Jamis Buck

On 1/29/09 1:35 PM, Chris wrote:
 Thanks for this hack!  This helped me out quite a bit.  For as long
 capistrano has been out there, I can't believe there are still so many
 issues with deploying from a Windows machine!!

I'm not even going to go there. I think everyone knows my stance on this.

 I be there are otherwindowsusers that face this issue.  What would
 it take to get this included in a future version of Capistrano?

A patch, submitted either via a GitHub pull request, or uploaded as a
diff to http://capistrano.lighthouseapp.com.

As I've said before, if someone submits a patch for a windows issue, and
it doesn't break any of the tests when I run it on my (OS X) machine,
and it doesn't uglify the codebase, I'll commit it. Note that I will do
this without any testing or further confirmation from the windows
community, so if you're a windows user, you are encouraged to watch the
commits closely and do your own quality control.

Windows is, as far as I'm concerned, use-at-your-own-risk.

- Jamis

--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---



[Capistrano] Re: Problem with :deploy_via, :copy and windows

2009-01-13 Thread Trejkaz

On Wed, Jan 14, 2009 at 8:39 AM, Tilendor tilen...@gmail.com wrote:
 The script blindly flip slashes on the URL the same as the file path
 and fail, because the svn URL wasn't valid.

I mentioned this on the lists myself a while back, and in my case I
simply left them all as / and it solved the problem.  Windows supports
/ in almost all its APIs anyway, the only time it *doesn't* (AFAIK) is
when you're using the \\?\-prefixed file paths.

TX

--~--~-~--~~~---~--~~
To unsubscribe from this group, send email to 
capistrano-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/capistrano
-~--~~~~--~~--~--~---