Sha256: 719e87b0201b6c7b7545a54a4f4c88b436f160fb7613f1343179c47773a92c5f

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 KB

Contents

require 'webtranslateit/safe/version'

require 'aws/s3'
require 'cloudfiles'
require 'net/sftp'
# require 'net/ftp'
require 'fileutils'
require 'benchmark'

require 'tempfile'
require 'extensions/mktmpdir'

require 'webtranslateit/safe/tmp_file'

require 'webtranslateit/safe/config/node'
require 'webtranslateit/safe/config/builder'

require 'webtranslateit/safe/stream'

require 'webtranslateit/safe/backup'

require 'webtranslateit/safe/source'
require 'webtranslateit/safe/mysqldump'
require 'webtranslateit/safe/pgdump'
require 'webtranslateit/safe/archive'
require 'webtranslateit/safe/svndump'
require 'webtranslateit/safe/mongodump'

require 'webtranslateit/safe/pipe'
require 'webtranslateit/safe/gpg'
require 'webtranslateit/safe/gzip'

require 'webtranslateit/safe/sink'
require 'webtranslateit/safe/local'
require 'webtranslateit/safe/s3'
require 'webtranslateit/safe/cloudfiles'
require 'webtranslateit/safe/sftp'
require 'webtranslateit/safe/ftp'

module WebTranslateIt
  module Safe
    ROOT = File.join(File.dirname(__FILE__), '..', '..')

    def safe(&block)
      Config::Node.new(&block)
    end

    def process(config)

      [[Mysqldump, [:mysqldump, :databases]],
       [Pgdump,    [:pgdump,    :databases]],
       [Mongodump, [:mongodump, :databases]],
       [Archive,   [:tar,       :archives]],
       [Svndump,   [:svndump,   :repos]]
      ].each do |klass, path|
        if collection = config[*path]
          collection.each do |name, c|
            klass.new(name, c).backup.run(c, :gpg, :gzip, :local, :s3, :cloudfiles, :sftp, :ftp)
          end
        end
      end

      WebTranslateIt::Safe::TmpFile.cleanup
    end
    module_function :safe
    module_function :process
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
webtranslateit-safe-0.4.2 lib/webtranslateit/safe.rb
webtranslateit-safe-0.4.1 lib/webtranslateit/safe.rb