Sha256: e6ac4c24762d4991ef370f799f084b9c7e4e655aaaf08affbf3e306e3f4c96d0
Contents?: true
Size: 1.25 KB
Versions: 13
Compression:
Stored size: 1.25 KB
Contents
module Backup module Compressor class Custom < Base ## # Specify the system command to invoke a compressor, # including any command-line arguments. # e.g. @compressor.command = 'pbzip2 -p2 -4' # # The data to be compressed will be piped to the command's STDIN, # and it should write the compressed data to STDOUT. # i.e. `cat file.tar | %command% > file.tar.%extension%` attr_accessor :command ## # File extension to append to the compressed file's filename. # e.g. @compressor.extension = '.bz2' attr_accessor :extension ## # Initializes a new custom compressor. def initialize(&block) load_defaults! instance_eval(&block) if block_given? @cmd = set_cmd @ext = set_ext end private ## # Return the command line using the full path. # Ensures the command exists and is executable. def set_cmd parts = @command.to_s.split(" ") parts[0] = utility(parts[0]) parts.join(" ") end ## # Return the extension given without whitespace. # If extension was not set, return an empty string def set_ext @extension.to_s.strip end end end end
Version data entries
13 entries across 13 versions & 4 rubygems