class Siba::Archive::Tar::Init

Attributes

archive[RW]

Public Class Methods

new(options) click to toggle source
# File lib/siba/plugins/archive/tar/init.rb, line 15
def initialize(options)
  options = options
  compression = Siba::SibaCheck.options_string options, "compression", true, DefaultCompression
  Archive.check_compression_type compression
  @archive = Archive.new compression
end

Public Instance Methods

backup(sources_dir, dest_dir, dest_file_name) click to toggle source

Archive the contents of sources_dir and put it to dest_dir. Return the archive file name. It must start with dest_file_name and its ending must not vary with time.

# File lib/siba/plugins/archive/tar/init.rb, line 25
def backup(sources_dir, dest_dir, dest_file_name)
  logger.info "Archiving with 'tar', compression: '#{archive.compression}'"
  @archive.archive sources_dir, dest_dir, dest_file_name
end
restore(path_to_archive, to_dir) click to toggle source

Extract archive file (path_to_archive) to_dir No return value is expected.

# File lib/siba/plugins/archive/tar/init.rb, line 32
def restore(path_to_archive, to_dir)
  logger.info "Extracting 'tar' archive, compression: '#{archive.compression}'"
  @archive.extract path_to_archive, to_dir
end