Class: Puppet::ModuleTool::Tar::Mini

Inherits:
Object
  • Object
show all
Defined in:
lib/puppet/module_tool/tar/mini.rb

Instance Method Summary collapse

Instance Method Details

#pack(sourcedir, destfile) ⇒ Object



16
17
18
19
20
# File 'lib/puppet/module_tool/tar/mini.rb', line 16

def pack(sourcedir, destfile)
  Zlib::GzipWriter.open(destfile) do |writer|
    Archive::Tar::Minitar.pack(sourcedir, writer)
  end
end

#unpack(sourcefile, destdir, _) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/puppet/module_tool/tar/mini.rb', line 2

def unpack(sourcefile, destdir, _)
  Zlib::GzipReader.open(sourcefile) do |reader|
    Archive::Tar::Minitar.unpack(reader, destdir, find_valid_files(reader)) do |action, name, stats|
      case action
      when :file_done
        File.chmod(0644, "#{destdir}/#{name}")
      when :dir, :file_start
        validate_entry(destdir, name)
        Puppet.debug("Extracting: #{destdir}/#{name}")
      end
    end
  end
end