backup 3.0.23 → 3.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +42 -45
- data/Guardfile +7 -4
- data/README.md +10 -7
- data/backup.gemspec +2 -2
- data/lib/backup.rb +27 -97
- data/lib/backup/archive.rb +14 -6
- data/lib/backup/cli/helpers.rb +52 -49
- data/lib/backup/cli/utility.rb +9 -1
- data/lib/backup/compressor/base.rb +10 -4
- data/lib/backup/compressor/bzip2.rb +22 -26
- data/lib/backup/compressor/custom.rb +53 -0
- data/lib/backup/compressor/gzip.rb +22 -23
- data/lib/backup/compressor/lzma.rb +15 -13
- data/lib/backup/compressor/pbzip2.rb +20 -17
- data/lib/backup/config.rb +6 -3
- data/lib/backup/configuration.rb +33 -0
- data/lib/backup/configuration/helpers.rb +114 -28
- data/lib/backup/configuration/store.rb +24 -0
- data/lib/backup/database/base.rb +0 -6
- data/lib/backup/database/mongodb.rb +27 -11
- data/lib/backup/database/mysql.rb +19 -14
- data/lib/backup/database/postgresql.rb +16 -11
- data/lib/backup/database/redis.rb +7 -11
- data/lib/backup/database/riak.rb +3 -6
- data/lib/backup/dependency.rb +5 -11
- data/lib/backup/model.rb +14 -5
- data/lib/backup/notifier/campfire.rb +3 -16
- data/lib/backup/notifier/hipchat.rb +1 -7
- data/lib/backup/notifier/mail.rb +1 -1
- data/lib/backup/packager.rb +29 -19
- data/lib/backup/pipeline.rb +110 -0
- data/lib/backup/storage/dropbox.rb +4 -7
- data/lib/backup/syncer/base.rb +8 -4
- data/lib/backup/syncer/cloud/base.rb +247 -0
- data/lib/backup/syncer/cloud/cloud_files.rb +78 -0
- data/lib/backup/syncer/cloud/s3.rb +68 -0
- data/lib/backup/syncer/rsync/base.rb +1 -4
- data/lib/backup/syncer/rsync/local.rb +9 -5
- data/lib/backup/syncer/rsync/pull.rb +1 -1
- data/lib/backup/syncer/rsync/push.rb +10 -5
- data/lib/backup/version.rb +1 -1
- data/spec-live/.gitignore +6 -0
- data/spec-live/README +7 -0
- data/spec-live/backups/config.rb +153 -0
- data/spec-live/backups/config.yml.template +43 -0
- data/spec-live/compressor/custom_spec.rb +30 -0
- data/spec-live/compressor/gzip_spec.rb +30 -0
- data/spec-live/notifier/mail_spec.rb +85 -0
- data/spec-live/spec_helper.rb +85 -0
- data/spec-live/storage/dropbox_spec.rb +151 -0
- data/spec-live/storage/local_spec.rb +83 -0
- data/spec-live/storage/scp_spec.rb +193 -0
- data/spec-live/syncer/cloud/s3_spec.rb +124 -0
- data/spec/archive_spec.rb +86 -31
- data/spec/cleaner_spec.rb +8 -0
- data/spec/cli/helpers_spec.rb +200 -75
- data/spec/cli/utility_spec.rb +11 -3
- data/spec/compressor/base_spec.rb +31 -10
- data/spec/compressor/bzip2_spec.rb +212 -57
- data/spec/compressor/custom_spec.rb +106 -0
- data/spec/compressor/gzip_spec.rb +212 -57
- data/spec/compressor/lzma_spec.rb +75 -35
- data/spec/compressor/pbzip2_spec.rb +93 -52
- data/spec/configuration/helpers_spec.rb +406 -0
- data/spec/configuration/store_spec.rb +39 -0
- data/spec/configuration_spec.rb +62 -0
- data/spec/database/base_spec.rb +19 -10
- data/spec/database/mongodb_spec.rb +195 -70
- data/spec/database/mysql_spec.rb +183 -64
- data/spec/database/postgresql_spec.rb +167 -53
- data/spec/database/redis_spec.rb +121 -46
- data/spec/database/riak_spec.rb +96 -27
- data/spec/dependency_spec.rb +2 -0
- data/spec/encryptor/base_spec.rb +10 -0
- data/spec/encryptor/gpg_spec.rb +29 -13
- data/spec/encryptor/open_ssl_spec.rb +40 -21
- data/spec/logger_spec.rb +4 -0
- data/spec/model_spec.rb +19 -2
- data/spec/notifier/base_spec.rb +32 -17
- data/spec/notifier/campfire_spec.rb +63 -45
- data/spec/notifier/hipchat_spec.rb +79 -56
- data/spec/notifier/mail_spec.rb +82 -46
- data/spec/notifier/prowl_spec.rb +53 -32
- data/spec/notifier/twitter_spec.rb +62 -41
- data/spec/packager_spec.rb +95 -36
- data/spec/pipeline_spec.rb +259 -0
- data/spec/spec_helper.rb +6 -5
- data/spec/storage/base_spec.rb +61 -41
- data/spec/storage/cloudfiles_spec.rb +69 -45
- data/spec/storage/dropbox_spec.rb +158 -36
- data/spec/storage/ftp_spec.rb +69 -45
- data/spec/storage/local_spec.rb +47 -23
- data/spec/storage/ninefold_spec.rb +55 -31
- data/spec/storage/rsync_spec.rb +67 -50
- data/spec/storage/s3_spec.rb +65 -41
- data/spec/storage/scp_spec.rb +65 -41
- data/spec/storage/sftp_spec.rb +65 -41
- data/spec/syncer/base_spec.rb +91 -4
- data/spec/syncer/cloud/base_spec.rb +511 -0
- data/spec/syncer/cloud/cloud_files_spec.rb +181 -0
- data/spec/syncer/cloud/s3_spec.rb +174 -0
- data/spec/syncer/rsync/base_spec.rb +46 -66
- data/spec/syncer/rsync/local_spec.rb +55 -26
- data/spec/syncer/rsync/pull_spec.rb +15 -4
- data/spec/syncer/rsync/push_spec.rb +59 -52
- data/templates/cli/utility/compressor/bzip2 +1 -4
- data/templates/cli/utility/compressor/custom +11 -0
- data/templates/cli/utility/compressor/gzip +1 -4
- data/templates/cli/utility/compressor/lzma +3 -0
- data/templates/cli/utility/compressor/pbzip2 +3 -0
- data/templates/cli/utility/database/mysql +4 -1
- data/templates/cli/utility/syncer/cloud_files +17 -19
- data/templates/cli/utility/syncer/s3 +18 -20
- metadata +38 -92
- data/lib/backup/configuration/base.rb +0 -15
- data/lib/backup/configuration/compressor/base.rb +0 -9
- data/lib/backup/configuration/compressor/bzip2.rb +0 -23
- data/lib/backup/configuration/compressor/gzip.rb +0 -23
- data/lib/backup/configuration/compressor/lzma.rb +0 -23
- data/lib/backup/configuration/compressor/pbzip2.rb +0 -28
- data/lib/backup/configuration/database/base.rb +0 -19
- data/lib/backup/configuration/database/mongodb.rb +0 -49
- data/lib/backup/configuration/database/mysql.rb +0 -42
- data/lib/backup/configuration/database/postgresql.rb +0 -41
- data/lib/backup/configuration/database/redis.rb +0 -39
- data/lib/backup/configuration/database/riak.rb +0 -29
- data/lib/backup/configuration/encryptor/base.rb +0 -9
- data/lib/backup/configuration/encryptor/gpg.rb +0 -17
- data/lib/backup/configuration/encryptor/open_ssl.rb +0 -32
- data/lib/backup/configuration/notifier/base.rb +0 -28
- data/lib/backup/configuration/notifier/campfire.rb +0 -25
- data/lib/backup/configuration/notifier/hipchat.rb +0 -41
- data/lib/backup/configuration/notifier/mail.rb +0 -112
- data/lib/backup/configuration/notifier/presently.rb +0 -25
- data/lib/backup/configuration/notifier/prowl.rb +0 -23
- data/lib/backup/configuration/notifier/twitter.rb +0 -21
- data/lib/backup/configuration/storage/base.rb +0 -18
- data/lib/backup/configuration/storage/cloudfiles.rb +0 -25
- data/lib/backup/configuration/storage/dropbox.rb +0 -58
- data/lib/backup/configuration/storage/ftp.rb +0 -29
- data/lib/backup/configuration/storage/local.rb +0 -17
- data/lib/backup/configuration/storage/ninefold.rb +0 -20
- data/lib/backup/configuration/storage/rsync.rb +0 -29
- data/lib/backup/configuration/storage/s3.rb +0 -25
- data/lib/backup/configuration/storage/scp.rb +0 -25
- data/lib/backup/configuration/storage/sftp.rb +0 -25
- data/lib/backup/configuration/syncer/base.rb +0 -10
- data/lib/backup/configuration/syncer/cloud.rb +0 -23
- data/lib/backup/configuration/syncer/cloud_files.rb +0 -30
- data/lib/backup/configuration/syncer/rsync/base.rb +0 -28
- data/lib/backup/configuration/syncer/rsync/local.rb +0 -11
- data/lib/backup/configuration/syncer/rsync/pull.rb +0 -11
- data/lib/backup/configuration/syncer/rsync/push.rb +0 -31
- data/lib/backup/configuration/syncer/s3.rb +0 -23
- data/lib/backup/notifier/presently.rb +0 -88
- data/lib/backup/syncer/cloud.rb +0 -187
- data/lib/backup/syncer/cloud_files.rb +0 -56
- data/lib/backup/syncer/s3.rb +0 -47
- data/spec/configuration/base_spec.rb +0 -35
- data/spec/configuration/compressor/bzip2_spec.rb +0 -29
- data/spec/configuration/compressor/gzip_spec.rb +0 -29
- data/spec/configuration/compressor/lzma_spec.rb +0 -29
- data/spec/configuration/compressor/pbzip2_spec.rb +0 -32
- data/spec/configuration/database/base_spec.rb +0 -17
- data/spec/configuration/database/mongodb_spec.rb +0 -56
- data/spec/configuration/database/mysql_spec.rb +0 -53
- data/spec/configuration/database/postgresql_spec.rb +0 -53
- data/spec/configuration/database/redis_spec.rb +0 -50
- data/spec/configuration/database/riak_spec.rb +0 -35
- data/spec/configuration/encryptor/gpg_spec.rb +0 -26
- data/spec/configuration/encryptor/open_ssl_spec.rb +0 -35
- data/spec/configuration/notifier/base_spec.rb +0 -32
- data/spec/configuration/notifier/campfire_spec.rb +0 -32
- data/spec/configuration/notifier/hipchat_spec.rb +0 -44
- data/spec/configuration/notifier/mail_spec.rb +0 -71
- data/spec/configuration/notifier/presently_spec.rb +0 -35
- data/spec/configuration/notifier/prowl_spec.rb +0 -29
- data/spec/configuration/notifier/twitter_spec.rb +0 -35
- data/spec/configuration/storage/cloudfiles_spec.rb +0 -41
- data/spec/configuration/storage/dropbox_spec.rb +0 -38
- data/spec/configuration/storage/ftp_spec.rb +0 -44
- data/spec/configuration/storage/local_spec.rb +0 -29
- data/spec/configuration/storage/ninefold_spec.rb +0 -32
- data/spec/configuration/storage/rsync_spec.rb +0 -41
- data/spec/configuration/storage/s3_spec.rb +0 -38
- data/spec/configuration/storage/scp_spec.rb +0 -41
- data/spec/configuration/storage/sftp_spec.rb +0 -41
- data/spec/configuration/syncer/cloud_files_spec.rb +0 -44
- data/spec/configuration/syncer/rsync/base_spec.rb +0 -33
- data/spec/configuration/syncer/rsync/local_spec.rb +0 -10
- data/spec/configuration/syncer/rsync/pull_spec.rb +0 -10
- data/spec/configuration/syncer/rsync/push_spec.rb +0 -43
- data/spec/configuration/syncer/s3_spec.rb +0 -38
- data/spec/notifier/presently_spec.rb +0 -181
- data/spec/syncer/cloud_files_spec.rb +0 -192
- data/spec/syncer/s3_spec.rb +0 -192
- data/templates/cli/utility/notifier/presently +0 -13
|
@@ -5,53 +5,82 @@ require File.expand_path('../../../spec_helper.rb', __FILE__)
|
|
|
5
5
|
describe Backup::Syncer::RSync::Local do
|
|
6
6
|
let(:syncer) do
|
|
7
7
|
Backup::Syncer::RSync::Local.new do |rsync|
|
|
8
|
-
rsync.path
|
|
8
|
+
rsync.path = "~/my_backups"
|
|
9
|
+
rsync.mirror = true
|
|
10
|
+
rsync.additional_options = ['--opt-a', '--opt-b']
|
|
9
11
|
|
|
10
12
|
rsync.directories do |directory|
|
|
11
13
|
directory.add "/some/directory"
|
|
12
14
|
directory.add "~/home/directory"
|
|
13
15
|
end
|
|
14
|
-
|
|
15
|
-
rsync.mirror = true
|
|
16
|
-
rsync.additional_options = ['--opt-a', '--opt-b']
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
18
|
|
|
20
|
-
it 'should be a subclass of RSync::Base' do
|
|
21
|
-
Backup::Syncer::RSync::Local.
|
|
19
|
+
it 'should be a subclass of Syncer::RSync::Base' do
|
|
20
|
+
Backup::Syncer::RSync::Local.
|
|
21
|
+
superclass.should == Backup::Syncer::RSync::Base
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
describe '#initialize' do
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
syncer
|
|
25
|
+
after { Backup::Syncer::RSync::Local.clear_defaults! }
|
|
26
|
+
|
|
27
|
+
it 'should load pre-configured defaults through Syncer::Base' do
|
|
28
|
+
Backup::Syncer::RSync::Local.any_instance.expects(:load_defaults!)
|
|
29
|
+
syncer
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
context 'when
|
|
33
|
-
|
|
32
|
+
context 'when no pre-configured defaults have been set' do
|
|
33
|
+
it 'should use the values given' do
|
|
34
|
+
syncer.path.should == '~/my_backups'
|
|
35
|
+
syncer.mirror.should == true
|
|
36
|
+
syncer.directories.should == ["/some/directory", "~/home/directory"]
|
|
37
|
+
syncer.additional_options.should == ['--opt-a', '--opt-b']
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'should use default values if none are given' do
|
|
41
|
+
syncer = Backup::Syncer::RSync::Local.new
|
|
42
|
+
|
|
43
|
+
# from Syncer::Base
|
|
44
|
+
syncer.path.should == 'backups'
|
|
45
|
+
syncer.mirror.should == false
|
|
46
|
+
syncer.directories.should == []
|
|
34
47
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
# from Syncer::RSync::Base
|
|
49
|
+
syncer.additional_options.should == []
|
|
50
|
+
end
|
|
51
|
+
end # context 'when no pre-configured defaults have been set'
|
|
52
|
+
|
|
53
|
+
context 'when pre-configured defaults have been set' do
|
|
54
|
+
before do
|
|
55
|
+
Backup::Syncer::RSync::Local.defaults do |rsync|
|
|
56
|
+
rsync.path = 'some_path'
|
|
57
|
+
rsync.mirror = 'some_mirror'
|
|
58
|
+
rsync.additional_options = 'some_additional_options'
|
|
41
59
|
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'should use pre-configured defaults' do
|
|
63
|
+
syncer = Backup::Syncer::RSync::Local.new
|
|
64
|
+
|
|
65
|
+
syncer.path.should == 'some_path'
|
|
66
|
+
syncer.mirror.should == 'some_mirror'
|
|
67
|
+
syncer.directories.should == []
|
|
68
|
+
syncer.additional_options.should == 'some_additional_options'
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it 'should override pre-configured defaults' do
|
|
42
72
|
syncer = Backup::Syncer::RSync::Local.new do |rsync|
|
|
43
|
-
rsync.path
|
|
44
|
-
rsync.
|
|
45
|
-
rsync.mirror = 'new_mirror'
|
|
73
|
+
rsync.path = 'new_path'
|
|
74
|
+
rsync.mirror = 'new_mirror'
|
|
46
75
|
rsync.additional_options = 'new_additional_options'
|
|
47
76
|
end
|
|
48
77
|
|
|
49
|
-
syncer.path.should
|
|
50
|
-
syncer.
|
|
51
|
-
syncer.
|
|
78
|
+
syncer.path.should == 'new_path'
|
|
79
|
+
syncer.mirror.should == 'new_mirror'
|
|
80
|
+
syncer.directories.should == []
|
|
52
81
|
syncer.additional_options.should == 'new_additional_options'
|
|
53
82
|
end
|
|
54
|
-
end # context 'when
|
|
83
|
+
end # context 'when pre-configured defaults have been set'
|
|
55
84
|
end # describe '#initialize'
|
|
56
85
|
|
|
57
86
|
describe '#perform!' do
|
|
@@ -15,6 +15,7 @@ describe Backup::Syncer::RSync::Pull do
|
|
|
15
15
|
rsync.directories do |directory|
|
|
16
16
|
directory.add "/some/directory"
|
|
17
17
|
directory.add "~/home/directory"
|
|
18
|
+
directory.add "another/directory"
|
|
18
19
|
end
|
|
19
20
|
|
|
20
21
|
rsync.mirror = true
|
|
@@ -30,12 +31,12 @@ describe Backup::Syncer::RSync::Pull do
|
|
|
30
31
|
let(:s) { sequence '' }
|
|
31
32
|
|
|
32
33
|
it 'should perform the RSync::Pull operation on two directories' do
|
|
33
|
-
syncer.expects(:utility).
|
|
34
|
-
syncer.expects(:options).
|
|
34
|
+
syncer.expects(:utility).times(3).with(:rsync).returns('rsync')
|
|
35
|
+
syncer.expects(:options).times(3).returns('options_output')
|
|
35
36
|
|
|
36
37
|
syncer.expects(:write_password_file!).in_sequence(s)
|
|
37
38
|
|
|
38
|
-
# first directory
|
|
39
|
+
# first directory - uses the given full path
|
|
39
40
|
Backup::Logger.expects(:message).in_sequence(s).with(
|
|
40
41
|
"Syncer::RSync::Pull started syncing '/some/directory'."
|
|
41
42
|
)
|
|
@@ -45,7 +46,7 @@ describe Backup::Syncer::RSync::Pull do
|
|
|
45
46
|
).returns('messages from stdout')
|
|
46
47
|
Backup::Logger.expects(:silent).in_sequence(s).with('messages from stdout')
|
|
47
48
|
|
|
48
|
-
# second directory
|
|
49
|
+
# second directory - removes leading '~'
|
|
49
50
|
Backup::Logger.expects(:message).in_sequence(s).with(
|
|
50
51
|
"Syncer::RSync::Pull started syncing '~/home/directory'."
|
|
51
52
|
)
|
|
@@ -55,6 +56,16 @@ describe Backup::Syncer::RSync::Pull do
|
|
|
55
56
|
).returns('messages from stdout')
|
|
56
57
|
Backup::Logger.expects(:silent).in_sequence(s).with('messages from stdout')
|
|
57
58
|
|
|
59
|
+
# third directory - does not expand path
|
|
60
|
+
Backup::Logger.expects(:message).in_sequence(s).with(
|
|
61
|
+
"Syncer::RSync::Pull started syncing 'another/directory'."
|
|
62
|
+
)
|
|
63
|
+
syncer.expects(:run).in_sequence(s).with(
|
|
64
|
+
"rsync options_output 'my_username@123.45.678.90:another/directory' " +
|
|
65
|
+
"'#{ File.expand_path('~/my_backups') }'"
|
|
66
|
+
).returns('messages from stdout')
|
|
67
|
+
Backup::Logger.expects(:silent).in_sequence(s).with('messages from stdout')
|
|
68
|
+
|
|
58
69
|
syncer.expects(:remove_password_file!).in_sequence(s)
|
|
59
70
|
|
|
60
71
|
syncer.perform!
|
|
@@ -22,100 +22,107 @@ describe Backup::Syncer::RSync::Push do
|
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
it 'should be a subclass of RSync::Base' do
|
|
26
|
-
Backup::Syncer::RSync::Push.
|
|
25
|
+
it 'should be a subclass of Syncer::RSync::Base' do
|
|
26
|
+
Backup::Syncer::RSync::Push.
|
|
27
|
+
superclass.should == Backup::Syncer::RSync::Base
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
describe '#initialize' do
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
syncer
|
|
35
|
-
syncer.compress.should == true
|
|
36
|
-
syncer.path.should == '~/my_backups'
|
|
37
|
-
syncer.directories.should == ["/some/directory", "~/home/directory"]
|
|
38
|
-
syncer.mirror.should == true
|
|
39
|
-
syncer.additional_options.should == ['--opt-a', '--opt-b']
|
|
31
|
+
after { Backup::Syncer::RSync::Push.clear_defaults! }
|
|
32
|
+
|
|
33
|
+
it 'should load pre-configured defaults through Syncer::Base' do
|
|
34
|
+
Backup::Syncer::RSync::Push.any_instance.expects(:load_defaults!)
|
|
35
|
+
syncer
|
|
40
36
|
end
|
|
41
37
|
|
|
42
|
-
context 'when
|
|
43
|
-
it 'should use
|
|
38
|
+
context 'when no pre-configured defaults have been set' do
|
|
39
|
+
it 'should use the values given' do
|
|
40
|
+
syncer.path.should == '~/my_backups'
|
|
41
|
+
syncer.mirror.should == true
|
|
42
|
+
syncer.directories.should == ["/some/directory", "~/home/directory"]
|
|
43
|
+
syncer.additional_options.should == ['--opt-a', '--opt-b']
|
|
44
|
+
|
|
45
|
+
syncer.username.should == 'my_username'
|
|
46
|
+
syncer.password.should == 'my_password'
|
|
47
|
+
syncer.ip.should == '123.45.678.90'
|
|
48
|
+
syncer.port.should == 22
|
|
49
|
+
syncer.compress.should == true
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'should use default values if none are given' do
|
|
44
53
|
syncer = Backup::Syncer::RSync::Push.new
|
|
54
|
+
|
|
55
|
+
# from Syncer::Base
|
|
56
|
+
syncer.path.should == 'backups'
|
|
57
|
+
syncer.mirror.should == false
|
|
58
|
+
syncer.directories.should == []
|
|
59
|
+
|
|
60
|
+
# from Syncer::RSync::Base
|
|
61
|
+
syncer.additional_options.should == []
|
|
62
|
+
|
|
45
63
|
syncer.username.should == nil
|
|
46
64
|
syncer.password.should == nil
|
|
47
65
|
syncer.ip.should == nil
|
|
48
66
|
syncer.port.should == 22
|
|
49
67
|
syncer.compress.should == false
|
|
50
|
-
syncer.path.should == 'backups'
|
|
51
|
-
syncer.directories.should == []
|
|
52
|
-
syncer.mirror.should == false
|
|
53
|
-
syncer.additional_options.should == []
|
|
54
68
|
end
|
|
55
|
-
end
|
|
69
|
+
end # context 'when no pre-configured defaults have been set'
|
|
56
70
|
|
|
57
|
-
context 'when
|
|
58
|
-
|
|
71
|
+
context 'when pre-configured defaults have been set' do
|
|
72
|
+
before do
|
|
73
|
+
Backup::Syncer::RSync::Push.defaults do |rsync|
|
|
74
|
+
rsync.path = 'some_path'
|
|
75
|
+
rsync.mirror = 'some_mirror'
|
|
76
|
+
rsync.additional_options = 'some_additional_options'
|
|
59
77
|
|
|
60
|
-
it 'should use the configured defaults' do
|
|
61
|
-
Backup::Configuration::Syncer::RSync::Push.defaults do |rsync|
|
|
62
78
|
rsync.username = 'some_username'
|
|
63
79
|
rsync.password = 'some_password'
|
|
64
80
|
rsync.ip = 'some_ip'
|
|
65
81
|
rsync.port = 'some_port'
|
|
66
82
|
rsync.compress = 'some_compress'
|
|
67
|
-
rsync.path = 'some_path'
|
|
68
|
-
#rsync.directories = 'cannot_have_a_default_value'
|
|
69
|
-
rsync.mirror = 'some_mirror'
|
|
70
|
-
rsync.additional_options = 'some_additional_options'
|
|
71
83
|
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
it 'should use pre-configured defaults' do
|
|
72
87
|
syncer = Backup::Syncer::RSync::Push.new
|
|
88
|
+
|
|
89
|
+
syncer.path.should == 'some_path'
|
|
90
|
+
syncer.mirror.should == 'some_mirror'
|
|
91
|
+
syncer.directories.should == []
|
|
92
|
+
syncer.additional_options.should == 'some_additional_options'
|
|
93
|
+
|
|
73
94
|
syncer.username.should == 'some_username'
|
|
74
95
|
syncer.password.should == 'some_password'
|
|
75
96
|
syncer.ip.should == 'some_ip'
|
|
76
97
|
syncer.port.should == 'some_port'
|
|
77
98
|
syncer.compress.should == 'some_compress'
|
|
78
|
-
syncer.path.should == 'some_path'
|
|
79
|
-
syncer.directories.should == []
|
|
80
|
-
syncer.mirror.should == 'some_mirror'
|
|
81
|
-
syncer.additional_options.should == 'some_additional_options'
|
|
82
99
|
end
|
|
83
100
|
|
|
84
|
-
it 'should override
|
|
85
|
-
Backup::Configuration::Syncer::RSync::Push.defaults do |rsync|
|
|
86
|
-
rsync.username = 'old_username'
|
|
87
|
-
rsync.password = 'old_password'
|
|
88
|
-
rsync.ip = 'old_ip'
|
|
89
|
-
rsync.port = 'old_port'
|
|
90
|
-
rsync.compress = 'old_compress'
|
|
91
|
-
rsync.path = 'old_path'
|
|
92
|
-
#rsync.directories = 'cannot_have_a_default_value'
|
|
93
|
-
rsync.mirror = 'old_mirror'
|
|
94
|
-
rsync.additional_options = 'old_additional_options'
|
|
95
|
-
end
|
|
101
|
+
it 'should override pre-configured defaults' do
|
|
96
102
|
syncer = Backup::Syncer::RSync::Push.new do |rsync|
|
|
103
|
+
rsync.path = 'new_path'
|
|
104
|
+
rsync.mirror = 'new_mirror'
|
|
105
|
+
rsync.additional_options = 'new_additional_options'
|
|
106
|
+
|
|
97
107
|
rsync.username = 'new_username'
|
|
98
108
|
rsync.password = 'new_password'
|
|
99
109
|
rsync.ip = 'new_ip'
|
|
100
110
|
rsync.port = 'new_port'
|
|
101
111
|
rsync.compress = 'new_compress'
|
|
102
|
-
rsync.path = 'new_path'
|
|
103
|
-
rsync.directories = 'new_directories'
|
|
104
|
-
rsync.mirror = 'new_mirror'
|
|
105
|
-
rsync.additional_options = 'new_additional_options'
|
|
106
112
|
end
|
|
107
113
|
|
|
114
|
+
syncer.path.should == 'new_path'
|
|
115
|
+
syncer.mirror.should == 'new_mirror'
|
|
116
|
+
syncer.directories.should == []
|
|
117
|
+
syncer.additional_options.should == 'new_additional_options'
|
|
118
|
+
|
|
108
119
|
syncer.username.should == 'new_username'
|
|
109
120
|
syncer.password.should == 'new_password'
|
|
110
121
|
syncer.ip.should == 'new_ip'
|
|
111
122
|
syncer.port.should == 'new_port'
|
|
112
123
|
syncer.compress.should == 'new_compress'
|
|
113
|
-
syncer.path.should == 'new_path'
|
|
114
|
-
syncer.directories.should == 'new_directories'
|
|
115
|
-
syncer.mirror.should == 'new_mirror'
|
|
116
|
-
syncer.additional_options.should == 'new_additional_options'
|
|
117
124
|
end
|
|
118
|
-
end # context 'when
|
|
125
|
+
end # context 'when pre-configured defaults have been set'
|
|
119
126
|
end # describe '#initialize'
|
|
120
127
|
|
|
121
128
|
describe '#perform!' do
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
##
|
|
2
|
+
# Custom [Compressor]
|
|
3
|
+
#
|
|
4
|
+
# For information on using a Custom Compressor,
|
|
5
|
+
# please see the following Wiki page:
|
|
6
|
+
# https://github.com/meskyanichi/backup/wiki/Compressors
|
|
7
|
+
#
|
|
8
|
+
compress_with Custom do |compressor|
|
|
9
|
+
compressor.command = 'gzip'
|
|
10
|
+
compressor.extension = '.gz'
|
|
11
|
+
end
|
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
# MySQL [Database]
|
|
3
3
|
#
|
|
4
4
|
database MySQL do |db|
|
|
5
|
-
# To dump all databases, set db.name = :all (or leave blank)
|
|
5
|
+
# To dump all databases, set `db.name = :all` (or leave blank)
|
|
6
6
|
db.name = "my_database_name"
|
|
7
7
|
db.username = "my_username"
|
|
8
8
|
db.password = "my_password"
|
|
9
9
|
db.host = "localhost"
|
|
10
10
|
db.port = 3306
|
|
11
11
|
db.socket = "/tmp/mysql.sock"
|
|
12
|
+
# Note: when using `skip_tables` with the `db.name = :all` option,
|
|
13
|
+
# table names should be prefixed with a database name.
|
|
14
|
+
# e.g. ["db_name.table_to_skip", ...]
|
|
12
15
|
db.skip_tables = ["skip", "these", "tables"]
|
|
13
16
|
db.only_tables = ["only", "these" "tables"]
|
|
14
17
|
db.additional_options = ["--quick", "--single-transaction"]
|
|
@@ -3,34 +3,32 @@
|
|
|
3
3
|
#
|
|
4
4
|
# Available Auth URLs:
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
6
|
+
# - https://auth.api.rackspacecloud.com (US - Default)
|
|
7
|
+
# - https://lon.auth.api.rackspacecloud.com (UK)
|
|
8
8
|
#
|
|
9
9
|
# Servicenet:
|
|
10
10
|
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
11
|
+
# Set this to 'true' if Backup runs on a Rackspace server.
|
|
12
|
+
# It will avoid transfer charges and it's more performant.
|
|
13
13
|
#
|
|
14
14
|
# Mirroring:
|
|
15
15
|
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
16
|
+
# When enabled it will keep an exact mirror of your filesystem on Cloud Files.
|
|
17
|
+
# This means that when you remove a file from the filesystem,
|
|
18
|
+
# it will also remote it from Cloud Files.
|
|
18
19
|
#
|
|
19
|
-
# Concurrency
|
|
20
|
+
# Concurrency:
|
|
20
21
|
#
|
|
21
|
-
#
|
|
22
|
-
# - :processes
|
|
23
|
-
# - false
|
|
22
|
+
# `concurrency_type` may be set to:
|
|
24
23
|
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
24
|
+
# - false (default)
|
|
25
|
+
# - :threads
|
|
26
|
+
# - :processes
|
|
27
27
|
#
|
|
28
|
-
#
|
|
28
|
+
# Set `concurrency_level` to the number of threads/processes to use.
|
|
29
|
+
# Defaults to 2.
|
|
29
30
|
#
|
|
30
|
-
|
|
31
|
-
# If you want a high concurrency level (>2), use :threads and not :processes.
|
|
32
|
-
#
|
|
33
|
-
sync_with CloudFiles do |cf|
|
|
31
|
+
sync_with Cloud::CloudFiles do |cf|
|
|
34
32
|
cf.username = "my_username"
|
|
35
33
|
cf.api_key = "my_api_key"
|
|
36
34
|
cf.container = "my_container"
|
|
@@ -38,8 +36,8 @@
|
|
|
38
36
|
cf.servicenet = false
|
|
39
37
|
cf.path = "/backups"
|
|
40
38
|
cf.mirror = true
|
|
41
|
-
cf.concurrency_type =
|
|
42
|
-
cf.concurrency_level =
|
|
39
|
+
cf.concurrency_type = false
|
|
40
|
+
cf.concurrency_level = 2
|
|
43
41
|
|
|
44
42
|
cf.directories do |directory|
|
|
45
43
|
directory.add "/path/to/directory/to/sync"
|