X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=code_ruby%2Flib%2Fmaasha%2Ffilesys.rb;h=81190f532d6ee54281d85d923168e5fd703c51fe;hb=aab12418af8bf7e9494f45e9b3249bff76fbae9c;hp=cee9e2213f9fef8766206b7a5b32f130620d8f18;hpb=d853435e09acb0ff7123b03c711eaf66073ee900;p=biopieces.git diff --git a/code_ruby/lib/maasha/filesys.rb b/code_ruby/lib/maasha/filesys.rb index cee9e22..81190f5 100644 --- a/code_ruby/lib/maasha/filesys.rb +++ b/code_ruby/lib/maasha/filesys.rb @@ -22,7 +22,7 @@ # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< -require 'zlib' +# require 'zlib' # require 'bzip2' require 'open3' @@ -50,7 +50,8 @@ class Filesys if mode == 'w' case options[:compress] when :gzip - ios = Zlib::GzipWriter.new File.open(file, mode, options) + # ios = Zlib::GzipWriter.new File.open(file, mode, options) + ios, = Open3.pipeline_w("gzip -f", out: file) when :bzip, :bzip2 # ios = Bzip2::Writer.new File.open(file, mode, options) # TODO being pissed with buggy bzip2 gem. ios, = Open3.pipeline_w("bzip2 -c", out: file) @@ -63,7 +64,8 @@ class Filesys else case `file -L #{file}` when /gzip/ - ios = Zlib::GzipReader.new File.open(file, mode, options) + # ios = Zlib::GzipReader.new File.open(file, mode, options) + ios = IO.popen("zcat #{file}") when /bzip/ # ios = Bzip2::Reader.new File.open(file, mode, options) # TODO this method is buggy, investigate ios = IO.popen("bzcat #{file}")