4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/tarchiver/compressors/gzip.rb', line 4
def self.compress(archive_path, tar_path, options)
tgz_path = "#{archive_path}.tgz"
begin
Zlib::GzipWriter.open(tgz_path) do |gz|
::File.open(tar_path, "rb") do |tar|
while buffer = tar.read(options[:blocksize])
gz.write(buffer)
end
end
end
rescue => error
puts "GZip could not complete zipping for the following reason:\n#{error.message}" if options[:verbose]
return Tarchiver::Helpers.terminate(error, options)
end
tgz_path
end
|