class Buildr::TarTask

The TarTask creates a new Tar file. You can include any number of files and and directories, use exclusion patterns, and include files into specific directories.

To create a GZipped Tar, either set the gzip option to true, or use the .tgz or .gz suffix.

For example:

tar("test.tgz").tap do |task|
  task.include "srcs"
  task.include "README", "LICENSE"
end

See Buildr#tar and ArchiveTask.

Attributes

gzip[RW]

To create a GZipped Tar, either set this option to true, or use the .tgz/.gz suffix.

mode[RW]

Permission mode for files contained in the Tar. Defaults to 0755.

Public Instance Methods

entry(name) → Entry click to toggle source

Returns a Tar file entry. You can use this to check if the entry exists and its contents, for example:

package(:tar).entry("src/LICENSE").should contain(/Apache Software License/)
# File lib/buildr/packaging/tar.rb, line 52
def entry(entry_name)
  Buildr::TarEntry.new(self, entry_name)
end
with_uncompressed_tar { |tar_entries| ... } click to toggle source

Yields an Archive::Tar::Minitar::Input object to the provided block. Opening, closing and Gzip-decompressing is automatically taken care of.

# File lib/buildr/packaging/tar.rb, line 67
def with_uncompressed_tar &block
  if gzip
    Zlib::GzipReader.open(name) { |tar| Archive::Tar::Minitar.open(tar, &block) }
  else
    Archive::Tar::Minitar.open(name, &block)
  end
end