Class: Puppet::ModuleTool::Tar::Mini Private
- Defined in:
- lib/puppet/module_tool/tar/mini.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
Instance Method Details
#pack(sourcedir, destfile) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/puppet/module_tool/tar/mini.rb', line 28 def pack(sourcedir, destfile) Zlib::GzipWriter.open(destfile) do |writer| Minitar.pack(sourcedir, writer) do |step, name, stats| # TODO smcclellan 2017-10-31 Set permissions here when this yield block # executes before the header is written. As it stands, the `stats` # argument isn't mutable in a way that will effect the desired mode for # the file. end end end |
#unpack(sourcefile, destdir, _) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/puppet/module_tool/tar/mini.rb', line 4 def unpack(sourcefile, destdir, _) Zlib::GzipReader.open(sourcefile) do |reader| args = [reader, destdir, find_valid_files(reader)] # With minitar >= 0.9, we can prevent minitar from fsync'ing # each extracted file and directory args << { :fsync => false } Minitar.unpack(*args) do |action, name, stats| case action when :dir validate_entry(destdir, name) set_dir_mode!(stats) Puppet.debug("Extracting: #{destdir}/#{name}") when :file_start # Octal string of the old file mode. validate_entry(destdir, name) set_file_mode!(stats) Puppet.debug("Extracting: #{destdir}/#{name}") end set_default_user_and_group!(stats) stats end end end |