Class: Epublishing::TgzExtractor

Inherits:
Gem::Package::TarInput
  • Object
show all
Defined in:
lib/epublishing/tgz_extractor.rb

Class Method Summary collapse

Class Method Details

.extract(src, destdir, verbose = false) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/epublishing/tgz_extractor.rb', line 30

def self.extract(src, destdir, verbose=false)
  tarinput = new
  Zlib::GzipReader.open(src) do |gz|
    io = StringIO.new gz.read
    Gem::Package::TarReader.new(io) do |tar|
      tar.each do |entry|
        puts "+ #{entry.full_name}" if verbose
        tarinput.extract_entry(destdir, entry)
      end
    end
  end
end