forked from backup/backup
-
Notifications
You must be signed in to change notification settings - Fork 0
Archives
Brian D. Burns edited this page Dec 13, 2011
·
11 revisions
Archives support:
- Files
- Directories
The following examples should be placed in your Backup configuration file.
Backup::Model.new(:my_backup, 'My Backup') do
# examples go here...
end
The following creates a single .tar
file called my_archive.tar
archive :my_archive do |archive|
# add a file
archive.add '/path/to/a/file.rb'
# add a folder (including sub-folders)
archive.add '/path/to/a/folder/'
# exclude a file
archive.exclude '/path/to/a/excluded_file.rb'
# exclude a folder (including sub-folders)
archive.exclude '/path/to/a/excluded_folder/'
end
- You can archive as many files and folders as you like within the
archive
block - You can have as many
archive
blocks as you like within your configuration file
Archives also have a tar_options
method, which can be used to add additional options to the tar
command used to
create the archive.
For example, to have tar
follow symlinks and store extended attributes, you could use:
archive :my_archive do |archive|
archive.add '/path/to/a/file.rb'
archive.tar_options '-h --xattrs'
end
The options available for tar
will depend on your system. See tar --help
or man tar
for details.
Note: It is not recommended that you add compression flags using tar_options
. The next version of backup will
automatically pipe the output of the archive's tar
command through the Compressor
configured using the compress_with
block.