lib/capsaicin/files/local.rb in capsaicin-0.1.7 vs lib/capsaicin/files/local.rb in capsaicin-0.1.8

- old
+ new

@@ -45,19 +45,17 @@ end cd dir end def tar_c(dest, src, options={}, &filter) - logger and - logger.trace "tar -cf #{dest} " + Array(src).map { |s| s.gsub ' ', '\\ ' }.join(' ') + logger and logger.trace "tar -cf #{dest} #{Array(src).map{|s| s.gsub ' ', '\\ '}.join(' ')}" _tar File.open(dest, 'wb'), src, options, &filter end def tar_cz(dest, src, options={}, &filter) require 'zlib' unless defined? Zlib::GzipWriter - logger and - logger.trace "tar -czf #{dest} " + Array(src).map { |s| s.gsub ' ', '\\ ' }.join(' ') + logger and logger.trace "tar -czf #{dest} #{Array(src).map{|s| s.gsub ' ', '\\ ' }.join(' ')}" _tar Zlib::GzipWriter.new(File.open(dest, 'wb')), src, options, &filter end def tar_t(src, options={}, &block) logger and logger.trace "tar -tf #{src}" @@ -70,16 +68,16 @@ _lstar Zlib::GzipReader.new(File.open(src, 'rb')), options, &block end def tar_x(src, options={}, &block) logger and logger.trace "tar -xf #{src}" - _untar File.open(src, 'wb'), options, &block + _untar File.open(src, 'wb'), options[:chdir]||'.', options, &block end def tar_xz(src, options={}, &block) require 'zlib' unless defined? Zlib::GzipWriter logger and logger.trace "tar -xzf #{src}" - _untar Zlib::GzipReader.new(File.open(src, 'rb')), options, &block + _untar Zlib::GzipReader.new(File.open(src, 'rb')), options[:chdir]||'.', options, &block end private def _tar(os, src, options, &filter)