This is Net::SFTP and Net::SCP failing to open the file in binary mode on windows. I'll get that fixed as soon as I can.

- Jamis

On May 22, 2008, at 8:31 AM, Andrew Watts wrote:


I've got a task in my Capfile called diff_file which takes a file,
downloads it from one of the servers to a temp directory, and runs a
diff utility between the local version and the downloaded version.
Ever since Capistrano 2.3 and its attendant upgrades to Net::SSH and
friends, I've been getting line-feed issues diffing files.

I have a file, which has DOS line-enders (CRLF).  On the (Linux)
server, it also has CRLF line-enders.  On my (Windows) development
machine, it also has CRLF line-enders.  However, when I download the
file with my diff_file command, it gets an extra CR character at the
end of each line, as if the file was being transferred in text mode.
I looked through the code and I didn't see a way I could affect the
transfer mode with either SCP or SFTP.  Is there a way to do this?  Is
this indeed what's going on?

Here is my diff_file command:

desc <<-DESC
 Diffs a file against a file in the deployed version.

 To use this task, specify the file you want to diff in the FILE
 environment variable, or in the file variable.  The default diff
 command for this is set to use TortoiseMerge on Windows, assuming
 you have installed TortoiseSVN to C:\\Program Files\\TortoiseSVN.
 If you are on Linux or MacOSX, the diff command used is "diff -u".
DESC
task :diff_file do
 file = ENV['FILE'] || ENV['FILES'] || self[:file] || self[:files] ||
''
 name = File.basename(file)
 if PLATFORM =~ /win32/i
   diff_cmd = "C:\\Program Files\\TortoiseSVN\\bin\\TortoiseMerge.exe
tmp\\#{name} #{file.gsub(/\//, '\\')}"
 else
   diff_cmd = "diff -u tmp/#{name} #{file}"
 end
 diff_cmd ||= ENV['DIFF_CMD'] || self[:diff_cmd]

 begin
   get "#{current_path}/#{file}", "tmp/#{name}"
   system(diff_cmd)
 rescue Net::SFTP::Operations::StatusException => e
   puts "Retrieving the remote file failed: #{e.description}"
 end
end
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---


Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to