backup 3.0.20 → 3.0.21
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -5
- data/Gemfile.lock +46 -50
- data/README.md +54 -27
- data/lib/backup.rb +16 -39
- data/lib/backup/archive.rb +42 -18
- data/lib/backup/cleaner.rb +110 -25
- data/lib/backup/cli/helpers.rb +17 -32
- data/lib/backup/cli/utility.rb +46 -107
- data/lib/backup/compressor/base.rb +14 -2
- data/lib/backup/compressor/bzip2.rb +10 -24
- data/lib/backup/compressor/gzip.rb +10 -24
- data/lib/backup/compressor/lzma.rb +10 -23
- data/lib/backup/compressor/pbzip2.rb +12 -32
- data/lib/backup/config.rb +171 -0
- data/lib/backup/configuration/compressor/base.rb +1 -2
- data/lib/backup/configuration/compressor/pbzip2.rb +4 -4
- data/lib/backup/configuration/database/base.rb +2 -1
- data/lib/backup/configuration/database/mongodb.rb +8 -0
- data/lib/backup/configuration/database/mysql.rb +4 -0
- data/lib/backup/configuration/database/postgresql.rb +4 -0
- data/lib/backup/configuration/database/redis.rb +4 -0
- data/lib/backup/configuration/database/riak.rb +5 -1
- data/lib/backup/configuration/encryptor/base.rb +1 -2
- data/lib/backup/configuration/encryptor/open_ssl.rb +1 -1
- data/lib/backup/configuration/helpers.rb +7 -2
- data/lib/backup/configuration/notifier/base.rb +4 -28
- data/lib/backup/configuration/storage/base.rb +1 -1
- data/lib/backup/configuration/storage/dropbox.rb +14 -4
- data/lib/backup/configuration/syncer/base.rb +10 -0
- data/lib/backup/configuration/syncer/rsync/base.rb +28 -0
- data/lib/backup/configuration/syncer/rsync/local.rb +11 -0
- data/lib/backup/configuration/syncer/rsync/pull.rb +11 -0
- data/lib/backup/configuration/syncer/rsync/push.rb +31 -0
- data/lib/backup/configuration/syncer/s3.rb +0 -4
- data/lib/backup/database/base.rb +25 -7
- data/lib/backup/database/mongodb.rb +112 -75
- data/lib/backup/database/mysql.rb +54 -29
- data/lib/backup/database/postgresql.rb +60 -42
- data/lib/backup/database/redis.rb +61 -39
- data/lib/backup/database/riak.rb +35 -11
- data/lib/backup/dependency.rb +4 -5
- data/lib/backup/encryptor/base.rb +13 -1
- data/lib/backup/encryptor/gpg.rb +39 -39
- data/lib/backup/encryptor/open_ssl.rb +28 -38
- data/lib/backup/logger.rb +20 -11
- data/lib/backup/model.rb +206 -163
- data/lib/backup/notifier/base.rb +27 -25
- data/lib/backup/notifier/campfire.rb +7 -13
- data/lib/backup/notifier/hipchat.rb +28 -28
- data/lib/backup/notifier/mail.rb +24 -26
- data/lib/backup/notifier/presently.rb +10 -18
- data/lib/backup/notifier/prowl.rb +9 -17
- data/lib/backup/notifier/twitter.rb +11 -18
- data/lib/backup/package.rb +47 -0
- data/lib/backup/packager.rb +81 -16
- data/lib/backup/splitter.rb +48 -35
- data/lib/backup/storage/base.rb +44 -172
- data/lib/backup/storage/cloudfiles.rb +31 -46
- data/lib/backup/storage/cycler.rb +117 -0
- data/lib/backup/storage/dropbox.rb +92 -76
- data/lib/backup/storage/ftp.rb +30 -40
- data/lib/backup/storage/local.rb +44 -45
- data/lib/backup/storage/ninefold.rb +55 -49
- data/lib/backup/storage/rsync.rb +49 -56
- data/lib/backup/storage/s3.rb +33 -44
- data/lib/backup/storage/scp.rb +21 -48
- data/lib/backup/storage/sftp.rb +26 -40
- data/lib/backup/syncer/base.rb +7 -0
- data/lib/backup/syncer/rsync/base.rb +78 -0
- data/lib/backup/syncer/rsync/local.rb +53 -0
- data/lib/backup/syncer/rsync/pull.rb +38 -0
- data/lib/backup/syncer/rsync/push.rb +113 -0
- data/lib/backup/syncer/s3.rb +42 -32
- data/lib/backup/version.rb +1 -1
- data/spec/archive_spec.rb +235 -69
- data/spec/cleaner_spec.rb +304 -0
- data/spec/cli/helpers_spec.rb +142 -1
- data/spec/cli/utility_spec.rb +338 -13
- data/spec/compressor/base_spec.rb +31 -0
- data/spec/compressor/bzip2_spec.rb +60 -35
- data/spec/compressor/gzip_spec.rb +60 -35
- data/spec/compressor/lzma_spec.rb +60 -35
- data/spec/compressor/pbzip2_spec.rb +98 -37
- data/spec/config_spec.rb +321 -0
- data/spec/configuration/base_spec.rb +4 -4
- data/spec/configuration/compressor/bzip2_spec.rb +1 -0
- data/spec/configuration/compressor/gzip_spec.rb +1 -0
- data/spec/configuration/compressor/lzma_spec.rb +1 -0
- data/spec/configuration/compressor/pbzip2_spec.rb +32 -0
- data/spec/configuration/database/base_spec.rb +2 -1
- data/spec/configuration/database/mongodb_spec.rb +26 -16
- data/spec/configuration/database/mysql_spec.rb +4 -0
- data/spec/configuration/database/postgresql_spec.rb +4 -0
- data/spec/configuration/database/redis_spec.rb +4 -0
- data/spec/configuration/database/riak_spec.rb +4 -0
- data/spec/configuration/encryptor/gpg_spec.rb +1 -0
- data/spec/configuration/encryptor/open_ssl_spec.rb +1 -0
- data/spec/configuration/notifier/base_spec.rb +32 -0
- data/spec/configuration/notifier/campfire_spec.rb +1 -0
- data/spec/configuration/notifier/hipchat_spec.rb +1 -0
- data/spec/configuration/notifier/mail_spec.rb +1 -0
- data/spec/configuration/notifier/presently_spec.rb +1 -0
- data/spec/configuration/notifier/prowl_spec.rb +1 -0
- data/spec/configuration/notifier/twitter_spec.rb +1 -0
- data/spec/configuration/storage/cloudfiles_spec.rb +1 -0
- data/spec/configuration/storage/dropbox_spec.rb +4 -3
- data/spec/configuration/storage/ftp_spec.rb +1 -0
- data/spec/configuration/storage/local_spec.rb +1 -0
- data/spec/configuration/storage/ninefold_spec.rb +1 -0
- data/spec/configuration/storage/rsync_spec.rb +3 -1
- data/spec/configuration/storage/s3_spec.rb +1 -0
- data/spec/configuration/storage/scp_spec.rb +1 -0
- data/spec/configuration/storage/sftp_spec.rb +1 -0
- data/spec/configuration/syncer/rsync/base_spec.rb +33 -0
- data/spec/configuration/syncer/rsync/local_spec.rb +10 -0
- data/spec/configuration/syncer/rsync/pull_spec.rb +10 -0
- data/spec/configuration/syncer/{rsync_spec.rb → rsync/push_spec.rb} +12 -15
- data/spec/configuration/syncer/s3_spec.rb +2 -3
- data/spec/database/base_spec.rb +35 -20
- data/spec/database/mongodb_spec.rb +298 -119
- data/spec/database/mysql_spec.rb +147 -72
- data/spec/database/postgresql_spec.rb +155 -100
- data/spec/database/redis_spec.rb +200 -97
- data/spec/database/riak_spec.rb +82 -24
- data/spec/dependency_spec.rb +49 -0
- data/spec/encryptor/base_spec.rb +30 -0
- data/spec/encryptor/gpg_spec.rb +105 -28
- data/spec/encryptor/open_ssl_spec.rb +85 -114
- data/spec/logger_spec.rb +74 -8
- data/spec/model_spec.rb +528 -220
- data/spec/notifier/base_spec.rb +89 -0
- data/spec/notifier/campfire_spec.rb +147 -119
- data/spec/notifier/hipchat_spec.rb +140 -145
- data/spec/notifier/mail_spec.rb +190 -248
- data/spec/notifier/presently_spec.rb +147 -282
- data/spec/notifier/prowl_spec.rb +79 -111
- data/spec/notifier/twitter_spec.rb +87 -106
- data/spec/package_spec.rb +61 -0
- data/spec/packager_spec.rb +154 -0
- data/spec/spec_helper.rb +36 -13
- data/spec/splitter_spec.rb +90 -41
- data/spec/storage/base_spec.rb +95 -239
- data/spec/storage/cloudfiles_spec.rb +185 -75
- data/spec/storage/cycler_spec.rb +239 -0
- data/spec/storage/dropbox_spec.rb +318 -87
- data/spec/storage/ftp_spec.rb +165 -152
- data/spec/storage/local_spec.rb +206 -54
- data/spec/storage/ninefold_spec.rb +264 -128
- data/spec/storage/rsync_spec.rb +244 -163
- data/spec/storage/s3_spec.rb +175 -64
- data/spec/storage/scp_spec.rb +156 -150
- data/spec/storage/sftp_spec.rb +153 -135
- data/spec/syncer/base_spec.rb +22 -0
- data/spec/syncer/rsync/base_spec.rb +118 -0
- data/spec/syncer/rsync/local_spec.rb +121 -0
- data/spec/syncer/rsync/pull_spec.rb +90 -0
- data/spec/syncer/rsync/push_spec.rb +327 -0
- data/spec/syncer/s3_spec.rb +180 -91
- data/templates/cli/utility/config +1 -1
- data/templates/cli/utility/database/mongodb +4 -0
- data/templates/cli/utility/database/mysql +3 -0
- data/templates/cli/utility/database/postgresql +3 -0
- data/templates/cli/utility/database/redis +3 -0
- data/templates/cli/utility/database/riak +3 -0
- data/templates/cli/utility/storage/dropbox +4 -1
- data/templates/cli/utility/syncer/rsync_local +12 -0
- data/templates/cli/utility/syncer/{rsync → rsync_pull} +2 -2
- data/templates/cli/utility/syncer/rsync_push +17 -0
- data/templates/storage/dropbox/authorization_url.erb +1 -1
- metadata +42 -17
- data/lib/backup/configuration/syncer/rsync.rb +0 -45
- data/lib/backup/finder.rb +0 -87
- data/lib/backup/storage/object.rb +0 -47
- data/lib/backup/syncer/rsync.rb +0 -152
- data/spec/backup_spec.rb +0 -11
- data/spec/finder_spec.rb +0 -91
- data/spec/storage/object_spec.rb +0 -74
- data/spec/syncer/rsync_spec.rb +0 -195
@@ -20,16 +20,16 @@ describe Backup::Configuration::Helpers do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it 'should return the setters' do
|
23
|
-
Backup::Configuration::Base.setter_methods.count.should == 3
|
23
|
+
Backup::Configuration::Base.send(:setter_methods).count.should == 3
|
24
24
|
%w[rspec_method= rspec_test= rspec_mocha=].each do |method|
|
25
|
-
Backup::Configuration::Base.setter_methods.should include(method)
|
25
|
+
Backup::Configuration::Base.send(:setter_methods).should include(method)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
it 'should return the getters' do
|
30
|
-
Backup::Configuration::Base.getter_methods.count.should == 3
|
30
|
+
Backup::Configuration::Base.send(:getter_methods).count.should == 3
|
31
31
|
%w[rspec_method rspec_test rspec_mocha].each do |method|
|
32
|
-
Backup::Configuration::Base.getter_methods.should include(method)
|
32
|
+
Backup::Configuration::Base.send(:getter_methods).should include(method)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
@@ -9,6 +9,7 @@ describe Backup::Configuration::Compressor::Bzip2 do
|
|
9
9
|
compressor.fast = true
|
10
10
|
end
|
11
11
|
end
|
12
|
+
after { Backup::Configuration::Compressor::Bzip2.clear_defaults! }
|
12
13
|
|
13
14
|
it 'should set the default compressor configuration' do
|
14
15
|
compressor = Backup::Configuration::Compressor::Bzip2
|
@@ -9,6 +9,7 @@ describe Backup::Configuration::Compressor::Gzip do
|
|
9
9
|
compressor.fast = true
|
10
10
|
end
|
11
11
|
end
|
12
|
+
after { Backup::Configuration::Compressor::Gzip.clear_defaults! }
|
12
13
|
|
13
14
|
it 'should set the default compressor configuration' do
|
14
15
|
compressor = Backup::Configuration::Compressor::Gzip
|
@@ -9,6 +9,7 @@ describe Backup::Configuration::Compressor::Lzma do
|
|
9
9
|
compressor.fast = true
|
10
10
|
end
|
11
11
|
end
|
12
|
+
after { Backup::Configuration::Compressor::Lzma.clear_defaults! }
|
12
13
|
|
13
14
|
it 'should set the default compressor configuration' do
|
14
15
|
compressor = Backup::Configuration::Compressor::Lzma
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path('../../../spec_helper.rb', __FILE__)
|
4
|
+
|
5
|
+
describe Backup::Configuration::Compressor::Pbzip2 do
|
6
|
+
before do
|
7
|
+
Backup::Configuration::Compressor::Pbzip2.defaults do |compressor|
|
8
|
+
compressor.best = true
|
9
|
+
compressor.fast = true
|
10
|
+
compressor.processors = 2
|
11
|
+
end
|
12
|
+
end
|
13
|
+
after { Backup::Configuration::Compressor::Pbzip2.clear_defaults! }
|
14
|
+
|
15
|
+
it 'should set the default compressor configuration' do
|
16
|
+
compressor = Backup::Configuration::Compressor::Pbzip2
|
17
|
+
compressor.best.should == true
|
18
|
+
compressor.fast.should == true
|
19
|
+
compressor.processors.should == 2
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#clear_defaults!' do
|
23
|
+
it 'should clear all the defaults, resetting them to nil' do
|
24
|
+
Backup::Configuration::Compressor::Pbzip2.clear_defaults!
|
25
|
+
|
26
|
+
compressor = Backup::Configuration::Compressor::Pbzip2
|
27
|
+
compressor.best.should == nil
|
28
|
+
compressor.fast.should == nil
|
29
|
+
compressor.processors.should == nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -5,9 +5,10 @@ require File.expand_path('../../../spec_helper.rb', __FILE__)
|
|
5
5
|
describe Backup::Configuration::Database::Base do
|
6
6
|
before do
|
7
7
|
Backup::Configuration::Database::Base.defaults do |db|
|
8
|
-
db.utility_path = '/usr/bin/my_util'
|
8
|
+
db.utility_path = '/usr/bin/my_util' # deprecated
|
9
9
|
end
|
10
10
|
end
|
11
|
+
after { Backup::Configuration::Database::Base.clear_defaults! }
|
11
12
|
|
12
13
|
it 'should set the default Base configuration' do
|
13
14
|
db = Backup::Configuration::Database::Base
|
@@ -13,19 +13,26 @@ describe Backup::Configuration::Database::MongoDB do
|
|
13
13
|
db.only_collections = %w[my other tables]
|
14
14
|
db.additional_options = %w[my options]
|
15
15
|
db.ipv6 = true
|
16
|
+
db.mongodump_utility = '/path/to/mongodump'
|
17
|
+
db.mongo_utility = '/path/to/mongo'
|
18
|
+
db.lock = true
|
16
19
|
end
|
17
20
|
end
|
21
|
+
after { Backup::Configuration::Database::MongoDB.clear_defaults! }
|
18
22
|
|
19
23
|
it 'should set the default MongoDB configuration' do
|
20
24
|
db = Backup::Configuration::Database::MongoDB
|
21
|
-
db.name.should
|
22
|
-
db.username.should
|
23
|
-
db.password.should
|
24
|
-
db.host.should
|
25
|
-
db.port.should
|
26
|
-
db.only_collections.should
|
27
|
-
db.additional_options.should
|
28
|
-
db.ipv6.should
|
25
|
+
db.name.should == 'mydb'
|
26
|
+
db.username.should == 'myuser'
|
27
|
+
db.password.should == 'mypassword'
|
28
|
+
db.host.should == 'myhost'
|
29
|
+
db.port.should == 'myport'
|
30
|
+
db.only_collections.should == %w[my other tables]
|
31
|
+
db.additional_options.should == %w[my options]
|
32
|
+
db.ipv6.should == true
|
33
|
+
db.mongodump_utility.should == '/path/to/mongodump'
|
34
|
+
db.mongo_utility.should == '/path/to/mongo'
|
35
|
+
db.lock.should == true
|
29
36
|
end
|
30
37
|
|
31
38
|
describe '#clear_defaults!' do
|
@@ -33,14 +40,17 @@ describe Backup::Configuration::Database::MongoDB do
|
|
33
40
|
Backup::Configuration::Database::MongoDB.clear_defaults!
|
34
41
|
|
35
42
|
db = Backup::Configuration::Database::MongoDB
|
36
|
-
db.name.should
|
37
|
-
db.username.should
|
38
|
-
db.password.should
|
39
|
-
db.host.should
|
40
|
-
db.port.should
|
41
|
-
db.only_collections.should
|
42
|
-
db.additional_options.should
|
43
|
-
db.ipv6.should
|
43
|
+
db.name.should == nil
|
44
|
+
db.username.should == nil
|
45
|
+
db.password.should == nil
|
46
|
+
db.host.should == nil
|
47
|
+
db.port.should == nil
|
48
|
+
db.only_collections.should == nil
|
49
|
+
db.additional_options.should == nil
|
50
|
+
db.ipv6.should == nil
|
51
|
+
db.mongodump_utility.should == nil
|
52
|
+
db.mongo_utility.should == nil
|
53
|
+
db.lock.should == nil
|
44
54
|
end
|
45
55
|
end
|
46
56
|
end
|
@@ -14,8 +14,10 @@ describe Backup::Configuration::Database::MySQL do
|
|
14
14
|
db.skip_tables = %w[my tables]
|
15
15
|
db.only_tables = %w[my other tables]
|
16
16
|
db.additional_options = %w[my options]
|
17
|
+
db.mysqldump_utility = '/path/to/mysqldump'
|
17
18
|
end
|
18
19
|
end
|
20
|
+
after { Backup::Configuration::Database::MySQL.clear_defaults! }
|
19
21
|
|
20
22
|
it 'should set the default MySQL configuration' do
|
21
23
|
db = Backup::Configuration::Database::MySQL
|
@@ -28,6 +30,7 @@ describe Backup::Configuration::Database::MySQL do
|
|
28
30
|
db.skip_tables.should == %w[my tables]
|
29
31
|
db.only_tables.should == %w[my other tables]
|
30
32
|
db.additional_options.should == %w[my options]
|
33
|
+
db.mysqldump_utility.should == '/path/to/mysqldump'
|
31
34
|
end
|
32
35
|
|
33
36
|
describe '#clear_defaults!' do
|
@@ -44,6 +47,7 @@ describe Backup::Configuration::Database::MySQL do
|
|
44
47
|
db.skip_tables.should == nil
|
45
48
|
db.only_tables.should == nil
|
46
49
|
db.additional_options.should == nil
|
50
|
+
db.mysqldump_utility.should == nil
|
47
51
|
end
|
48
52
|
end
|
49
53
|
end
|
@@ -14,8 +14,10 @@ describe Backup::Configuration::Database::PostgreSQL do
|
|
14
14
|
db.skip_tables = %w[my tables]
|
15
15
|
db.only_tables = %w[my other tables]
|
16
16
|
db.additional_options = %w[my options]
|
17
|
+
db.pg_dump_utility = '/path/to/pg_dump'
|
17
18
|
end
|
18
19
|
end
|
20
|
+
after { Backup::Configuration::Database::PostgreSQL.clear_defaults! }
|
19
21
|
|
20
22
|
it 'should set the default PostgreSQL configuration' do
|
21
23
|
db = Backup::Configuration::Database::PostgreSQL
|
@@ -28,6 +30,7 @@ describe Backup::Configuration::Database::PostgreSQL do
|
|
28
30
|
db.skip_tables.should == %w[my tables]
|
29
31
|
db.only_tables.should == %w[my other tables]
|
30
32
|
db.additional_options.should == %w[my options]
|
33
|
+
db.pg_dump_utility.should == '/path/to/pg_dump'
|
31
34
|
end
|
32
35
|
|
33
36
|
describe '#clear_defaults!' do
|
@@ -44,6 +47,7 @@ describe Backup::Configuration::Database::PostgreSQL do
|
|
44
47
|
db.skip_tables.should == nil
|
45
48
|
db.only_tables.should == nil
|
46
49
|
db.additional_options.should == nil
|
50
|
+
db.pg_dump_utility.should == nil
|
47
51
|
end
|
48
52
|
end
|
49
53
|
end
|
@@ -13,8 +13,10 @@ describe Backup::Configuration::Database::Redis do
|
|
13
13
|
db.port = 123
|
14
14
|
db.socket = '/redis.sock'
|
15
15
|
db.additional_options = %w[my options]
|
16
|
+
db.redis_cli_utility = '/path/to/redis-cli'
|
16
17
|
end
|
17
18
|
end
|
19
|
+
after { Backup::Configuration::Database::Redis.clear_defaults! }
|
18
20
|
|
19
21
|
it 'should set the default Redis configuration' do
|
20
22
|
db = Backup::Configuration::Database::Redis
|
@@ -26,6 +28,7 @@ describe Backup::Configuration::Database::Redis do
|
|
26
28
|
db.port.should == 123
|
27
29
|
db.socket.should == '/redis.sock'
|
28
30
|
db.additional_options.should == %w[my options]
|
31
|
+
db.redis_cli_utility.should == '/path/to/redis-cli'
|
29
32
|
end
|
30
33
|
|
31
34
|
describe '#clear_defaults!' do
|
@@ -41,6 +44,7 @@ describe Backup::Configuration::Database::Redis do
|
|
41
44
|
db.port.should == nil
|
42
45
|
db.socket.should == nil
|
43
46
|
db.additional_options.should == nil
|
47
|
+
db.redis_cli_utility.should == nil
|
44
48
|
end
|
45
49
|
end
|
46
50
|
end
|
@@ -8,14 +8,17 @@ describe Backup::Configuration::Database::Riak do
|
|
8
8
|
db.name = 'mydb'
|
9
9
|
db.node = '/var/lib/redis/db'
|
10
10
|
db.cookie = 'mypassword'
|
11
|
+
db.riak_admin_utility = '/path/to/riak-admin'
|
11
12
|
end
|
12
13
|
end
|
14
|
+
after { Backup::Configuration::Database::Riak.clear_defaults! }
|
13
15
|
|
14
16
|
it 'should set the default Riak configuration' do
|
15
17
|
db = Backup::Configuration::Database::Riak
|
16
18
|
db.name.should == 'mydb'
|
17
19
|
db.node.should == '/var/lib/redis/db'
|
18
20
|
db.cookie.should == 'mypassword'
|
21
|
+
db.riak_admin_utility.should == '/path/to/riak-admin'
|
19
22
|
end
|
20
23
|
|
21
24
|
describe '#clear_defaults!' do
|
@@ -26,6 +29,7 @@ describe Backup::Configuration::Database::Riak do
|
|
26
29
|
db.name.should == nil
|
27
30
|
db.node.should == nil
|
28
31
|
db.cookie.should == nil
|
32
|
+
db.riak_admin_utility.should == nil
|
29
33
|
end
|
30
34
|
end
|
31
35
|
end
|
@@ -8,6 +8,7 @@ describe Backup::Configuration::Encryptor::GPG do
|
|
8
8
|
encryptor.key = 'my_key'
|
9
9
|
end
|
10
10
|
end
|
11
|
+
after { Backup::Configuration::Encryptor::GPG.clear_defaults! }
|
11
12
|
|
12
13
|
it 'should set the default encryptor configuration' do
|
13
14
|
encryptor = Backup::Configuration::Encryptor::GPG
|
@@ -11,6 +11,7 @@ describe Backup::Configuration::Encryptor::OpenSSL do
|
|
11
11
|
encryptor.salt = true
|
12
12
|
end
|
13
13
|
end
|
14
|
+
after { Backup::Configuration::Encryptor::OpenSSL.clear_defaults! }
|
14
15
|
|
15
16
|
it 'should set the default encryptor configuration' do
|
16
17
|
encryptor = Backup::Configuration::Encryptor::OpenSSL
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.expand_path('../../../spec_helper.rb', __FILE__)
|
4
|
+
|
5
|
+
describe Backup::Configuration::Notifier::Base do
|
6
|
+
before do
|
7
|
+
Backup::Configuration::Notifier::Base.defaults do |base|
|
8
|
+
base.on_success = 'on_success'
|
9
|
+
base.on_warning = 'on_warning'
|
10
|
+
base.on_failure = 'on_failure'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
after { Backup::Configuration::Notifier::Base.clear_defaults! }
|
14
|
+
|
15
|
+
it 'should set the default campfire configuration' do
|
16
|
+
base = Backup::Configuration::Notifier::Base
|
17
|
+
base.on_success.should == 'on_success'
|
18
|
+
base.on_warning.should == 'on_warning'
|
19
|
+
base.on_failure.should == 'on_failure'
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#clear_defaults!' do
|
23
|
+
it 'should clear all the defaults, resetting them to nil' do
|
24
|
+
Backup::Configuration::Notifier::Base.clear_defaults!
|
25
|
+
|
26
|
+
base = Backup::Configuration::Notifier::Base
|
27
|
+
base.on_success.should be_nil
|
28
|
+
base.on_warning.should be_nil
|
29
|
+
base.on_failure.should be_nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -10,6 +10,7 @@ describe Backup::Configuration::Notifier::Campfire do
|
|
10
10
|
campfire.room_id = 'my_room_id'
|
11
11
|
end
|
12
12
|
end
|
13
|
+
after { Backup::Configuration::Notifier::Campfire.clear_defaults! }
|
13
14
|
|
14
15
|
it 'should set the default campfire configuration' do
|
15
16
|
campfire = Backup::Configuration::Notifier::Campfire
|
@@ -14,6 +14,7 @@ describe Backup::Configuration::Notifier::Hipchat do
|
|
14
14
|
hipchat.notify_users = true
|
15
15
|
end
|
16
16
|
end
|
17
|
+
after { Backup::Configuration::Notifier::Hipchat.clear_defaults! }
|
17
18
|
|
18
19
|
it 'should set the default tweet configuration' do
|
19
20
|
hipchat = Backup::Configuration::Notifier::Hipchat
|
@@ -21,6 +21,7 @@ describe Backup::Configuration::Notifier::Mail do
|
|
21
21
|
mail.mail_folder = '/path/to/backup/mails'
|
22
22
|
end
|
23
23
|
end
|
24
|
+
after { Backup::Configuration::Notifier::Mail.clear_defaults! }
|
24
25
|
|
25
26
|
it 'should set the default Mail configuration' do
|
26
27
|
mail = Backup::Configuration::Notifier::Mail
|
@@ -11,6 +11,7 @@ describe Backup::Configuration::Notifier::Presently do
|
|
11
11
|
presently.group_id = 'my_group_id'
|
12
12
|
end
|
13
13
|
end
|
14
|
+
after { Backup::Configuration::Notifier::Presently.clear_defaults! }
|
14
15
|
|
15
16
|
it 'should set the default tweet configuration' do
|
16
17
|
presently = Backup::Configuration::Notifier::Presently
|
@@ -9,6 +9,7 @@ describe Backup::Configuration::Notifier::Prowl do
|
|
9
9
|
prowl.api_key = 'my_api_key'
|
10
10
|
end
|
11
11
|
end
|
12
|
+
after { Backup::Configuration::Notifier::Prowl.clear_defaults! }
|
12
13
|
|
13
14
|
it 'should set the default tweet configuration' do
|
14
15
|
prowl = Backup::Configuration::Notifier::Prowl
|
@@ -11,6 +11,7 @@ describe Backup::Configuration::Notifier::Twitter do
|
|
11
11
|
tweet.oauth_token_secret = 'my_oauth_token_secret'
|
12
12
|
end
|
13
13
|
end
|
14
|
+
after { Backup::Configuration::Notifier::Twitter.clear_defaults! }
|
14
15
|
|
15
16
|
it 'should set the default tweet configuration' do
|
16
17
|
tweet = Backup::Configuration::Notifier::Twitter
|
@@ -13,6 +13,7 @@ describe Backup::Configuration::Storage::CloudFiles do
|
|
13
13
|
cf.servicenet = true
|
14
14
|
end
|
15
15
|
end
|
16
|
+
after { Backup::Configuration::Storage::CloudFiles.clear_defaults! }
|
16
17
|
|
17
18
|
it 'should set the default Cloud Files configuration' do
|
18
19
|
cf = Backup::Configuration::Storage::CloudFiles
|
@@ -7,19 +7,20 @@ describe Backup::Configuration::Storage::Dropbox do
|
|
7
7
|
Backup::Configuration::Storage::Dropbox.defaults do |db|
|
8
8
|
db.api_key = 'my_api_key'
|
9
9
|
db.api_secret = 'my_secret'
|
10
|
+
db.access_type = 'my_access_type'
|
10
11
|
db.path = 'my_backups'
|
11
12
|
db.keep = 20
|
12
|
-
db.timeout = 500
|
13
13
|
end
|
14
14
|
end
|
15
|
+
after { Backup::Configuration::Storage::Dropbox.clear_defaults! }
|
15
16
|
|
16
17
|
it 'should set the default Dropbox configuration' do
|
17
18
|
db = Backup::Configuration::Storage::Dropbox
|
18
19
|
db.api_key.should == 'my_api_key'
|
19
20
|
db.api_secret.should == 'my_secret'
|
21
|
+
db.access_type.should == 'my_access_type'
|
20
22
|
db.path.should == 'my_backups'
|
21
23
|
db.keep.should == 20
|
22
|
-
db.timeout.should == 500
|
23
24
|
end
|
24
25
|
|
25
26
|
describe '#clear_defaults!' do
|
@@ -29,9 +30,9 @@ describe Backup::Configuration::Storage::Dropbox do
|
|
29
30
|
db = Backup::Configuration::Storage::Dropbox
|
30
31
|
db.api_key.should == nil
|
31
32
|
db.api_secret.should == nil
|
33
|
+
db.access_type.should == nil
|
32
34
|
db.path.should == nil
|
33
35
|
db.keep.should == nil
|
34
|
-
db.timeout.should == nil
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
@@ -10,6 +10,7 @@ describe Backup::Configuration::Storage::Ninefold do
|
|
10
10
|
nf.path = 'my_backups'
|
11
11
|
end
|
12
12
|
end
|
13
|
+
after { Backup::Configuration::Storage::Ninefold.clear_defaults! }
|
13
14
|
|
14
15
|
it 'should set the default Ninefold configuration' do
|
15
16
|
ninefold = Backup::Configuration::Storage::Ninefold
|
@@ -10,8 +10,10 @@ describe Backup::Configuration::Storage::RSync do
|
|
10
10
|
rsync.ip = '123.45.678.90'
|
11
11
|
rsync.port = 21
|
12
12
|
rsync.path = 'my_backups'
|
13
|
+
rsync.local = true
|
13
14
|
end
|
14
15
|
end
|
16
|
+
after { Backup::Configuration::Storage::RSync.clear_defaults! }
|
15
17
|
|
16
18
|
it 'should set the default rsync configuration' do
|
17
19
|
rsync = Backup::Configuration::Storage::RSync
|
@@ -20,7 +22,7 @@ describe Backup::Configuration::Storage::RSync do
|
|
20
22
|
rsync.ip.should == '123.45.678.90'
|
21
23
|
rsync.port.should == 21
|
22
24
|
rsync.path.should == 'my_backups'
|
23
|
-
rsync.local.should ==
|
25
|
+
rsync.local.should == true
|
24
26
|
end
|
25
27
|
|
26
28
|
describe '#clear_defaults!' do
|