Is there a way to wrap the file upload/download stream with zlib 
compression?

I have to upload and download easily compressible log and csv files. 
They're huge, and take a while. I tried shelling out the compression 
task, but several coworkers are using windows (I'm on a Mac).

I found Ruby has a built-in zlib library which compresses CSVs and log 
files very very nicely.

If no one has already done this, I'm going to try to wrap my file upload 
and download tasks with Zlib compression.

I'll then try to extract that functionality and move it into Capistrano 
itself.

I'll share the results and propose it as a patch for further release

Here's the uncompressed task I'm using as it stands now.

desc "Upload CSV Files"
task :copy do
   Dir.glob("lib/imports/**/*.csv") do |file|
     put(File.read(file), "#{shared_path}/#{file}")
   end
end

What I'm writing now is
desc "Upload CSV Files"
task :copy do
   Dir.glob("lib/imports/**/*.csv") do |file|
     put(Deflate.deflate(File.read(file)), "#{shared_path}/#{file}")
     # write a rake task that runs zlib inflate on the file
   end
end

Here's the syntax I'm shooting for.

desc "Upload CSV Files"
task :copy do
   Dir.glob("lib/imports/**/*.csv") do |file|
     put(File.read(file), "#{shared_path}/#{file}", :compress=>:zlib)
   end
end

I hope this helps!


--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---

Reply via email to