Sha256: b3ff6a9a133a4a3ed6c7d09a39942b42c4c7a4f98944251a5cdea56b2294ccd2
Contents?: true
Size: 1.15 KB
Versions: 4
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true require 'rubygems/package' require 'zlib' require 'open-uri' module Appifier module Helpers module Archives def untar_gz(archive:, destination:) source = open archive ::Gem::Package::TarReader.new(Zlib::GzipReader.new(source)) do |tar| dest = nil tar.each do |entry| if entry.full_name == '././@LongLink' dest = File.join destination, entry.read.strip next end dest ||= File.join destination, entry.full_name if entry.directory? File.delete dest if File.file? dest FileUtils.mkdir_p dest, mode: entry.header.mode, verbose: false elsif entry.file? FileUtils.rm_rf dest if File.directory? dest File.open dest, 'wb' do |f| f.print entry.read end FileUtils.chmod entry.header.mode, dest, verbose: false elsif entry.header.typeflag == '2' # Symlink! File.symlink entry.header.linkname, dest end dest = nil end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems