module BackupFoundation

Constants

HOST
VERSION

Attributes

app_key[R]
encryption_key[R]
items[R]

Public Class Methods

backup_db() click to toggle source
# File lib/backup_foundation.rb, line 24
def backup_db
  Item::DATABASES.each do |key, val|
    if val.respond_to?(:exist?) && val.exist?(Rails.env.to_s)
      @items.push({ type: key }.merge(val.get_config(Rails.env.to_s)))
    end
  end
end
backup_directory(item_name, path=nil) click to toggle source
# File lib/backup_foundation.rb, line 32
def backup_directory(item_name, path=nil)
  unless path
    path      = item_name
    item_name = item_name.gsub '/', '_'
  end

  @items.push type: 'directory', name: item_name, path: path
end
encrypt(key) click to toggle source
# File lib/backup_foundation.rb, line 20
def encrypt(key)
  @encryption_key = key
end
make_backup!() click to toggle source
# File lib/backup_foundation.rb, line 41
def make_backup!
  Job.new(
    key:            @app_key,
    dbs:            @items,
    encryption_key: @encryption_key
  ).backup!
end
restore_backup!() click to toggle source
# File lib/backup_foundation.rb, line 49
def restore_backup!
  Job.new(
    key:            @app_key,
    dbs:            @items,
    encryption_key: @encryption_key
  ).restore!
end
store_app(app_key, &block) click to toggle source
# File lib/backup_foundation.rb, line 14
def store_app(app_key, &block)
  @app_key = app_key
  @items = []
  instance_eval(&block) if block_given?
end