backup 3.0.16 → 3.0.18
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +10 -0
- data/Gemfile.lock +50 -47
- data/Guardfile +3 -3
- data/README.md +136 -81
- data/backup.gemspec +3 -2
- data/bin/backup +36 -15
- data/lib/backup.rb +30 -20
- data/lib/backup/cli.rb +30 -2
- data/lib/backup/compressor/lzma.rb +63 -0
- data/lib/backup/configuration/compressor/lzma.rb +23 -0
- data/lib/backup/configuration/helpers.rb +10 -4
- data/lib/backup/configuration/notifier/mail.rb +5 -0
- data/lib/backup/configuration/storage/dropbox.rb +19 -4
- data/lib/backup/configuration/storage/ftp.rb +4 -0
- data/lib/backup/configuration/storage/local.rb +17 -0
- data/lib/backup/configuration/storage/ninefold.rb +20 -0
- data/lib/backup/configuration/storage/rsync.rb +4 -0
- data/lib/backup/database/postgresql.rb +12 -3
- data/lib/backup/database/redis.rb +5 -1
- data/lib/backup/dependency.rb +11 -12
- data/lib/backup/encryptor/gpg.rb +2 -0
- data/lib/backup/exception/command_failed.rb +8 -0
- data/lib/backup/finder.rb +49 -9
- data/lib/backup/notifier/mail.rb +7 -1
- data/lib/backup/notifier/twitter.rb +1 -1
- data/lib/backup/storage/dropbox.rb +93 -16
- data/lib/backup/storage/ftp.rb +10 -3
- data/lib/backup/storage/local.rb +78 -0
- data/lib/backup/storage/ninefold.rb +96 -0
- data/lib/backup/storage/rsync.rb +37 -20
- data/lib/backup/storage/s3.rb +1 -1
- data/lib/backup/storage/scp.rb +1 -1
- data/lib/backup/syncer/rsync.rb +1 -1
- data/lib/backup/version.rb +1 -1
- data/lib/templates/compressor/lzma +7 -0
- data/lib/templates/storage/dropbox +2 -2
- data/lib/templates/storage/ftp +8 -7
- data/lib/templates/storage/local +7 -0
- data/lib/templates/storage/ninefold +9 -0
- data/lib/templates/storage/rsync +1 -0
- data/spec/archive_spec.rb +0 -1
- data/spec/compressor/bzip2_spec.rb +0 -1
- data/spec/compressor/gzip_spec.rb +0 -1
- data/spec/compressor/lzma_spec.rb +58 -0
- data/spec/configuration/compressor/bzip2_spec.rb +28 -0
- data/spec/configuration/compressor/lzma_spec.rb +28 -0
- data/spec/configuration/database/mongodb_spec.rb +16 -0
- data/spec/configuration/database/mysql_spec.rb +17 -0
- data/spec/configuration/database/postgresql_spec.rb +17 -0
- data/spec/configuration/database/redis_spec.rb +16 -0
- data/spec/configuration/notifier/campfire_spec.rb +11 -0
- data/spec/configuration/notifier/mail_spec.rb +20 -0
- data/spec/configuration/notifier/presently_spec.rb +34 -0
- data/spec/configuration/notifier/twitter_spec.rb +12 -0
- data/spec/configuration/storage/dropbox_spec.rb +0 -6
- data/spec/configuration/storage/ftp_spec.rb +15 -12
- data/spec/configuration/storage/local_spec.rb +28 -0
- data/spec/configuration/storage/ninefold_spec.rb +31 -0
- data/spec/configuration/storage/rsync_spec.rb +2 -0
- data/spec/database/mongodb_spec.rb +0 -1
- data/spec/database/mysql_spec.rb +0 -1
- data/spec/database/postgresql_spec.rb +31 -11
- data/spec/database/redis_spec.rb +9 -4
- data/spec/encryptor/gpg_spec.rb +1 -1
- data/spec/encryptor/open_ssl_spec.rb +0 -1
- data/spec/logger_spec.rb +32 -24
- data/spec/model_spec.rb +15 -15
- data/spec/spec_helper.rb +8 -4
- data/spec/storage/base_spec.rb +0 -4
- data/spec/storage/cloudfiles_spec.rb +0 -1
- data/spec/storage/dropbox_spec.rb +44 -14
- data/spec/storage/ftp_spec.rb +26 -15
- data/spec/storage/local_spec.rb +83 -0
- data/spec/storage/ninefold_spec.rb +142 -0
- data/spec/storage/object_spec.rb +1 -1
- data/spec/storage/rsync_spec.rb +17 -7
- data/spec/storage/s3_spec.rb +4 -3
- data/spec/storage/scp_spec.rb +0 -1
- data/spec/storage/sftp_spec.rb +0 -1
- data/spec/syncer/rsync_spec.rb +8 -8
- metadata +62 -36
@@ -0,0 +1,83 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
4
|
+
|
5
|
+
describe Backup::Storage::Local do
|
6
|
+
|
7
|
+
let(:local) do
|
8
|
+
Backup::Storage::Local.new do |local|
|
9
|
+
local.path = '~/backups/'
|
10
|
+
local.keep = 20
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
before do
|
15
|
+
Backup::Configuration::Storage::Local.clear_defaults!
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should have defined the configuration properly' do
|
19
|
+
local.path.should == "#{ENV['HOME']}/backups/"
|
20
|
+
local.keep.should == 20
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should use the defaults if a particular attribute has not been defined' do
|
24
|
+
Backup::Configuration::Storage::Local.defaults do |local|
|
25
|
+
local.path = '~/backups'
|
26
|
+
end
|
27
|
+
|
28
|
+
local = Backup::Storage::Local.new do |local|
|
29
|
+
local.path = '~/my-backups'
|
30
|
+
end
|
31
|
+
|
32
|
+
local.path.should == "#{ENV['HOME']}/my-backups"
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should have its own defaults' do
|
36
|
+
local = Backup::Storage::Local.new
|
37
|
+
local.path.should == "#{ENV['HOME']}/backups"
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#transfer!' do
|
41
|
+
before do
|
42
|
+
local.stubs(:create_local_directories!)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'should transfer the provided file to the path' do
|
46
|
+
Backup::Model.new('blah', 'blah') {}
|
47
|
+
file = mock("Backup::Storage::Local::File")
|
48
|
+
|
49
|
+
local.expects(:create_local_directories!)
|
50
|
+
|
51
|
+
FileUtils.expects(:cp).with(
|
52
|
+
File.join(Backup::TMP_PATH, "#{ Backup::TIME }.#{ Backup::TRIGGER }.tar"),
|
53
|
+
File.join("#{ENV['HOME']}/backups/myapp", "#{ Backup::TIME }.#{ Backup::TRIGGER }.tar")
|
54
|
+
)
|
55
|
+
|
56
|
+
local.send(:transfer!)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#remove!' do
|
61
|
+
it 'should remove the file from the remote server path' do
|
62
|
+
FileUtils.expects(:rm).with("#{ENV['HOME']}/backups/myapp/#{ Backup::TIME }.#{ Backup::TRIGGER }.tar")
|
63
|
+
local.send(:remove!)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#create_remote_directories!' do
|
68
|
+
it 'should properly create remote directories one by one' do
|
69
|
+
local.path = "#{ENV['HOME']}/backups/some_other_folder/another_folder"
|
70
|
+
FileUtils.expects(:mkdir_p).with("#{ENV['HOME']}/backups/some_other_folder/another_folder/myapp")
|
71
|
+
local.send(:create_local_directories!)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe '#perform' do
|
76
|
+
it 'should invoke transfer! and cycle!' do
|
77
|
+
local.expects(:transfer!)
|
78
|
+
local.expects(:cycle!)
|
79
|
+
local.perform!
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
@@ -0,0 +1,142 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
4
|
+
|
5
|
+
describe Backup::Storage::Ninefold do
|
6
|
+
|
7
|
+
let(:ninefold) do
|
8
|
+
Backup::Storage::Ninefold.new do |nf|
|
9
|
+
nf.storage_token = 'my_storage_token'
|
10
|
+
nf.storage_secret = 'my_storage_secret'
|
11
|
+
nf.path = 'backups'
|
12
|
+
nf.keep = 20
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
before do
|
17
|
+
Backup::Configuration::Storage::Ninefold.clear_defaults!
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should have defined the configuration properly' do
|
21
|
+
ninefold.storage_token.should == 'my_storage_token'
|
22
|
+
ninefold.storage_secret.should == 'my_storage_secret'
|
23
|
+
ninefold.keep.should == 20
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should use the defaults if a particular attribute has not been defined' do
|
27
|
+
Backup::Configuration::Storage::Ninefold.defaults do |nf|
|
28
|
+
nf.storage_token = 'my_storage_token'
|
29
|
+
nf.keep = 500
|
30
|
+
end
|
31
|
+
|
32
|
+
ninefold = Backup::Storage::Ninefold.new do |nf|
|
33
|
+
nf.path = 'my/backups'
|
34
|
+
end
|
35
|
+
|
36
|
+
ninefold.storage_token.should == 'my_storage_token' # not defined, uses default
|
37
|
+
ninefold.storage_secret.should == nil # not defined, no default
|
38
|
+
ninefold.path.should == 'my/backups' # overwritten from Backup::Storage::Ninefold
|
39
|
+
ninefold.keep.should == 500 # comes from the default configuration
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#connection' do
|
43
|
+
it 'should establish a connection to Ninefold using the provided credentials' do
|
44
|
+
Fog::Storage.expects(:new).with({
|
45
|
+
:provider => 'Ninefold',
|
46
|
+
:ninefold_storage_token => 'my_storage_token',
|
47
|
+
:ninefold_storage_secret => 'my_storage_secret'
|
48
|
+
})
|
49
|
+
|
50
|
+
ninefold.send(:connection)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#provider' do
|
55
|
+
it 'should be Ninefold' do
|
56
|
+
ninefold.provider.should == 'Ninefold'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#transfer!' do
|
61
|
+
let(:connection) { mock('Fog::Storage') }
|
62
|
+
let(:directories) { mock('Fog::Storage::Ninefold::Directories') }
|
63
|
+
let(:directory) { mock('Fog::Storage::Ninefold::Directory') }
|
64
|
+
let(:files) { mock('Fog::Storage::Ninefold::Files') }
|
65
|
+
|
66
|
+
before do
|
67
|
+
Fog::Storage.stubs(:new).returns(connection)
|
68
|
+
connection.stubs(:directories).returns(directories)
|
69
|
+
directory.stubs(:files).returns(files)
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'directory already exists' do
|
73
|
+
it 'should transfer the provided file to the directory' do
|
74
|
+
Backup::Model.new('blah', 'blah') {}
|
75
|
+
file = mock("Backup::Storage::Ninefold::File")
|
76
|
+
File.expects(:open).with("#{File.join(Backup::TMP_PATH, "#{ Backup::TIME }.#{ Backup::TRIGGER}")}.tar").returns(file)
|
77
|
+
ninefold.expects(:remote_file).returns("#{ Backup::TIME }.#{ Backup::TRIGGER }.tar").twice
|
78
|
+
|
79
|
+
directories.expects(:get).with('backups/myapp').returns(directory)
|
80
|
+
files.expects(:create) do |options|
|
81
|
+
options[:key].should == "#{ Backup::TIME }.#{ Backup::TRIGGER }.tar"
|
82
|
+
options[:body].should == file
|
83
|
+
end
|
84
|
+
|
85
|
+
ninefold.send(:transfer!)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
context 'directory does not yet exist' do
|
90
|
+
it 'should transfer the provided file to the directory' do
|
91
|
+
Backup::Model.new('blah', 'blah') {}
|
92
|
+
file = mock("Backup::Storage::Ninefold::File")
|
93
|
+
File.expects(:open).with("#{File.join(Backup::TMP_PATH, "#{ Backup::TIME }.#{ Backup::TRIGGER}")}.tar").returns(file)
|
94
|
+
ninefold.expects(:remote_file).returns("#{ Backup::TIME }.#{ Backup::TRIGGER }.tar").twice
|
95
|
+
|
96
|
+
directories.expects(:get).with('backups/myapp').returns(nil)
|
97
|
+
directories.expects(:create) { |options|
|
98
|
+
options[:key].should == 'backups/myapp'
|
99
|
+
}.returns(directory)
|
100
|
+
|
101
|
+
files.expects(:create) do |options|
|
102
|
+
options[:key].should == "#{ Backup::TIME }.#{ Backup::TRIGGER }.tar"
|
103
|
+
options[:body].should == file
|
104
|
+
end
|
105
|
+
|
106
|
+
ninefold.send(:transfer!)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
describe '#remove!' do
|
112
|
+
let(:connection) { mock('Fog::Storage') }
|
113
|
+
let(:directories) { mock('Fog::Storage::Ninefold::Directories') }
|
114
|
+
let(:directory) { mock('Fog::Storage::Ninefold::Directory') }
|
115
|
+
let(:files) { mock('Fog::Storage::Ninefold::Files') }
|
116
|
+
let(:file) { mock('Fog::Storage::Ninefold::File') }
|
117
|
+
|
118
|
+
before do
|
119
|
+
Fog::Storage.stubs(:new).returns(connection)
|
120
|
+
connection.stubs(:directories).returns(directories)
|
121
|
+
directory.stubs(:files).returns(files)
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'should remove the file from the bucket' do
|
125
|
+
ninefold.expects(:remote_file).returns("#{ Backup::TIME }.#{ Backup::TRIGGER }.tar")
|
126
|
+
|
127
|
+
directories.expects(:get).with('backups/myapp').returns(directory)
|
128
|
+
files.expects(:get).with("#{ Backup::TIME }.#{ Backup::TRIGGER }.tar").returns(file)
|
129
|
+
file.expects(:destroy)
|
130
|
+
|
131
|
+
ninefold.send(:remove!)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe '#perform' do
|
136
|
+
it 'should invoke transfer! and cycle!' do
|
137
|
+
ninefold.expects(:transfer!)
|
138
|
+
ninefold.expects(:cycle!)
|
139
|
+
ninefold.perform!
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
data/spec/storage/object_spec.rb
CHANGED
@@ -59,7 +59,7 @@ describe Backup::Storage::Object do
|
|
59
59
|
obj_1 = Backup::Storage::S3.new; obj_1.time = '2009.00.00.00.00.00'
|
60
60
|
obj_2 = Backup::Storage::S3.new; obj_2.time = '2011.00.00.00.00.00'
|
61
61
|
|
62
|
-
File.expects(:exist?).returns(true)
|
62
|
+
File.expects(:exist?).at_least_once.returns(true)
|
63
63
|
YAML.expects(:load_file).with(
|
64
64
|
File.join(Backup::DATA_PATH, Backup::TRIGGER, 's3.yml')
|
65
65
|
).returns(YAML.load([obj_1, obj_2, obj_3].to_yaml))
|
data/spec/storage/rsync_spec.rb
CHANGED
@@ -22,7 +22,7 @@ describe Backup::Storage::RSync do
|
|
22
22
|
rsync.username.should == 'my_username'
|
23
23
|
rsync.send(:password).should =~ /backup-rsync-password/
|
24
24
|
rsync.ip.should == '123.45.678.90'
|
25
|
-
rsync.port.should == 22
|
25
|
+
rsync.port.should == "-e 'ssh -p 22'"
|
26
26
|
rsync.path.should == 'backups/'
|
27
27
|
|
28
28
|
File.read(rsync.instance_variable_get('@password_file').path).should == 'my_password'
|
@@ -43,15 +43,16 @@ describe Backup::Storage::RSync do
|
|
43
43
|
rsync.username.should == 'my_default_username'
|
44
44
|
rsync.send(:password).should =~ /backup-rsync-password/
|
45
45
|
rsync.ip.should == '123.45.678.90'
|
46
|
-
rsync.port.should == 22
|
46
|
+
rsync.port.should == "-e 'ssh -p 22'"
|
47
47
|
|
48
48
|
File.read(rsync.instance_variable_get('@password_file').path).should == 'my_password'
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'should have its own defaults' do
|
52
52
|
rsync = Backup::Storage::RSync.new
|
53
|
-
rsync.port.should
|
54
|
-
rsync.path.should
|
53
|
+
rsync.port.should == "-e 'ssh -p 22'"
|
54
|
+
rsync.path.should == 'backups'
|
55
|
+
rsync.local.should == false
|
55
56
|
end
|
56
57
|
|
57
58
|
describe '#connection' do
|
@@ -67,7 +68,6 @@ describe Backup::Storage::RSync do
|
|
67
68
|
before do
|
68
69
|
Net::SSH.stubs(:start).returns(connection)
|
69
70
|
rsync.stubs(:create_remote_directories!)
|
70
|
-
Backup::Logger.stubs(:message)
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'should transfer the provided file to the path' do
|
@@ -76,7 +76,7 @@ describe Backup::Storage::RSync do
|
|
76
76
|
|
77
77
|
rsync.expects(:create_remote_directories!)
|
78
78
|
rsync.expects(:utility).returns('rsync')
|
79
|
-
rsync.expects(:run).with("rsync -z
|
79
|
+
rsync.expects(:run).with("rsync -z -e 'ssh -p 22' --password-file='#{rsync.instance_variable_get('@password_file').path}' '#{ File.join(Backup::TMP_PATH, "#{ Backup::TIME }.#{ Backup::TRIGGER }.tar") }' 'my_username@123.45.678.90:backups/#{ Backup::TRIGGER }/#{ Backup::TRIGGER }.tar'")
|
80
80
|
|
81
81
|
rsync.send(:transfer!)
|
82
82
|
end
|
@@ -88,7 +88,7 @@ describe Backup::Storage::RSync do
|
|
88
88
|
rsync.password = nil
|
89
89
|
rsync.expects(:create_remote_directories!)
|
90
90
|
rsync.expects(:utility).returns('rsync')
|
91
|
-
rsync.expects(:run).with("rsync -z
|
91
|
+
rsync.expects(:run).with("rsync -z -e 'ssh -p 22' '#{ File.join(Backup::TMP_PATH, "#{ Backup::TIME }.#{ Backup::TRIGGER }.tar") }' 'my_username@123.45.678.90:backups/#{ Backup::TRIGGER }/#{ Backup::TRIGGER }.tar'")
|
92
92
|
|
93
93
|
rsync.send(:transfer!)
|
94
94
|
end
|
@@ -128,4 +128,14 @@ describe Backup::Storage::RSync do
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
+
describe '#local backups' do
|
132
|
+
it 'should save a local copy of backups' do
|
133
|
+
rsync.expects(:create_remote_directories!)
|
134
|
+
rsync.local = true
|
135
|
+
rsync.expects(:utility).returns('rsync')
|
136
|
+
rsync.expects(:run).with("rsync '#{ File.join(Backup::TMP_PATH, "#{ Backup::TIME }.#{ Backup::TRIGGER }.tar") }' 'backups/#{ Backup::TRIGGER }/#{ Backup::TIME }.#{ Backup::TRIGGER }.tar'")
|
137
|
+
rsync.send(:transfer!)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
131
141
|
end
|
data/spec/storage/s3_spec.rb
CHANGED
@@ -32,8 +32,9 @@ describe Backup::Storage::S3 do
|
|
32
32
|
|
33
33
|
it 'should use the defaults if a particular attribute has not been defined' do
|
34
34
|
Backup::Configuration::Storage::S3.defaults do |s3|
|
35
|
-
s3.access_key_id
|
36
|
-
s3.region
|
35
|
+
s3.access_key_id = 'my_access_key_id'
|
36
|
+
s3.region = 'us-east-1'
|
37
|
+
s3.keep = 500
|
37
38
|
end
|
38
39
|
|
39
40
|
s3 = Backup::Storage::S3.new do |s3|
|
@@ -46,6 +47,7 @@ describe Backup::Storage::S3 do
|
|
46
47
|
s3.region.should == 'us-west-1' # defined, overwrites default
|
47
48
|
s3.bucket.should == nil # not defined, no default
|
48
49
|
s3.path.should == 'my/backups' # overwritten from Backup::Storage::S3
|
50
|
+
s3.keep.should == 500 # comes from the default configuration
|
49
51
|
end
|
50
52
|
|
51
53
|
describe '#connection' do
|
@@ -71,7 +73,6 @@ describe Backup::Storage::S3 do
|
|
71
73
|
let(:connection) { mock('Fog::Storage') }
|
72
74
|
before do
|
73
75
|
Fog::Storage.stubs(:new).returns(connection)
|
74
|
-
Backup::Logger.stubs(:message)
|
75
76
|
end
|
76
77
|
|
77
78
|
it 'should transfer the provided file to the bucket' do
|
data/spec/storage/scp_spec.rb
CHANGED
data/spec/storage/sftp_spec.rb
CHANGED
data/spec/syncer/rsync_spec.rb
CHANGED
@@ -30,7 +30,7 @@ describe Backup::Syncer::RSync do
|
|
30
30
|
rsync.username.should == 'my_username'
|
31
31
|
rsync.password.should =~ /backup-rsync-password/
|
32
32
|
rsync.ip.should == '123.45.678.90'
|
33
|
-
rsync.port.should == "
|
33
|
+
rsync.port.should == "-e 'ssh -p 22'"
|
34
34
|
rsync.path.should == 'backups/'
|
35
35
|
rsync.mirror.should == "--delete"
|
36
36
|
rsync.compress.should == "--compress"
|
@@ -55,7 +55,7 @@ describe Backup::Syncer::RSync do
|
|
55
55
|
rsync.username.should == 'my_default_username'
|
56
56
|
rsync.password.should =~ /backup-rsync-password/
|
57
57
|
rsync.ip.should == '123.45.678.90'
|
58
|
-
rsync.port.should == "
|
58
|
+
rsync.port.should == "-e 'ssh -p 22'"
|
59
59
|
rsync.mirror.should == nil
|
60
60
|
rsync.compress.should == nil
|
61
61
|
|
@@ -64,7 +64,7 @@ describe Backup::Syncer::RSync do
|
|
64
64
|
|
65
65
|
it 'should have its own defaults' do
|
66
66
|
rsync = Backup::Syncer::RSync.new
|
67
|
-
rsync.port.should == "
|
67
|
+
rsync.port.should == "-e 'ssh -p 22'"
|
68
68
|
rsync.path.should == 'backups'
|
69
69
|
rsync.compress.should == nil
|
70
70
|
rsync.mirror.should == nil
|
@@ -122,7 +122,7 @@ describe Backup::Syncer::RSync do
|
|
122
122
|
|
123
123
|
describe '#port' do
|
124
124
|
it do
|
125
|
-
rsync.port.should == "
|
125
|
+
rsync.port.should == "-e 'ssh -p 22'"
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
@@ -144,14 +144,13 @@ describe Backup::Syncer::RSync do
|
|
144
144
|
|
145
145
|
describe '#options' do
|
146
146
|
it do
|
147
|
-
rsync.options.should == "--archive --delete --compress
|
147
|
+
rsync.options.should == "--archive --delete --compress -e 'ssh -p 22' " +
|
148
148
|
"--password-file='#{rsync.instance_variable_get('@password_file').path}'"
|
149
149
|
end
|
150
150
|
end
|
151
151
|
|
152
152
|
describe '#password' do
|
153
153
|
before do
|
154
|
-
Backup::Logger.stubs(:message)
|
155
154
|
rsync.stubs(:utility).with(:rsync).returns(:rsync)
|
156
155
|
rsync.stubs(:run)
|
157
156
|
end
|
@@ -172,11 +171,12 @@ describe Backup::Syncer::RSync do
|
|
172
171
|
end
|
173
172
|
|
174
173
|
describe '#perform' do
|
174
|
+
|
175
175
|
it 'should invoke the rsync command to transfer the files and directories' do
|
176
176
|
Backup::Logger.expects(:message).with("Backup::Syncer::RSync started syncing '/some/random/directory' '/another/random/directory'.")
|
177
177
|
rsync.expects(:utility).with(:rsync).returns(:rsync)
|
178
178
|
rsync.expects(:remove_password_file!)
|
179
|
-
rsync.expects(:run).with("rsync -vhP --archive --delete --compress
|
179
|
+
rsync.expects(:run).with("rsync -vhP --archive --delete --compress -e 'ssh -p 22' --password-file='#{rsync.instance_variable_get('@password_file').path}' " +
|
180
180
|
"'/some/random/directory' '/another/random/directory' 'my_username@123.45.678.90:backups/'")
|
181
181
|
rsync.perform!
|
182
182
|
end
|
@@ -186,7 +186,7 @@ describe Backup::Syncer::RSync do
|
|
186
186
|
rsync.password = nil
|
187
187
|
rsync.expects(:utility).with(:rsync).returns(:rsync)
|
188
188
|
rsync.expects(:remove_password_file!)
|
189
|
-
rsync.expects(:run).with("rsync -vhP --archive --delete --compress
|
189
|
+
rsync.expects(:run).with("rsync -vhP --archive --delete --compress -e 'ssh -p 22' " +
|
190
190
|
"'/some/random/directory' '/another/random/directory' 'my_username@123.45.678.90:backups/'")
|
191
191
|
rsync.perform!
|
192
192
|
end
|
metadata
CHANGED
@@ -1,39 +1,47 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: backup
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.18
|
4
5
|
prerelease:
|
5
|
-
version: 3.0.16
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Michael van Rooijen
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
dependencies:
|
16
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
17
15
|
name: thor
|
18
|
-
|
19
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70250452788680 !ruby/object:Gem::Requirement
|
20
17
|
none: false
|
21
|
-
requirements:
|
18
|
+
requirements:
|
22
19
|
- - ~>
|
23
|
-
- !ruby/object:Gem::Version
|
20
|
+
- !ruby/object:Gem::Version
|
24
21
|
version: 0.14.6
|
25
22
|
type: :runtime
|
26
|
-
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70250452788680
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: popen4
|
27
|
+
requirement: &70250452785200 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.1.2
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70250452785200
|
27
36
|
description:
|
28
37
|
email: meskyanichi@gmail.com
|
29
|
-
executables:
|
38
|
+
executables:
|
30
39
|
- backup
|
31
40
|
extensions: []
|
32
|
-
|
33
41
|
extra_rdoc_files: []
|
34
|
-
|
35
|
-
files:
|
42
|
+
files:
|
36
43
|
- .gitignore
|
44
|
+
- .travis.yml
|
37
45
|
- Gemfile
|
38
46
|
- Gemfile.lock
|
39
47
|
- Guardfile
|
@@ -47,10 +55,12 @@ files:
|
|
47
55
|
- lib/backup/compressor/base.rb
|
48
56
|
- lib/backup/compressor/bzip2.rb
|
49
57
|
- lib/backup/compressor/gzip.rb
|
58
|
+
- lib/backup/compressor/lzma.rb
|
50
59
|
- lib/backup/configuration/base.rb
|
51
60
|
- lib/backup/configuration/compressor/base.rb
|
52
61
|
- lib/backup/configuration/compressor/bzip2.rb
|
53
62
|
- lib/backup/configuration/compressor/gzip.rb
|
63
|
+
- lib/backup/configuration/compressor/lzma.rb
|
54
64
|
- lib/backup/configuration/database/base.rb
|
55
65
|
- lib/backup/configuration/database/mongodb.rb
|
56
66
|
- lib/backup/configuration/database/mysql.rb
|
@@ -69,6 +79,8 @@ files:
|
|
69
79
|
- lib/backup/configuration/storage/cloudfiles.rb
|
70
80
|
- lib/backup/configuration/storage/dropbox.rb
|
71
81
|
- lib/backup/configuration/storage/ftp.rb
|
82
|
+
- lib/backup/configuration/storage/local.rb
|
83
|
+
- lib/backup/configuration/storage/ninefold.rb
|
72
84
|
- lib/backup/configuration/storage/rsync.rb
|
73
85
|
- lib/backup/configuration/storage/s3.rb
|
74
86
|
- lib/backup/configuration/storage/scp.rb
|
@@ -84,6 +96,7 @@ files:
|
|
84
96
|
- lib/backup/encryptor/base.rb
|
85
97
|
- lib/backup/encryptor/gpg.rb
|
86
98
|
- lib/backup/encryptor/open_ssl.rb
|
99
|
+
- lib/backup/exception/command_failed.rb
|
87
100
|
- lib/backup/exception/command_not_found.rb
|
88
101
|
- lib/backup/finder.rb
|
89
102
|
- lib/backup/logger.rb
|
@@ -100,6 +113,8 @@ files:
|
|
100
113
|
- lib/backup/storage/cloudfiles.rb
|
101
114
|
- lib/backup/storage/dropbox.rb
|
102
115
|
- lib/backup/storage/ftp.rb
|
116
|
+
- lib/backup/storage/local.rb
|
117
|
+
- lib/backup/storage/ninefold.rb
|
103
118
|
- lib/backup/storage/object.rb
|
104
119
|
- lib/backup/storage/rsync.rb
|
105
120
|
- lib/backup/storage/s3.rb
|
@@ -112,6 +127,7 @@ files:
|
|
112
127
|
- lib/templates/archive
|
113
128
|
- lib/templates/compressor/bzip2
|
114
129
|
- lib/templates/compressor/gzip
|
130
|
+
- lib/templates/compressor/lzma
|
115
131
|
- lib/templates/database/mongodb
|
116
132
|
- lib/templates/database/mysql
|
117
133
|
- lib/templates/database/postgresql
|
@@ -126,6 +142,8 @@ files:
|
|
126
142
|
- lib/templates/storage/cloudfiles
|
127
143
|
- lib/templates/storage/dropbox
|
128
144
|
- lib/templates/storage/ftp
|
145
|
+
- lib/templates/storage/local
|
146
|
+
- lib/templates/storage/ninefold
|
129
147
|
- lib/templates/storage/rsync
|
130
148
|
- lib/templates/storage/s3
|
131
149
|
- lib/templates/storage/scp
|
@@ -136,8 +154,11 @@ files:
|
|
136
154
|
- spec/backup_spec.rb
|
137
155
|
- spec/compressor/bzip2_spec.rb
|
138
156
|
- spec/compressor/gzip_spec.rb
|
157
|
+
- spec/compressor/lzma_spec.rb
|
139
158
|
- spec/configuration/base_spec.rb
|
159
|
+
- spec/configuration/compressor/bzip2_spec.rb
|
140
160
|
- spec/configuration/compressor/gzip_spec.rb
|
161
|
+
- spec/configuration/compressor/lzma_spec.rb
|
141
162
|
- spec/configuration/database/base_spec.rb
|
142
163
|
- spec/configuration/database/mongodb_spec.rb
|
143
164
|
- spec/configuration/database/mysql_spec.rb
|
@@ -147,10 +168,13 @@ files:
|
|
147
168
|
- spec/configuration/encryptor/open_ssl_spec.rb
|
148
169
|
- spec/configuration/notifier/campfire_spec.rb
|
149
170
|
- spec/configuration/notifier/mail_spec.rb
|
171
|
+
- spec/configuration/notifier/presently_spec.rb
|
150
172
|
- spec/configuration/notifier/twitter_spec.rb
|
151
173
|
- spec/configuration/storage/cloudfiles_spec.rb
|
152
174
|
- spec/configuration/storage/dropbox_spec.rb
|
153
175
|
- spec/configuration/storage/ftp_spec.rb
|
176
|
+
- spec/configuration/storage/local_spec.rb
|
177
|
+
- spec/configuration/storage/ninefold_spec.rb
|
154
178
|
- spec/configuration/storage/rsync_spec.rb
|
155
179
|
- spec/configuration/storage/s3_spec.rb
|
156
180
|
- spec/configuration/storage/scp_spec.rb
|
@@ -175,6 +199,8 @@ files:
|
|
175
199
|
- spec/storage/cloudfiles_spec.rb
|
176
200
|
- spec/storage/dropbox_spec.rb
|
177
201
|
- spec/storage/ftp_spec.rb
|
202
|
+
- spec/storage/local_spec.rb
|
203
|
+
- spec/storage/ninefold_spec.rb
|
178
204
|
- spec/storage/object_spec.rb
|
179
205
|
- spec/storage/rsync_spec.rb
|
180
206
|
- spec/storage/s3_spec.rb
|
@@ -183,33 +209,33 @@ files:
|
|
183
209
|
- spec/syncer/rsync_spec.rb
|
184
210
|
- spec/syncer/s3_spec.rb
|
185
211
|
- spec/version_spec.rb
|
186
|
-
has_rdoc: true
|
187
212
|
homepage: http://rubygems.org/gems/backup
|
188
213
|
licenses: []
|
189
|
-
|
190
214
|
post_install_message:
|
191
215
|
rdoc_options: []
|
192
|
-
|
193
|
-
require_paths:
|
216
|
+
require_paths:
|
194
217
|
- lib
|
195
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
218
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
196
219
|
none: false
|
197
|
-
requirements:
|
198
|
-
- -
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
version:
|
201
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - ! '>='
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '0'
|
224
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
225
|
none: false
|
203
|
-
requirements:
|
204
|
-
- -
|
205
|
-
- !ruby/object:Gem::Version
|
206
|
-
version:
|
226
|
+
requirements:
|
227
|
+
- - ! '>='
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '0'
|
207
230
|
requirements: []
|
208
|
-
|
209
231
|
rubyforge_project:
|
210
|
-
rubygems_version: 1.
|
232
|
+
rubygems_version: 1.8.10
|
211
233
|
signing_key:
|
212
234
|
specification_version: 3
|
213
|
-
summary: Backup is a RubyGem, written for Linux and Mac OSX, that allows you to easily
|
235
|
+
summary: Backup is a RubyGem, written for Linux and Mac OSX, that allows you to easily
|
236
|
+
perform backup operations on both your remote, as well as your local environment.
|
237
|
+
It provides you with an elegant DSL in Ruby for modeling (configuring) your backups.
|
238
|
+
Backup has built-in support for various databases, storage protocols/services, syncers,
|
239
|
+
compressors, encryptors and notifiers which you can mix and match. It was built
|
240
|
+
with modularity, extensibility and simplicity in mind.
|
214
241
|
test_files: []
|
215
|
-
|