backup_foundation 0.2.1 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/backup_foundation.gemspec +7 -8
- data/lib/backup_foundation.rb +31 -6
- data/lib/backup_foundation/{db → item}/base.rb +2 -2
- data/lib/backup_foundation/item/directory.rb +13 -0
- data/lib/backup_foundation/item/items.rb +16 -0
- data/lib/backup_foundation/{db → item}/mysql.rb +1 -1
- data/lib/backup_foundation/{db → item}/postgresql.rb +1 -1
- data/lib/backup_foundation/{db → item}/sqlite.rb +1 -1
- data/lib/backup_foundation/job.rb +8 -11
- data/lib/backup_foundation/tasks/backup_foundation.rake +2 -16
- data/lib/backup_foundation/version.rb +1 -1
- data/lib/generators/backup_foundation/templates/initializer.rb +8 -1
- data/spec/backup_foundation_spec.rb +43 -0
- data/spec/db/base_spec.rb +13 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/support/database.yml +23 -0
- data/spec/support/helper.rb +8 -0
- metadata +36 -52
- data/lib/backup_foundation/db/databases.rb +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d242ea834958046c133d6653902faa54420b7f6
|
4
|
+
data.tar.gz: d9beb94a25f564ced8d6bd925c1df48f3187fe43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04e6264285ee486f54cb6881625144b87148b1d6a4e2c2d78f88cb3c9f53f154676fd4e530fbbf08a87f7a683356babed67d13b57362bbd09e3074a02ca3f63a
|
7
|
+
data.tar.gz: 43693b0f7707d467396d27113d8a2c65caf9e82802f55acfe1e0c4343d1453171d62850252376c9265447fb5771bcd04e381bd7307c16dbdb1f516858a66c1f7
|
data/.gitignore
CHANGED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/backup_foundation.gemspec
CHANGED
@@ -19,16 +19,15 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'rake'
|
22
|
-
spec.add_runtime_dependency 'multi_json'
|
23
22
|
spec.add_runtime_dependency 'multipart-post'
|
24
23
|
|
25
|
-
spec.add_development_dependency
|
26
|
-
spec.add_development_dependency
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency "mongoid", "~> 2.4.4"
|
30
|
-
spec.add_development_dependency "sqlite3", ">= 0"
|
24
|
+
spec.add_development_dependency 'bundler'
|
25
|
+
spec.add_development_dependency 'rspec'
|
26
|
+
spec.add_development_dependency 'rspec-rails'
|
27
|
+
spec.add_development_dependency 'sqlite3'
|
31
28
|
spec.add_development_dependency 'mysql2'
|
32
29
|
spec.add_development_dependency 'pg'
|
33
|
-
spec.add_development_dependency '
|
30
|
+
spec.add_development_dependency 'activerecord'
|
31
|
+
|
32
|
+
spec.add_development_dependency 'pry'
|
34
33
|
end
|
data/lib/backup_foundation.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'backup_foundation/version'
|
2
|
-
require 'backup_foundation/
|
2
|
+
require 'backup_foundation/item/items'
|
3
3
|
require 'backup_foundation/job'
|
4
4
|
if defined?(Rails)
|
5
5
|
require 'backup_foundation/railtie'
|
@@ -9,12 +9,12 @@ module BackupFoundation
|
|
9
9
|
HOST = 'https://backup.foundation' # 'http://localhost:3000'
|
10
10
|
|
11
11
|
class << self
|
12
|
-
attr_reader :app_key, :
|
12
|
+
attr_reader :app_key, :items, :encryption_key
|
13
13
|
|
14
14
|
def store_app(app_key, &block)
|
15
15
|
@app_key = app_key
|
16
|
-
@
|
17
|
-
instance_eval
|
16
|
+
@items = []
|
17
|
+
instance_eval(&block) if block_given?
|
18
18
|
end
|
19
19
|
|
20
20
|
def encrypt(key)
|
@@ -22,11 +22,36 @@ module BackupFoundation
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def backup_db
|
25
|
-
|
25
|
+
Item::DATABASES.each do |key, val|
|
26
26
|
if val.respond_to?(:exist?) && val.exist?(Rails.env.to_s)
|
27
|
-
@
|
27
|
+
@items.push({ type: key }.merge(val.get_config(Rails.env.to_s)))
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
31
|
+
|
32
|
+
def backup_directory(item_name, path=nil)
|
33
|
+
unless path
|
34
|
+
path = item_name
|
35
|
+
item_name = item_name.gsub '/', '_'
|
36
|
+
end
|
37
|
+
|
38
|
+
@items.push type: 'directory', name: item_name, path: path
|
39
|
+
end
|
40
|
+
|
41
|
+
def make_backup!
|
42
|
+
Job.new(
|
43
|
+
key: @app_key,
|
44
|
+
dbs: @items,
|
45
|
+
encryption_key: @encryption_key
|
46
|
+
).backup!
|
47
|
+
end
|
48
|
+
|
49
|
+
def restore_backup!
|
50
|
+
Job.new(
|
51
|
+
key: @app_key,
|
52
|
+
dbs: @items,
|
53
|
+
encryption_key: @encryption_key
|
54
|
+
).restore!
|
55
|
+
end
|
31
56
|
end
|
32
57
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module BackupFoundation
|
2
|
-
module
|
2
|
+
module Item
|
3
3
|
class Base
|
4
4
|
def initialize(options, tmpdir, encryption_key=nil)
|
5
5
|
@options = options
|
@@ -8,7 +8,7 @@ module BackupFoundation
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def outfile_path
|
11
|
-
"#{@tmpdir}/#{File.basename(@options[:database])}.gz#{'.gpg' if @encryption_key}"
|
11
|
+
"#{@tmpdir}/#{File.basename(@options[:database] || @options[:name])}.gz#{'.gpg' if @encryption_key}"
|
12
12
|
end
|
13
13
|
|
14
14
|
def output_to_file(command)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module BackupFoundation
|
2
|
+
module Item
|
3
|
+
class Directory < Base
|
4
|
+
def save_dump(tmpdir)
|
5
|
+
dump_and_encrypt_if_needed "tar -c #{@options[:path]}"
|
6
|
+
end
|
7
|
+
|
8
|
+
def load_dump(infile_path)
|
9
|
+
decrypt_if_needed_and_restore "tar -x", infile_path
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module BackupFoundation
|
2
|
+
module Item
|
3
|
+
autoload :Base, 'backup_foundation/item/base'
|
4
|
+
autoload :MySQL, 'backup_foundation/item/mysql'
|
5
|
+
autoload :PostgreSQL, 'backup_foundation/item/postgresql'
|
6
|
+
autoload :SQLite, 'backup_foundation/item/sqlite'
|
7
|
+
autoload :Directory, 'backup_foundation/item/directory'
|
8
|
+
|
9
|
+
DATABASES = {
|
10
|
+
mysql: BackupFoundation::Item::MySQL,
|
11
|
+
postgresql: BackupFoundation::Item::PostgreSQL,
|
12
|
+
sqlite: BackupFoundation::Item::SQLite,
|
13
|
+
directory: BackupFoundation::Item::Directory
|
14
|
+
}
|
15
|
+
end
|
16
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'net/http/post/multipart'
|
2
|
-
require 'backup_foundation/
|
2
|
+
require 'backup_foundation/item/items'
|
3
3
|
|
4
4
|
module BackupFoundation
|
5
5
|
class Job
|
@@ -9,7 +9,7 @@ module BackupFoundation
|
|
9
9
|
|
10
10
|
def backup!
|
11
11
|
for_each_db do |db, tmpdir|
|
12
|
-
(dumper = BackupFoundation::
|
12
|
+
(dumper = BackupFoundation::Item::DATABASES[db[:type].to_sym].new(db, tmpdir, @params[:encryption_key])).save_dump tmpdir
|
13
13
|
if File.exist? dumper.outfile_path
|
14
14
|
send_db_dump dumper.outfile_path, db
|
15
15
|
FileUtils.remove_entry_secure dumper.outfile_path
|
@@ -21,7 +21,7 @@ module BackupFoundation
|
|
21
21
|
for_each_db do |db, tmpdir|
|
22
22
|
file_path = download_db_dump tmpdir, db
|
23
23
|
if File.exist? file_path
|
24
|
-
BackupFoundation::
|
24
|
+
BackupFoundation::Item::DATABASES[db[:type].to_sym].new(db, tmpdir, @params[:encryption_key]).load_dump file_path
|
25
25
|
FileUtils.remove_entry_secure file_path
|
26
26
|
end
|
27
27
|
end
|
@@ -29,10 +29,7 @@ module BackupFoundation
|
|
29
29
|
|
30
30
|
def for_each_db(&block)
|
31
31
|
tmpdir = Dir.mktmpdir
|
32
|
-
@params[
|
33
|
-
unless defined?(HashWithIndifferentAccess) && db.is_a?(HashWithIndifferentAccess)
|
34
|
-
db.each { |key, val| db[key.to_sym] = db.delete(key) }
|
35
|
-
end
|
32
|
+
@params[:dbs].each do |db|
|
36
33
|
yield db, tmpdir
|
37
34
|
end
|
38
35
|
FileUtils.remove_entry_secure(tmpdir) if tmpdir and File.exist?(tmpdir)
|
@@ -40,12 +37,12 @@ module BackupFoundation
|
|
40
37
|
|
41
38
|
def send_db_dump(file, db)
|
42
39
|
url = URI.parse "#{BackupFoundation::HOST}/api/file"
|
43
|
-
upload_file = UploadIO.new(file, 'application/octet-stream', db[:type].to_s)
|
40
|
+
upload_file = UploadIO.new(file, 'application/octet-stream', (db[:name] || db[:type]).to_s)
|
44
41
|
request = Net::HTTP::Post::Multipart.new url.path,
|
45
42
|
'file' => upload_file,
|
46
|
-
'key' => @params[
|
43
|
+
'key' => @params[:key],
|
47
44
|
'gz' => 'on',
|
48
|
-
'gpg' => @params[
|
45
|
+
'gpg' => @params[:encryption_key] ? 'on' : 'off',
|
49
46
|
'md5' => Digest::MD5.hexdigest(File.read(file))
|
50
47
|
|
51
48
|
http = Net::HTTP.new url.host, url.port
|
@@ -70,7 +67,7 @@ module BackupFoundation
|
|
70
67
|
|
71
68
|
def download_db_dump(tmpdir, db)
|
72
69
|
file_path = nil
|
73
|
-
url = URI.parse "#{BackupFoundation::HOST}/api/file?key=#{@params[
|
70
|
+
url = URI.parse "#{BackupFoundation::HOST}/api/file?key=#{@params[:key]}&name=#{db[:name] || db[:type]}"
|
74
71
|
http = Net::HTTP.new url.host, url.port
|
75
72
|
if url.is_a? URI::HTTPS
|
76
73
|
http.use_ssl = true
|
@@ -1,25 +1,11 @@
|
|
1
1
|
namespace :backup_foundation do
|
2
2
|
desc 'Prepare and upload files for backup'
|
3
3
|
task backup: :environment do
|
4
|
-
|
5
|
-
key: BackupFoundation.app_key,
|
6
|
-
dbs: BackupFoundation.databases,
|
7
|
-
encryption_key: BackupFoundation.encryption_key
|
8
|
-
job = BackupFoundation::Job.new(opts).backup!
|
4
|
+
BackupFoundation.make_backup!
|
9
5
|
end
|
10
6
|
|
11
|
-
# desc 'Support task. Makes all dirty job'
|
12
|
-
# task :dump_and_send, :params do |t, params|
|
13
|
-
# require File.expand_path("../../job", __FILE__)
|
14
|
-
# BackupFoundation::Job.new(MultiJson.load(params[:params])).backup!
|
15
|
-
# end
|
16
|
-
|
17
7
|
desc 'Download and restore files from server'
|
18
8
|
task restore: :environment do
|
19
|
-
|
20
|
-
key: BackupFoundation.app_key,
|
21
|
-
dbs: BackupFoundation.databases,
|
22
|
-
encryption_key: BackupFoundation.encryption_key
|
23
|
-
job = BackupFoundation::Job.new(opts).restore!
|
9
|
+
BackupFoundation.restore_backup!
|
24
10
|
end
|
25
11
|
end
|
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
BackupFoundation.store_app "ENTER_YOUR_APP_KEY_HERE" do
|
4
4
|
backup_db
|
5
|
+
|
6
|
+
encrypt '<%= SecureRandom.hex %>'
|
5
7
|
# This key is uniq and was created for you by generator.
|
6
|
-
|
8
|
+
# It's strongly recommended to store encryption key in some secure place before using it.
|
9
|
+
# Otherwise you will lose ability to recover backups if you lose the key.
|
10
|
+
|
11
|
+
# backup_directory :uploads, 'public/uploads'
|
12
|
+
# backup_directory :logs, 'log'
|
13
|
+
# You can set there as many directories as you wish
|
7
14
|
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BackupFoundation do
|
4
|
+
describe '::store_app' do
|
5
|
+
it 'saves app key and encryption ket' do
|
6
|
+
BackupFoundation.store_app('asdf')
|
7
|
+
expect(BackupFoundation.app_key).to eq('asdf')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '::encrypt' do
|
12
|
+
it 'saves ecryption key' do
|
13
|
+
BackupFoundation.store_app('asdf') { encrypt 'qwer' }
|
14
|
+
expect(BackupFoundation.encryption_key).to eq('qwer')
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '::backup_db' do
|
19
|
+
it 'recognizes SQLite' do
|
20
|
+
Rails.env = ActiveSupport::StringInquirer.new('sqlite')
|
21
|
+
connect_active_record
|
22
|
+
BackupFoundation.store_app('asdf') { backup_db }
|
23
|
+
expect(BackupFoundation.items[0][:type]).to eq(:sqlite)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'recognizes PostgreSQL' do
|
27
|
+
Rails.env = ActiveSupport::StringInquirer.new('postgresql')
|
28
|
+
connect_active_record
|
29
|
+
BackupFoundation.store_app('asdf') { backup_db }
|
30
|
+
expect(BackupFoundation.items[0][:type]).to eq(:postgresql)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'recognizes MySQL' do
|
34
|
+
Rails.env = ActiveSupport::StringInquirer.new('mysql')
|
35
|
+
connect_active_record
|
36
|
+
BackupFoundation.store_app('asdf') { backup_db }
|
37
|
+
expect(BackupFoundation.items[0][:type]).to eq(:mysql)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe '::make_backup!'
|
42
|
+
describe '::restore_backup!'
|
43
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe BackupFoundation::Item::Base do
|
4
|
+
describe '#outfile_path' do
|
5
|
+
it 'sets the output file name for non-encrypted items' do
|
6
|
+
expect(BackupFoundation::Item::Base.new({ database: 'db' }, '/tmp').outfile_path).to eq('/tmp/db.gz')
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'sets the output file name for encrypted items' do
|
10
|
+
expect(BackupFoundation::Item::Base.new({ database: 'db' }, '/tmp', 'asdf').outfile_path).to eq('/tmp/db.gz.gpg')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'rails'
|
4
|
+
require 'active_record'
|
5
|
+
require 'pry'
|
6
|
+
|
7
|
+
require File.join(File.dirname(__FILE__),'support/helper')
|
8
|
+
require 'backup_foundation'
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
RSpec.configure do |c|
|
13
|
+
c.include Helper
|
14
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
sqlite:
|
2
|
+
adapter: sqlite3
|
3
|
+
pool: 5
|
4
|
+
timeout: 5000
|
5
|
+
database: './db.sqlite3'
|
6
|
+
|
7
|
+
postgresql:
|
8
|
+
adapter: postgresql
|
9
|
+
database: backup_foundation
|
10
|
+
pool: 100
|
11
|
+
timeout: 1000
|
12
|
+
username: postgres
|
13
|
+
password: postgres
|
14
|
+
host: 127.0.0.1
|
15
|
+
|
16
|
+
mysql:
|
17
|
+
adapter: mysql2
|
18
|
+
encoding: utf8
|
19
|
+
database: backup_foundation
|
20
|
+
pool: 5
|
21
|
+
username: postgres
|
22
|
+
password: postgres
|
23
|
+
socket: /var/run/mysqld/mysqld.sock
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backup_foundation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Shaydurov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: multipart-post
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,63 +39,35 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
|
-
type: :
|
48
|
+
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: bundler
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.6'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.6'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rspec
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - "
|
59
|
+
- - ">="
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - "
|
66
|
+
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: rspec-rails
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 2.5.0
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 2.5.0
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: mongo_mapper
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
100
72
|
requirements:
|
101
73
|
- - ">="
|
@@ -109,21 +81,21 @@ dependencies:
|
|
109
81
|
- !ruby/object:Gem::Version
|
110
82
|
version: '0'
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
84
|
+
name: sqlite3
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
114
86
|
requirements:
|
115
|
-
- - "
|
87
|
+
- - ">="
|
116
88
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
89
|
+
version: '0'
|
118
90
|
type: :development
|
119
91
|
prerelease: false
|
120
92
|
version_requirements: !ruby/object:Gem::Requirement
|
121
93
|
requirements:
|
122
|
-
- - "
|
94
|
+
- - ">="
|
123
95
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
96
|
+
version: '0'
|
125
97
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
98
|
+
name: mysql2
|
127
99
|
requirement: !ruby/object:Gem::Requirement
|
128
100
|
requirements:
|
129
101
|
- - ">="
|
@@ -137,7 +109,7 @@ dependencies:
|
|
137
109
|
- !ruby/object:Gem::Version
|
138
110
|
version: '0'
|
139
111
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
112
|
+
name: pg
|
141
113
|
requirement: !ruby/object:Gem::Requirement
|
142
114
|
requirements:
|
143
115
|
- - ">="
|
@@ -151,7 +123,7 @@ dependencies:
|
|
151
123
|
- !ruby/object:Gem::Version
|
152
124
|
version: '0'
|
153
125
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
126
|
+
name: activerecord
|
155
127
|
requirement: !ruby/object:Gem::Requirement
|
156
128
|
requirements:
|
157
129
|
- - ">="
|
@@ -165,7 +137,7 @@ dependencies:
|
|
165
137
|
- !ruby/object:Gem::Version
|
166
138
|
version: '0'
|
167
139
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
140
|
+
name: pry
|
169
141
|
requirement: !ruby/object:Gem::Requirement
|
170
142
|
requirements:
|
171
143
|
- - ">="
|
@@ -186,6 +158,7 @@ extensions: []
|
|
186
158
|
extra_rdoc_files: []
|
187
159
|
files:
|
188
160
|
- ".gitignore"
|
161
|
+
- ".rspec"
|
189
162
|
- Gemfile
|
190
163
|
- LICENSE.txt
|
191
164
|
- README.md
|
@@ -195,17 +168,23 @@ files:
|
|
195
168
|
- lib/backup_foundation/capistrano.rb
|
196
169
|
- lib/backup_foundation/capistrano/v2.rb
|
197
170
|
- lib/backup_foundation/capistrano/v3.rb
|
198
|
-
- lib/backup_foundation/
|
199
|
-
- lib/backup_foundation/
|
200
|
-
- lib/backup_foundation/
|
201
|
-
- lib/backup_foundation/
|
202
|
-
- lib/backup_foundation/
|
171
|
+
- lib/backup_foundation/item/base.rb
|
172
|
+
- lib/backup_foundation/item/directory.rb
|
173
|
+
- lib/backup_foundation/item/items.rb
|
174
|
+
- lib/backup_foundation/item/mysql.rb
|
175
|
+
- lib/backup_foundation/item/postgresql.rb
|
176
|
+
- lib/backup_foundation/item/sqlite.rb
|
203
177
|
- lib/backup_foundation/job.rb
|
204
178
|
- lib/backup_foundation/railtie.rb
|
205
179
|
- lib/backup_foundation/tasks/backup_foundation.rake
|
206
180
|
- lib/backup_foundation/version.rb
|
207
181
|
- lib/generators/backup_foundation/install_generator.rb
|
208
182
|
- lib/generators/backup_foundation/templates/initializer.rb
|
183
|
+
- spec/backup_foundation_spec.rb
|
184
|
+
- spec/db/base_spec.rb
|
185
|
+
- spec/spec_helper.rb
|
186
|
+
- spec/support/database.yml
|
187
|
+
- spec/support/helper.rb
|
209
188
|
homepage: https://backup.foundation
|
210
189
|
licenses:
|
211
190
|
- MIT
|
@@ -230,4 +209,9 @@ rubygems_version: 2.2.2
|
|
230
209
|
signing_key:
|
231
210
|
specification_version: 4
|
232
211
|
summary: A client for cloud backuping service Backup.Foundation
|
233
|
-
test_files:
|
212
|
+
test_files:
|
213
|
+
- spec/backup_foundation_spec.rb
|
214
|
+
- spec/db/base_spec.rb
|
215
|
+
- spec/spec_helper.rb
|
216
|
+
- spec/support/database.yml
|
217
|
+
- spec/support/helper.rb
|
@@ -1,14 +0,0 @@
|
|
1
|
-
module BackupFoundation
|
2
|
-
module DB
|
3
|
-
autoload :Base, 'backup_foundation/db/base'
|
4
|
-
autoload :MySQL, 'backup_foundation/db/mysql'
|
5
|
-
autoload :PostgreSQL, 'backup_foundation/db/postgresql'
|
6
|
-
autoload :SQLite, 'backup_foundation/db/sqlite'
|
7
|
-
|
8
|
-
DATABASES = {
|
9
|
-
mysql: BackupFoundation::DB::MySQL,
|
10
|
-
postgresql: BackupFoundation::DB::PostgreSQL,
|
11
|
-
sqlite: BackupFoundation::DB::SQLite
|
12
|
-
}
|
13
|
-
end
|
14
|
-
end
|