lib/dwc-archive/expander.rb in dwc-archive-0.1.4 vs lib/dwc-archive/expander.rb in dwc-archive-0.1.5

- old
+ new

@@ -7,11 +7,13 @@ @unpacker = get_unpacker end def unpack clean - @unpacker.call(@path, @archive_path) if @unpacker + raise FileNotFoundError unless File.exists?(@archive_path) + success = @unpacker.call(@path, @archive_path) if @unpacker + (@unpacker && success && $?.exitstatus == 0) ? success : (clean; raise UnpackingError) end def path @files_path ||= files_path end @@ -30,15 +32,15 @@ file_type = IO.popen("file -z " + @archive_path).read if file_type.match(/tar.*gzip/i) return proc do |tmp_path, archive_path| FileUtils.mkdir tmp_path - system "tar -zxvf #{archive_path} -C #{tmp_path}" + system("tar -zxf #{archive_path} -C #{tmp_path} > /dev/null 2>&1") end end if file_type.match(/Zip/) - return proc { |tmp_path, archive_path| system "unzip -qq -d #{tmp_path} #{archive_path}" } + return proc { |tmp_path, archive_path| system("unzip -qq -d #{tmp_path} #{archive_path} > /dev/null 2>&1") } end return nil end