Module: Backup

Defined in:
lib/backup.rb,
lib/backup/cli.rb,
lib/backup/model.rb,
lib/backup/finder.rb,
lib/backup/logger.rb,
lib/backup/archive.rb,
lib/backup/version.rb,
lib/backup/syncer/s3.rb,
lib/backup/dependency.rb,
lib/backup/storage/s3.rb,
lib/backup/storage/ftp.rb,
lib/backup/storage/scp.rb,
lib/backup/syncer/base.rb,
lib/backup/storage/base.rb,
lib/backup/storage/sftp.rb,
lib/backup/syncer/rsync.rb,
lib/backup/database/base.rb,
lib/backup/encryptor/gpg.rb,
lib/backup/notifier/base.rb,
lib/backup/notifier/mail.rb,
lib/backup/storage/rsync.rb,
lib/backup/database/mysql.rb,
lib/backup/database/redis.rb,
lib/backup/encryptor/base.rb,
lib/backup/storage/object.rb,
lib/backup/compressor/base.rb,
lib/backup/compressor/gzip.rb,
lib/backup/notifier/binder.rb,
lib/backup/storage/dropbox.rb,
lib/backup/compressor/bzip2.rb,
lib/backup/database/mongodb.rb,
lib/backup/notifier/twitter.rb,
lib/backup/notifier/campfire.rb,
lib/backup/configuration/base.rb,
lib/backup/encryptor/open_ssl.rb,
lib/backup/notifier/presently.rb,
lib/backup/storage/cloudfiles.rb,
lib/backup/database/postgresql.rb,
lib/backup/configuration/helpers.rb,
lib/backup/configuration/syncer/s3.rb,
lib/backup/configuration/storage/s3.rb,
lib/backup/configuration/storage/ftp.rb,
lib/backup/configuration/storage/scp.rb,
lib/backup/configuration/storage/base.rb,
lib/backup/configuration/storage/sftp.rb,
lib/backup/configuration/syncer/rsync.rb,
lib/backup/configuration/database/base.rb,
lib/backup/configuration/encryptor/gpg.rb,
lib/backup/configuration/notifier/base.rb,
lib/backup/configuration/notifier/mail.rb,
lib/backup/configuration/storage/rsync.rb,
lib/backup/exception/command_not_found.rb,
lib/backup/configuration/database/mysql.rb,
lib/backup/configuration/database/redis.rb,
lib/backup/configuration/encryptor/base.rb,
lib/backup/configuration/compressor/base.rb,
lib/backup/configuration/compressor/gzip.rb,
lib/backup/configuration/storage/dropbox.rb,
lib/backup/configuration/compressor/bzip2.rb,
lib/backup/configuration/database/mongodb.rb,
lib/backup/configuration/notifier/twitter.rb,
lib/backup/configuration/notifier/campfire.rb,
lib/backup/configuration/encryptor/open_ssl.rb,
lib/backup/configuration/notifier/presently.rb,
lib/backup/configuration/storage/cloudfiles.rb,
lib/backup/configuration/database/postgresql.rb

Overview

The Backup Ruby Gem

Defined Under Namespace

Modules: CLI, Compressor, Configuration, Database, Encryptor, Exception, Notifier, Storage, Syncer Classes: Archive, Dependency, Finder, Logger, Model, Version

Constant Summary collapse

DATABASES =

List the available database, storage, compressor, encryptor and notifier constants. These are used to dynamically define these constants as classes inside Backup::Finder to provide a nicer configuration file DSL syntax to the users. Adding existing constants to the arrays below will enable the user to use a constant instead of a string. Example, instead of:

database "MySQL" do |mysql|

You can do:

database MySQL do |mysql|
['MySQL', 'PostgreSQL', 'MongoDB', 'Redis']
STORAGES =
['S3', 'CloudFiles', 'Dropbox', 'FTP', 'SFTP', 'SCP', 'RSync']
COMPRESSORS =
['Gzip', 'Bzip2']
ENCRYPTORS =
['OpenSSL', 'GPG']
SYNCERS =
['RSync', 'S3']
NOTIFIERS =
['Mail', 'Twitter', 'Campfire', 'Presently']
LIBRARY_PATH =

Backup’s internal paths

File.join(File.dirname(__FILE__), 'backup')
CONFIGURATION_PATH =
File.join(LIBRARY_PATH, 'configuration')
STORAGE_PATH =
File.join(LIBRARY_PATH, 'storage')
DATABASE_PATH =
File.join(LIBRARY_PATH, 'database')
COMPRESSOR_PATH =
File.join(LIBRARY_PATH, 'compressor')
ENCRYPTOR_PATH =
File.join(LIBRARY_PATH, 'encryptor')
NOTIFIER_PATH =
File.join(LIBRARY_PATH, 'notifier')
SYNCER_PATH =
File.join(LIBRARY_PATH, 'syncer')
EXCEPTION_PATH =
File.join(LIBRARY_PATH, 'exception')
PATH =

Backup’s Environment paths

File.join(ENV['HOME'], 'Backup')
DATA_PATH =
File.join(ENV['HOME'], 'Backup', 'data')
CONFIG_FILE =
File.join(ENV['HOME'], 'Backup', 'config.rb')
LOG_PATH =
File.join(ENV['HOME'], 'Backup', 'log')
TMP_PATH =
File.join(ENV['HOME'], 'Backup', '.tmp')

Instance Method Summary collapse

Instance Method Details

#constantObject

Dynamically defines all the available database, storage, compressor, encryptor and notifier classes inside Backup::Finder to improve the DSL for the configuration file



175
176
177
178
179
# File 'lib/backup.rb', line 175

(DATABASES + STORAGES + COMPRESSORS + ENCRYPTORS + NOTIFIERS + SYNCERS).each do |constant|
  unless Backup::Finder.const_defined?(constant)
    Backup::Finder.const_set(constant, Class.new)
  end
end