backup 3.0.24 → 3.0.25
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/backup.gemspec +2 -2
- data/lib/backup/cli/helpers.rb +2 -2
- data/lib/backup/cli/utility.rb +3 -3
- data/lib/backup/dependency.rb +1 -1
- data/lib/backup/storage/cycler.rb +1 -1
- data/lib/backup/syncer/cloud/base.rb +12 -12
- data/lib/backup/syncer/rsync/local.rb +2 -4
- data/lib/backup/syncer/rsync/pull.rb +3 -5
- data/lib/backup/syncer/rsync/push.rb +2 -4
- data/lib/backup/version.rb +1 -1
- data/spec/cli/helpers_spec.rb +8 -8
- data/spec/cli/utility_spec.rb +38 -1
- data/spec/logger_spec.rb +2 -2
- data/spec/storage/cycler_spec.rb +9 -1
- data/spec/syncer/cloud/base_spec.rb +20 -16
- data/spec/syncer/rsync/local_spec.rb +1 -2
- data/spec/syncer/rsync/pull_spec.rb +3 -6
- data/spec/syncer/rsync/push_spec.rb +1 -2
- data/templates/cli/utility/config +11 -10
- metadata +24 -16
- data/Gemfile.lock +0 -127
data/.gitignore
CHANGED
data/backup.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |gem|
|
|
12
12
|
gem.authors = 'Michael van Rooijen'
|
13
13
|
gem.email = 'meskyanichi@gmail.com'
|
14
14
|
gem.homepage = 'http://rubygems.org/gems/backup'
|
15
|
-
gem.summary = 'Backup is a RubyGem, written for
|
15
|
+
gem.summary = 'Backup is a RubyGem, written for UNIX-like operating systems, that allows you to easily perform backup operations on both your remote and local environments. It provides you with an elegant DSL in Ruby for modeling your backups. Backup has built-in support for various databases, storage protocols/services, syncers, compressors, encryptors and notifiers which you can mix and match. It was built with modularity, extensibility and simplicity in mind.'
|
16
16
|
|
17
17
|
##
|
18
18
|
# Files and folder that need to be compiled in to the Ruby Gem
|
@@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
|
|
26
26
|
|
27
27
|
##
|
28
28
|
# Gem dependencies
|
29
|
-
gem.add_dependency 'thor', ['~> 0.
|
29
|
+
gem.add_dependency 'thor', ['~> 0.15.4']
|
30
30
|
gem.add_dependency 'open4', ['~> 1.3.0']
|
31
31
|
|
32
32
|
end
|
data/lib/backup/cli/helpers.rb
CHANGED
@@ -14,7 +14,7 @@ module Backup
|
|
14
14
|
# If the command fails to execute, or returns a non-zero exit status
|
15
15
|
# an Error will be raised.
|
16
16
|
#
|
17
|
-
# Returns
|
17
|
+
# Returns STDOUT
|
18
18
|
def run(command)
|
19
19
|
name = command_name(command)
|
20
20
|
Logger.message "Running system utility '#{ name }'..."
|
@@ -45,7 +45,7 @@ module Backup
|
|
45
45
|
)
|
46
46
|
end
|
47
47
|
|
48
|
-
return
|
48
|
+
return out
|
49
49
|
else
|
50
50
|
raise Errors::CLI::SystemCallError, <<-EOS
|
51
51
|
'#{ name }' Failed on #{ RUBY_PLATFORM }
|
data/lib/backup/cli/utility.rb
CHANGED
@@ -57,7 +57,7 @@ module Backup
|
|
57
57
|
# and finding trigger names matching wildcard
|
58
58
|
triggers = options[:trigger].split(",")
|
59
59
|
triggers.map!(&:strip).map! {|t|
|
60
|
-
t.include?('*') ? Model.find_matching(t) : t
|
60
|
+
t.include?('*') ? Model.find_matching(t).map(&:trigger) : t
|
61
61
|
}.flatten!
|
62
62
|
|
63
63
|
##
|
@@ -173,7 +173,7 @@ module Backup
|
|
173
173
|
case options[:encryptor].downcase
|
174
174
|
when 'openssl'
|
175
175
|
base64 = options[:base64] ? '-base64' : ''
|
176
|
-
password = options[:password_file] ? "-pass file:#{options[:password_file]}"
|
176
|
+
password = options[:password_file].empty? ? '' : "-pass file:#{options[:password_file]}"
|
177
177
|
salt = options[:salt] ? '-salt' : ''
|
178
178
|
%x[openssl aes-256-cbc -d #{base64} #{password} #{salt} -in '#{options[:in]}' -out '#{options[:out]}']
|
179
179
|
when 'gpg'
|
@@ -224,7 +224,7 @@ module Backup
|
|
224
224
|
puts "Please wait..\n\n"
|
225
225
|
puts %x[gem install #{options[:install]} -v '#{Backup::Dependency.all[options[:install]][:version]}']
|
226
226
|
end
|
227
|
-
|
227
|
+
|
228
228
|
if options[:installed]
|
229
229
|
puts %x[gem list -i -v '#{Backup::Dependency.all[options[:installed]][:version]}' #{options[:installed]}]
|
230
230
|
end
|
data/lib/backup/dependency.rb
CHANGED
@@ -25,7 +25,7 @@ module Backup
|
|
25
25
|
# for the storage and sets the @packages_to_remove
|
26
26
|
def update_storage_file!
|
27
27
|
packages = yaml_load.unshift(@package)
|
28
|
-
excess = packages.count - @storage.keep
|
28
|
+
excess = packages.count - @storage.keep.to_i
|
29
29
|
@packages_to_remove = (excess > 0) ? packages.pop(excess) : []
|
30
30
|
yaml_save(packages)
|
31
31
|
end
|
@@ -49,7 +49,10 @@ module Backup
|
|
49
49
|
##
|
50
50
|
# Performs the Sync operation
|
51
51
|
def perform!
|
52
|
-
Logger.message(
|
52
|
+
Logger.message(
|
53
|
+
"#{ syncer_name } started the syncing process:\n" +
|
54
|
+
"\s\sConcurrency: #{ @concurrency_type } Level: #{ @concurrency_level }"
|
55
|
+
)
|
53
56
|
|
54
57
|
@directories.each do |directory|
|
55
58
|
SyncContext.new(
|
@@ -124,9 +127,7 @@ module Backup
|
|
124
127
|
##
|
125
128
|
# Returns a String of file paths and their md5 hashes.
|
126
129
|
def local_hashes
|
127
|
-
|
128
|
-
Logger.message("\s\sGenerating checksums for '#{ @directory }'")
|
129
|
-
}
|
130
|
+
Logger.message("\s\sGenerating checksums for '#{ @directory }'")
|
130
131
|
`find #{ @directory } -print0 | xargs -0 openssl md5 2> /dev/null`
|
131
132
|
end
|
132
133
|
|
@@ -196,12 +197,10 @@ module Backup
|
|
196
197
|
def self.new(*args)
|
197
198
|
local_file = super(*args)
|
198
199
|
if local_file.invalid?
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
)
|
204
|
-
}
|
200
|
+
Logger.warn(
|
201
|
+
"\s\s[skipping] #{ local_file.path }\n" +
|
202
|
+
"\s\sPath Contains Invalid UTF-8 byte sequences"
|
203
|
+
)
|
205
204
|
return nil
|
206
205
|
end
|
207
206
|
local_file
|
@@ -214,8 +213,9 @@ module Backup
|
|
214
213
|
def initialize(directory, line)
|
215
214
|
@invalid = false
|
216
215
|
@directory = sanitize(directory)
|
217
|
-
|
218
|
-
|
216
|
+
line = sanitize(line).chomp
|
217
|
+
@path = line.slice(4..-36)
|
218
|
+
@md5 = line.slice(-32..-1)
|
219
219
|
@relative_path = @path.sub(@directory + '/', '')
|
220
220
|
end
|
221
221
|
|
@@ -29,10 +29,8 @@ module Backup
|
|
29
29
|
"#{ syncer_name } started syncing the following directories:\n\s\s" +
|
30
30
|
@directories.join("\n\s\s")
|
31
31
|
)
|
32
|
-
|
33
|
-
|
34
|
-
"#{ directories_option } '#{ dest_path }'")
|
35
|
-
)
|
32
|
+
run("#{ utility(:rsync) } #{ options } " +
|
33
|
+
"#{ directories_option } '#{ dest_path }'")
|
36
34
|
end
|
37
35
|
|
38
36
|
private
|
@@ -13,11 +13,9 @@ module Backup
|
|
13
13
|
|
14
14
|
@directories.each do |directory|
|
15
15
|
Logger.message("#{ syncer_name } started syncing '#{ directory }'.")
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
"'#{ dest_path }'")
|
20
|
-
)
|
16
|
+
run("#{ utility(:rsync) } #{ options } " +
|
17
|
+
"'#{ username }@#{ ip }:#{ directory.sub(/^\~\//, '') }' " +
|
18
|
+
"'#{ dest_path }'")
|
21
19
|
end
|
22
20
|
|
23
21
|
ensure
|
@@ -51,10 +51,8 @@ module Backup
|
|
51
51
|
"#{ syncer_name } started syncing the following directories:\n\s\s" +
|
52
52
|
@directories.join("\n\s\s")
|
53
53
|
)
|
54
|
-
|
55
|
-
|
56
|
-
"'#{ username }@#{ ip }:#{ dest_path }'")
|
57
|
-
)
|
54
|
+
run("#{ utility(:rsync) } #{ options } #{ directories_option } " +
|
55
|
+
"'#{ username }@#{ ip }:#{ dest_path }'")
|
58
56
|
|
59
57
|
ensure
|
60
58
|
remove_password_file!
|
data/lib/backup/version.rb
CHANGED
data/spec/cli/helpers_spec.rb
CHANGED
@@ -29,8 +29,8 @@ describe Backup::CLI::Helpers do
|
|
29
29
|
let(:stdout_messages) { '' }
|
30
30
|
let(:stderr_messages) { '' }
|
31
31
|
|
32
|
-
it 'should generate no additional log messages' do
|
33
|
-
helpers.run(command).should
|
32
|
+
it 'should return stdout and generate no additional log messages' do
|
33
|
+
helpers.run(command).should == ''
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -38,11 +38,11 @@ describe Backup::CLI::Helpers do
|
|
38
38
|
let(:stdout_messages) { "out line1\nout line2\n" }
|
39
39
|
let(:stderr_messages) { '' }
|
40
40
|
|
41
|
-
it 'should log the stdout messages' do
|
41
|
+
it 'should return stdout and log the stdout messages' do
|
42
42
|
Backup::Logger.expects(:message).with(
|
43
43
|
"cmd_name:STDOUT: out line1\ncmd_name:STDOUT: out line2"
|
44
44
|
)
|
45
|
-
helpers.run(command).should
|
45
|
+
helpers.run(command).should == stdout_messages.strip
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -50,11 +50,11 @@ describe Backup::CLI::Helpers do
|
|
50
50
|
let(:stdout_messages) { '' }
|
51
51
|
let(:stderr_messages) { "err line1\nerr line2\n" }
|
52
52
|
|
53
|
-
it 'should log the stderr messages' do
|
53
|
+
it 'should return stdout and log the stderr messages' do
|
54
54
|
Backup::Logger.expects(:warn).with(
|
55
55
|
"cmd_name:STDERR: err line1\ncmd_name:STDERR: err line2"
|
56
56
|
)
|
57
|
-
helpers.run(command).should
|
57
|
+
helpers.run(command).should == ''
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -62,14 +62,14 @@ describe Backup::CLI::Helpers do
|
|
62
62
|
let(:stdout_messages) { "out line1\nout line2\n" }
|
63
63
|
let(:stderr_messages) { "err line1\nerr line2\n" }
|
64
64
|
|
65
|
-
it 'should log both stdout and stderr messages' do
|
65
|
+
it 'should return stdout and log both stdout and stderr messages' do
|
66
66
|
Backup::Logger.expects(:message).with(
|
67
67
|
"cmd_name:STDOUT: out line1\ncmd_name:STDOUT: out line2"
|
68
68
|
)
|
69
69
|
Backup::Logger.expects(:warn).with(
|
70
70
|
"cmd_name:STDERR: err line1\ncmd_name:STDERR: err line2"
|
71
71
|
)
|
72
|
-
helpers.run(command).should
|
72
|
+
helpers.run(command).should == stdout_messages.strip
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end # context 'when the command is successful'
|
data/spec/cli/utility_spec.rb
CHANGED
@@ -14,7 +14,6 @@ describe 'Backup::CLI::Utility' do
|
|
14
14
|
let(:model_a) { Backup::Model.new(:test_trigger_a, 'test label a') }
|
15
15
|
let(:model_b) { Backup::Model.new(:test_trigger_b, 'test label b') }
|
16
16
|
|
17
|
-
before { Backup::Model.all.push(model_a, model_b) }
|
18
17
|
after { Backup::Model.all.clear }
|
19
18
|
|
20
19
|
it 'should perform the backup for the given trigger' do
|
@@ -63,6 +62,31 @@ describe 'Backup::CLI::Utility' do
|
|
63
62
|
end.not_to raise_error
|
64
63
|
end
|
65
64
|
|
65
|
+
it 'should perform backups for the multiple triggers when using wildcard' do
|
66
|
+
Backup::Logger.expects(:quiet=).in_sequence(s)
|
67
|
+
Backup::Config.expects(:update).in_sequence(s)
|
68
|
+
Backup::Config.expects(:load_config!).in_sequence(s)
|
69
|
+
|
70
|
+
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.log_path)
|
71
|
+
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.cache_path)
|
72
|
+
FileUtils.expects(:mkdir_p).in_sequence(s).with(Backup::Config.tmp_path)
|
73
|
+
|
74
|
+
Backup::Logger.expects(:truncate!)
|
75
|
+
|
76
|
+
model_a.expects(:prepare!).in_sequence(s)
|
77
|
+
model_a.expects(:perform!).in_sequence(s)
|
78
|
+
Backup::Logger.expects(:clear!).in_sequence(s)
|
79
|
+
|
80
|
+
model_b.expects(:prepare!).in_sequence(s)
|
81
|
+
model_b.expects(:perform!).in_sequence(s)
|
82
|
+
Backup::Logger.expects(:clear!).in_sequence(s)
|
83
|
+
|
84
|
+
expect do
|
85
|
+
ARGV.replace(['perform', '-t', 'test_trigger_*'])
|
86
|
+
cli.start
|
87
|
+
end.not_to raise_error
|
88
|
+
end
|
89
|
+
|
66
90
|
context 'when errors occur' do
|
67
91
|
it 'should log the error and exit' do
|
68
92
|
Backup::Logger.stubs(:quiet=).raises(SystemCallError, 'yikes!')
|
@@ -305,6 +329,19 @@ describe 'Backup::CLI::Utility' do
|
|
305
329
|
# cli.start
|
306
330
|
# end
|
307
331
|
#
|
332
|
+
# it 'should omit -pass option if no --password-file given' do
|
333
|
+
# ARGV.replace(['decrypt', '--encryptor', 'openssl',
|
334
|
+
# '--in', 'in_file',
|
335
|
+
# '--out', 'out_file',
|
336
|
+
# '--base64', '--salt'])
|
337
|
+
#
|
338
|
+
# cli.any_instance.expects(:`).with(
|
339
|
+
# "openssl aes-256-cbc -d -base64 -salt " +
|
340
|
+
# "-in 'in_file' -out 'out_file'"
|
341
|
+
# )
|
342
|
+
# cli.start
|
343
|
+
# end
|
344
|
+
#
|
308
345
|
# it 'should perform GnuPG decryption' do
|
309
346
|
# ARGV.replace(['decrypt', '--encryptor', 'gpg',
|
310
347
|
# '--in', 'in_file',
|
data/spec/logger_spec.rb
CHANGED
@@ -74,8 +74,8 @@ describe Backup::Logger do
|
|
74
74
|
it 'sets has_warnings? to true' do
|
75
75
|
subject.stubs(:to_console)
|
76
76
|
subject.stubs(:to_file)
|
77
|
-
expect { subject.warn('warning') }.
|
78
|
-
|
77
|
+
expect { subject.warn('warning') }.
|
78
|
+
to change{ subject.has_warnings? }.from(false).to(true)
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
data/spec/storage/cycler_spec.rb
CHANGED
@@ -26,13 +26,21 @@ describe 'Backup::Storage::Cycler' do
|
|
26
26
|
|
27
27
|
describe 'update_storage_file!' do
|
28
28
|
before do
|
29
|
-
storage.stubs(:keep).returns(2)
|
30
29
|
cycler.instance_variable_set(:@storage, storage)
|
31
30
|
cycler.instance_variable_set(:@package, package)
|
32
31
|
cycler.instance_variable_set(:@storage_file, storage_file)
|
33
32
|
end
|
34
33
|
|
35
34
|
it 'should remove entries and set @packages_to_remove' do
|
35
|
+
storage.stubs(:keep).returns(2)
|
36
|
+
cycler.expects(:yaml_load).in_sequence(s).returns([pkg_a, pkg_b, pkg_c])
|
37
|
+
cycler.expects(:yaml_save).in_sequence(s).with([package, pkg_a])
|
38
|
+
cycler.send(:update_storage_file!)
|
39
|
+
cycler.instance_variable_get(:@packages_to_remove).should == [pkg_b, pkg_c]
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'should typecast the value of keep' do
|
43
|
+
storage.stubs(:keep).returns('2')
|
36
44
|
cycler.expects(:yaml_load).in_sequence(s).returns([pkg_a, pkg_b, pkg_c])
|
37
45
|
cycler.expects(:yaml_save).in_sequence(s).with([package, pkg_a])
|
38
46
|
cycler.send(:update_storage_file!)
|
@@ -55,7 +55,8 @@ describe 'Backup::Syncer::Cloud::Base' do
|
|
55
55
|
syncer.stubs(:repository_object).returns(:a_repository_object)
|
56
56
|
|
57
57
|
Backup::Logger.expects(:message).with(
|
58
|
-
|
58
|
+
"Syncer::Cloud::Base started the syncing process:\n" +
|
59
|
+
"\s\sConcurrency: false Level: 2"
|
59
60
|
)
|
60
61
|
Backup::Logger.expects(:message).with(
|
61
62
|
'Syncer::Cloud::Base Syncing Complete!'
|
@@ -249,15 +250,15 @@ describe 'Backup::Syncer::Cloud::Base' do
|
|
249
250
|
|
250
251
|
describe '#local_hashes' do
|
251
252
|
it 'should collect file paths and MD5 checksums for @directory' do
|
252
|
-
Backup::Syncer::Cloud::Base::MUTEX.expects(:synchronize).yields
|
253
253
|
Backup::Logger.expects(:message).with(
|
254
254
|
"\s\sGenerating checksums for '/dir/to/sync'"
|
255
255
|
)
|
256
256
|
sync_context.expects(:`).with(
|
257
257
|
"find /dir/to/sync -print0 | xargs -0 openssl md5 2> /dev/null"
|
258
|
-
).returns('MD5(tmp/foo)=
|
258
|
+
).returns('MD5(tmp/foo)= 0123456789abcdefghijklmnopqrstuv')
|
259
259
|
|
260
|
-
sync_context.send(:local_hashes).should ==
|
260
|
+
sync_context.send(:local_hashes).should ==
|
261
|
+
'MD5(tmp/foo)= 0123456789abcdefghijklmnopqrstuv'
|
261
262
|
end
|
262
263
|
end
|
263
264
|
|
@@ -305,7 +306,9 @@ describe 'Backup::Syncer::Cloud::Base' do
|
|
305
306
|
|
306
307
|
describe '#sync_file' do
|
307
308
|
let(:local_file) do
|
308
|
-
stub(
|
309
|
+
stub(
|
310
|
+
:path => '/dir/to/sync/sync.file',
|
311
|
+
:md5 => '0123456789abcdefghijklmnopqrstuv')
|
309
312
|
end
|
310
313
|
let(:remote_file) do
|
311
314
|
stub(:path => 'backups/sync/sync.file')
|
@@ -329,7 +332,7 @@ describe 'Backup::Syncer::Cloud::Base' do
|
|
329
332
|
|
330
333
|
context 'when the MD5 checksum matches the remote file' do
|
331
334
|
before do
|
332
|
-
remote_file.stubs(:etag).returns('
|
335
|
+
remote_file.stubs(:etag).returns('0123456789abcdefghijklmnopqrstuv')
|
333
336
|
sync_context.stubs(:remote_files).returns(
|
334
337
|
{ 'sync.file' => remote_file }
|
335
338
|
)
|
@@ -348,7 +351,7 @@ describe 'Backup::Syncer::Cloud::Base' do
|
|
348
351
|
|
349
352
|
context 'when the MD5 checksum does not match the remote file' do
|
350
353
|
before do
|
351
|
-
remote_file.stubs(:etag).returns('
|
354
|
+
remote_file.stubs(:etag).returns('vutsrqponmlkjihgfedcba9876543210')
|
352
355
|
sync_context.stubs(:remote_files).returns(
|
353
356
|
{ 'sync.file' => remote_file }
|
354
357
|
)
|
@@ -436,11 +439,13 @@ describe 'Backup::Syncer::Cloud::Base' do
|
|
436
439
|
describe 'wrapping #initialize and using #sanitize to validate objects' do
|
437
440
|
context 'when the path is valid UTF-8' do
|
438
441
|
let(:local_file) do
|
439
|
-
local_file_class.new(
|
442
|
+
local_file_class.new(
|
443
|
+
'foo',
|
444
|
+
'MD5(foo)= 0123456789abcdefghijklmnopqrstuv'
|
445
|
+
)
|
440
446
|
end
|
441
447
|
|
442
448
|
it 'should return the new object' do
|
443
|
-
Backup::Syncer::Cloud::Base::MUTEX.expects(:synchronize).never
|
444
449
|
Backup::Logger.expects(:warn).never
|
445
450
|
|
446
451
|
local_file.should be_an_instance_of local_file_class
|
@@ -450,11 +455,11 @@ describe 'Backup::Syncer::Cloud::Base' do
|
|
450
455
|
context 'when the path contains invalid UTF-8' do
|
451
456
|
let(:local_file) do
|
452
457
|
local_file_class.new(
|
453
|
-
"/bad/pa\xFFth",
|
458
|
+
"/bad/pa\xFFth",
|
459
|
+
"MD5(/bad/pa\xFFth/to/file)= 0123456789abcdefghijklmnopqrstuv"
|
454
460
|
)
|
455
461
|
end
|
456
462
|
it 'should return nil and log a warning' do
|
457
|
-
Backup::Syncer::Cloud::Base::MUTEX.expects(:synchronize).yields
|
458
463
|
Backup::Logger.expects(:warn).with(
|
459
464
|
"\s\s[skipping] /bad/pa\xEF\xBF\xBDth/to/file\n" +
|
460
465
|
"\s\sPath Contains Invalid UTF-8 byte sequences"
|
@@ -473,20 +478,19 @@ describe 'Backup::Syncer::Cloud::Base' do
|
|
473
478
|
|
474
479
|
before do
|
475
480
|
local_file_class.any_instance.expects(:sanitize).with(:directory).
|
476
|
-
|
481
|
+
returns('/dir/to/sync')
|
477
482
|
local_file_class.any_instance.expects(:sanitize).with(:line).
|
478
|
-
|
483
|
+
returns("MD5(/dir/to/sync/subdir/sync.file)= 0123456789abcdefghijklmnopqrstuv\n")
|
479
484
|
end
|
480
485
|
|
481
486
|
it 'should determine @path, @relative_path and @md5' do
|
482
487
|
local_file.path.should == '/dir/to/sync/subdir/sync.file'
|
483
488
|
local_file.relative_path.should == 'subdir/sync.file'
|
484
|
-
local_file.md5.should == '
|
489
|
+
local_file.md5.should == '0123456789abcdefghijklmnopqrstuv'
|
485
490
|
end
|
486
491
|
|
487
492
|
it 'should return nil if the object is invalid' do
|
488
493
|
local_file_class.any_instance.expects(:invalid?).returns(true)
|
489
|
-
Backup::Syncer::Cloud::Base::MUTEX.expects(:synchronize).yields
|
490
494
|
Backup::Logger.expects(:warn)
|
491
495
|
local_file.should be_nil
|
492
496
|
end
|
@@ -494,7 +498,7 @@ describe 'Backup::Syncer::Cloud::Base' do
|
|
494
498
|
|
495
499
|
describe '#sanitize' do
|
496
500
|
let(:local_file) do
|
497
|
-
local_file_class.new('foo', 'MD5(foo)=
|
501
|
+
local_file_class.new('foo', 'MD5(foo)= 0123456789abcdefghijklmnopqrstuv')
|
498
502
|
end
|
499
503
|
|
500
504
|
it 'should replace any invalid UTF-8 characters' do
|
@@ -101,8 +101,7 @@ describe Backup::Syncer::RSync::Local do
|
|
101
101
|
"rsync options_output '/some/directory' " +
|
102
102
|
"'#{ File.expand_path('~/home/directory') }' " +
|
103
103
|
"'#{ File.expand_path('~/my_backups') }'"
|
104
|
-
)
|
105
|
-
Backup::Logger.expects(:silent).in_sequence(s).with('messages from stdout')
|
104
|
+
)
|
106
105
|
|
107
106
|
syncer.perform!
|
108
107
|
end
|
@@ -43,8 +43,7 @@ describe Backup::Syncer::RSync::Pull do
|
|
43
43
|
syncer.expects(:run).in_sequence(s).with(
|
44
44
|
"rsync options_output 'my_username@123.45.678.90:/some/directory' " +
|
45
45
|
"'#{ File.expand_path('~/my_backups') }'"
|
46
|
-
)
|
47
|
-
Backup::Logger.expects(:silent).in_sequence(s).with('messages from stdout')
|
46
|
+
)
|
48
47
|
|
49
48
|
# second directory - removes leading '~'
|
50
49
|
Backup::Logger.expects(:message).in_sequence(s).with(
|
@@ -53,8 +52,7 @@ describe Backup::Syncer::RSync::Pull do
|
|
53
52
|
syncer.expects(:run).in_sequence(s).with(
|
54
53
|
"rsync options_output 'my_username@123.45.678.90:home/directory' " +
|
55
54
|
"'#{ File.expand_path('~/my_backups') }'"
|
56
|
-
)
|
57
|
-
Backup::Logger.expects(:silent).in_sequence(s).with('messages from stdout')
|
55
|
+
)
|
58
56
|
|
59
57
|
# third directory - does not expand path
|
60
58
|
Backup::Logger.expects(:message).in_sequence(s).with(
|
@@ -63,8 +61,7 @@ describe Backup::Syncer::RSync::Pull do
|
|
63
61
|
syncer.expects(:run).in_sequence(s).with(
|
64
62
|
"rsync options_output 'my_username@123.45.678.90:another/directory' " +
|
65
63
|
"'#{ File.expand_path('~/my_backups') }'"
|
66
|
-
)
|
67
|
-
Backup::Logger.expects(:silent).in_sequence(s).with('messages from stdout')
|
64
|
+
)
|
68
65
|
|
69
66
|
syncer.expects(:remove_password_file!).in_sequence(s)
|
70
67
|
|
@@ -145,8 +145,7 @@ describe Backup::Syncer::RSync::Push do
|
|
145
145
|
"rsync options_output '/some/directory' " +
|
146
146
|
"'#{ File.expand_path('~/home/directory') }' " +
|
147
147
|
"'my_username@123.45.678.90:my_backups'"
|
148
|
-
)
|
149
|
-
Backup::Logger.expects(:silent).in_sequence(s).with('messages from stdout')
|
148
|
+
)
|
150
149
|
|
151
150
|
syncer.expects(:remove_password_file!).in_sequence(s)
|
152
151
|
|
@@ -13,16 +13,17 @@
|
|
13
13
|
##
|
14
14
|
# Global Configuration
|
15
15
|
# Add more (or remove) global configuration below
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
16
|
+
#
|
17
|
+
# Backup::Storage::S3.defaults do |s3|
|
18
|
+
# s3.access_key_id = "my_access_key_id"
|
19
|
+
# s3.secret_access_key = "my_secret_access_key"
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# Backup::Encryptor::OpenSSL.defaults do |encryption|
|
23
|
+
# encryption.password = "my_password"
|
24
|
+
# encryption.base64 = true
|
25
|
+
# encryption.salt = true
|
26
|
+
# end
|
26
27
|
|
27
28
|
##
|
28
29
|
# Load all models from the models directory (after the above global configuration blocks)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.25
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.15.4
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.15.4
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: open4
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,7 +37,12 @@ dependencies:
|
|
32
37
|
version: 1.3.0
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.3.0
|
36
46
|
description:
|
37
47
|
email: meskyanichi@gmail.com
|
38
48
|
executables:
|
@@ -43,7 +53,6 @@ files:
|
|
43
53
|
- .gitignore
|
44
54
|
- .travis.yml
|
45
55
|
- Gemfile
|
46
|
-
- Gemfile.lock
|
47
56
|
- Guardfile
|
48
57
|
- LICENSE.md
|
49
58
|
- README.md
|
@@ -242,14 +251,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
251
|
version: '0'
|
243
252
|
requirements: []
|
244
253
|
rubyforge_project:
|
245
|
-
rubygems_version: 1.8.
|
254
|
+
rubygems_version: 1.8.24
|
246
255
|
signing_key:
|
247
256
|
specification_version: 3
|
248
|
-
summary: Backup is a RubyGem, written for
|
249
|
-
perform backup operations on both your remote and local environments.
|
250
|
-
you with an elegant DSL in Ruby for modeling your backups. Backup has
|
251
|
-
for various databases, storage protocols/services, syncers, compressors,
|
252
|
-
and notifiers which you can mix and match. It was built with modularity,
|
253
|
-
and simplicity in mind.
|
257
|
+
summary: Backup is a RubyGem, written for UNIX-like operating systems, that allows
|
258
|
+
you to easily perform backup operations on both your remote and local environments.
|
259
|
+
It provides you with an elegant DSL in Ruby for modeling your backups. Backup has
|
260
|
+
built-in support for various databases, storage protocols/services, syncers, compressors,
|
261
|
+
encryptors and notifiers which you can mix and match. It was built with modularity,
|
262
|
+
extensibility and simplicity in mind.
|
254
263
|
test_files: []
|
255
|
-
has_rdoc:
|
data/Gemfile.lock
DELETED
@@ -1,127 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
backup (3.0.23)
|
5
|
-
open4 (~> 1.3.0)
|
6
|
-
thor (~> 0.14.6)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: http://rubygems.org/
|
10
|
-
specs:
|
11
|
-
activesupport (3.2.2)
|
12
|
-
i18n (~> 0.6)
|
13
|
-
multi_json (~> 1.0)
|
14
|
-
addressable (2.2.7)
|
15
|
-
builder (3.0.0)
|
16
|
-
diff-lcs (1.1.3)
|
17
|
-
dropbox-sdk (1.2)
|
18
|
-
json
|
19
|
-
excon (0.9.6)
|
20
|
-
faraday (0.7.6)
|
21
|
-
addressable (~> 2.2)
|
22
|
-
multipart-post (~> 1.1)
|
23
|
-
rack (~> 1.1)
|
24
|
-
ffi (1.0.11)
|
25
|
-
fog (1.1.2)
|
26
|
-
builder
|
27
|
-
excon (~> 0.9.0)
|
28
|
-
formatador (~> 0.2.0)
|
29
|
-
mime-types
|
30
|
-
multi_json (~> 1.0.3)
|
31
|
-
net-scp (~> 1.0.4)
|
32
|
-
net-ssh (>= 2.1.3)
|
33
|
-
nokogiri (~> 1.5.0)
|
34
|
-
ruby-hmac
|
35
|
-
formatador (0.2.1)
|
36
|
-
fuubar (1.0.0)
|
37
|
-
rspec (~> 2.0)
|
38
|
-
rspec-instafail (~> 0.2.0)
|
39
|
-
ruby-progressbar (~> 0.0.10)
|
40
|
-
growl (1.0.3)
|
41
|
-
guard (1.0.1)
|
42
|
-
ffi (>= 0.5.0)
|
43
|
-
thor (~> 0.14.6)
|
44
|
-
guard-rspec (0.6.0)
|
45
|
-
guard (>= 0.10.0)
|
46
|
-
hipchat (0.4.1)
|
47
|
-
httparty
|
48
|
-
httparty (0.8.1)
|
49
|
-
multi_json
|
50
|
-
multi_xml
|
51
|
-
i18n (0.6.0)
|
52
|
-
json (1.6.5)
|
53
|
-
libnotify (0.7.2)
|
54
|
-
mail (2.4.4)
|
55
|
-
i18n (>= 0.4.0)
|
56
|
-
mime-types (~> 1.16)
|
57
|
-
treetop (~> 1.4.8)
|
58
|
-
metaclass (0.0.1)
|
59
|
-
mime-types (1.17.2)
|
60
|
-
mocha (0.10.5)
|
61
|
-
metaclass (~> 0.0.1)
|
62
|
-
multi_json (1.0.4)
|
63
|
-
multi_xml (0.4.2)
|
64
|
-
multipart-post (1.1.5)
|
65
|
-
net-scp (1.0.4)
|
66
|
-
net-ssh (>= 1.99.1)
|
67
|
-
net-sftp (2.0.5)
|
68
|
-
net-ssh (>= 2.0.9)
|
69
|
-
net-ssh (2.3.0)
|
70
|
-
nokogiri (1.5.2)
|
71
|
-
open4 (1.3.0)
|
72
|
-
parallel (0.5.16)
|
73
|
-
polyglot (0.3.3)
|
74
|
-
prowler (1.3.1)
|
75
|
-
rack (1.4.1)
|
76
|
-
rb-fsevent (0.9.0)
|
77
|
-
rb-inotify (0.8.8)
|
78
|
-
ffi (>= 0.5.0)
|
79
|
-
rspec (2.9.0)
|
80
|
-
rspec-core (~> 2.9.0)
|
81
|
-
rspec-expectations (~> 2.9.0)
|
82
|
-
rspec-mocks (~> 2.9.0)
|
83
|
-
rspec-core (2.9.0)
|
84
|
-
rspec-expectations (2.9.0)
|
85
|
-
diff-lcs (~> 1.1.3)
|
86
|
-
rspec-instafail (0.2.2)
|
87
|
-
rspec-mocks (2.9.0)
|
88
|
-
ruby-hmac (0.4.0)
|
89
|
-
ruby-progressbar (0.0.10)
|
90
|
-
simple_oauth (0.1.5)
|
91
|
-
thor (0.14.6)
|
92
|
-
timecop (0.3.5)
|
93
|
-
treetop (1.4.10)
|
94
|
-
polyglot
|
95
|
-
polyglot (>= 0.3.1)
|
96
|
-
twitter (2.1.1)
|
97
|
-
activesupport (>= 2.3.9, < 4)
|
98
|
-
faraday (~> 0.7)
|
99
|
-
multi_json (~> 1.0)
|
100
|
-
simple_oauth (~> 0.1)
|
101
|
-
|
102
|
-
PLATFORMS
|
103
|
-
ruby
|
104
|
-
|
105
|
-
DEPENDENCIES
|
106
|
-
backup!
|
107
|
-
dropbox-sdk (~> 1.2.0)
|
108
|
-
fog (~> 1.1.0)
|
109
|
-
fuubar
|
110
|
-
growl
|
111
|
-
guard
|
112
|
-
guard-rspec
|
113
|
-
hipchat (~> 0.4.1)
|
114
|
-
httparty (~> 0.8.1)
|
115
|
-
libnotify
|
116
|
-
mail (~> 2.4.0)
|
117
|
-
mocha
|
118
|
-
net-scp (~> 1.0.4)
|
119
|
-
net-sftp (~> 2.0.5)
|
120
|
-
net-ssh (~> 2.3.0)
|
121
|
-
parallel (~> 0.5.12)
|
122
|
-
prowler (>= 1.3.1)
|
123
|
-
rb-fsevent
|
124
|
-
rb-inotify
|
125
|
-
rspec
|
126
|
-
timecop
|
127
|
-
twitter (>= 1.7.1)
|