Module: BackupFoundation
- Defined in:
- lib/backup_foundation.rb,
lib/backup_foundation/job.rb,
lib/backup_foundation/railtie.rb,
lib/backup_foundation/version.rb,
lib/backup_foundation/item/base.rb,
lib/backup_foundation/item/items.rb,
lib/backup_foundation/item/mysql.rb,
lib/backup_foundation/item/sqlite.rb,
lib/backup_foundation/item/directory.rb,
lib/backup_foundation/item/postgresql.rb,
lib/generators/backup_foundation/install_generator.rb
Defined Under Namespace
Modules: Generators, Item
Classes: Job, Railtie
Constant Summary
collapse
- HOST =
'https://backup.foundation'
- VERSION =
"0.9.1"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.app_key ⇒ Object
Returns the value of attribute app_key.
12
13
14
|
# File 'lib/backup_foundation.rb', line 12
def app_key
@app_key
end
|
.encryption_key ⇒ Object
Returns the value of attribute encryption_key.
12
13
14
|
# File 'lib/backup_foundation.rb', line 12
def encryption_key
@encryption_key
end
|
.items ⇒ Object
Returns the value of attribute items.
12
13
14
|
# File 'lib/backup_foundation.rb', line 12
def items
@items
end
|
Class Method Details
.backup_db ⇒ Object
24
25
26
27
28
29
30
|
# 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) ⇒ Object
32
33
34
35
36
37
38
39
|
# 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) ⇒ Object
20
21
22
|
# File 'lib/backup_foundation.rb', line 20
def encrypt(key)
@encryption_key = key
end
|
.make_backup! ⇒ Object
41
42
43
44
45
46
47
|
# 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! ⇒ Object
49
50
51
52
53
54
55
|
# 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) ⇒ Object
14
15
16
17
18
|
# 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
|