synco 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +4 -0
- data/.simplecov +9 -0
- data/.travis.yml +14 -0
- data/Gemfile +11 -0
- data/README.md +246 -0
- data/Rakefile +8 -0
- data/bin/synco +30 -0
- data/lib/synco.rb +51 -0
- data/lib/synco/command.rb +71 -0
- data/lib/synco/command/disk.rb +55 -0
- data/lib/synco/command/prune.rb +166 -0
- data/lib/synco/command/rotate.rb +86 -0
- data/lib/synco/command/spawn.rb +39 -0
- data/lib/synco/compact_formatter.rb +115 -0
- data/lib/synco/controller.rb +119 -0
- data/lib/synco/directory.rb +60 -0
- data/lib/synco/disk.rb +68 -0
- data/lib/synco/method.rb +56 -0
- data/lib/synco/methods/rsync.rb +162 -0
- data/lib/synco/methods/scp.rb +44 -0
- data/lib/synco/methods/zfs.rb +60 -0
- data/lib/synco/scope.rb +247 -0
- data/lib/synco/script.rb +128 -0
- data/lib/synco/server.rb +90 -0
- data/lib/synco/shell.rb +44 -0
- data/lib/synco/shells/ssh.rb +52 -0
- data/lib/synco/version.rb +23 -0
- data/media/LSync Logo.artx/Preview/preview.png +0 -0
- data/media/LSync Logo.artx/QuickLook/Preview.pdf +0 -0
- data/media/LSync Logo.artx/doc.thread +0 -0
- data/media/LSync Logo.png +0 -0
- data/spec/synco/backup_script.rb +63 -0
- data/spec/synco/directory_spec.rb +33 -0
- data/spec/synco/local_backup.rb +56 -0
- data/spec/synco/local_sync.rb +91 -0
- data/spec/synco/method_spec.rb +62 -0
- data/spec/synco/rsync_spec.rb +89 -0
- data/spec/synco/scp_spec.rb +58 -0
- data/spec/synco/script_spec.rb +51 -0
- data/spec/synco/shell_spec.rb +42 -0
- data/spec/synco/usb_spec.rb +76 -0
- data/spec/synco/zfs_spec.rb +50 -0
- data/synco.gemspec +35 -0
- metadata +254 -0
@@ -0,0 +1,62 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
|
3
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'synco/scope'
|
24
|
+
require 'synco/methods/scp'
|
25
|
+
|
26
|
+
require_relative 'backup_script'
|
27
|
+
|
28
|
+
describe Synco::Methods::SCP do
|
29
|
+
include_context "backup script"
|
30
|
+
|
31
|
+
let(:test_server) {ENV.fetch('TEST_SERVER', 'localhost')}
|
32
|
+
|
33
|
+
let(:script) {Synco::Script.new}
|
34
|
+
let(:logger) {Logger.new($stderr)}
|
35
|
+
let(:master_server) {Synco::Server.new('localhost', root: master_path)}
|
36
|
+
let(:target_server) {Synco::Server.new(test_server, root: target_path)}
|
37
|
+
|
38
|
+
let(:group) {Process::Group.new}
|
39
|
+
let(:script_scope) {Synco::ScriptScope.new(script, logger, group)}
|
40
|
+
let(:sync_scope) {Synco::TargetScope.new(script_scope, target_server)}
|
41
|
+
|
42
|
+
let(:directory) {Synco::Directory.new(".", arguments: ['--archive'])}
|
43
|
+
let(:directory_scope) {Synco::DirectoryScope.new(sync_scope, directory)}
|
44
|
+
|
45
|
+
# This example shows all the state which goes into one single method invocation:
|
46
|
+
it 'should copy files from master to target' do
|
47
|
+
script.instance_variable_set(:@master_server, master_server)
|
48
|
+
script.instance_variable_set(:@current_server, master_server)
|
49
|
+
|
50
|
+
expect(directory_scope.master_server).to_not be == nil
|
51
|
+
expect(directory_scope.target_server).to_not be == nil
|
52
|
+
expect(directory_scope.current_server).to_not be == nil
|
53
|
+
|
54
|
+
group.wait do
|
55
|
+
Fiber.new do
|
56
|
+
subject.call(directory_scope)
|
57
|
+
end.resume
|
58
|
+
end
|
59
|
+
|
60
|
+
expect(Fingerprint).to be_identical(master_path, target_path)
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
|
3
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'logger'
|
24
|
+
require 'synco/script'
|
25
|
+
require 'synco/scope'
|
26
|
+
require 'synco/methods/rsync'
|
27
|
+
|
28
|
+
require_relative 'backup_script'
|
29
|
+
|
30
|
+
describe Synco::Methods::RSync do
|
31
|
+
include_context "backup script"
|
32
|
+
|
33
|
+
it 'should copy files using rsync' do
|
34
|
+
script = Synco::Script.build do |script|
|
35
|
+
script.method = Synco::Methods::RSync.new(archive: true)
|
36
|
+
|
37
|
+
script.server(:master) do |server|
|
38
|
+
server.root = master_path
|
39
|
+
end
|
40
|
+
|
41
|
+
script.server(:backup) do |server|
|
42
|
+
server.root = target_path
|
43
|
+
end
|
44
|
+
|
45
|
+
script.copy '.'
|
46
|
+
end
|
47
|
+
|
48
|
+
expect(script.method.arguments).to include('--archive')
|
49
|
+
expect(script.method.arguments).to_not include('--stats')
|
50
|
+
|
51
|
+
Synco::Runner.new(script).call
|
52
|
+
|
53
|
+
expect(Fingerprint).to be_identical(master_path, target_path)
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should copy files using rsync snapshot' do
|
57
|
+
script = Synco::Script.build do |script|
|
58
|
+
script.method = Synco::Methods::RSyncSnapshot.new
|
59
|
+
|
60
|
+
script.server(:master) do |server|
|
61
|
+
server.root = master_path
|
62
|
+
end
|
63
|
+
|
64
|
+
script.server(:backup) do |server|
|
65
|
+
server.root = target_path
|
66
|
+
|
67
|
+
server.on(:success) do
|
68
|
+
run SYNCO_PATH, "rotate", chdir: target_server.root
|
69
|
+
run SYNCO_PATH, "prune", chdir: target_server.root
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
script.copy '.', arguments: %W{--archive}
|
74
|
+
end
|
75
|
+
|
76
|
+
expect(script.method.arguments).to include('--archive', '--stats')
|
77
|
+
|
78
|
+
Synco::Runner.new(script).call
|
79
|
+
|
80
|
+
expect(Fingerprint).to be_identical(master_path, File.join(target_path, Synco::LATEST_NAME))
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe Synco::Methods::RSyncSnapshot do
|
85
|
+
it 'should generate correct command for ssh shell' do
|
86
|
+
expect(subject.escape(['ssh', '-o', 'BatchMode=yes'])).to be == 'ssh -o BatchMode=yes'
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
|
3
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'logger'
|
24
|
+
require 'synco/script'
|
25
|
+
require 'synco/scope'
|
26
|
+
require 'synco/methods/scp'
|
27
|
+
|
28
|
+
require_relative 'backup_script'
|
29
|
+
|
30
|
+
describe Synco::Methods::SCP do
|
31
|
+
include_context "backup script"
|
32
|
+
|
33
|
+
it 'should build a script with desired configuration' do
|
34
|
+
script = Synco::Script.build do |script|
|
35
|
+
script.method = Synco::Methods::SCP.new
|
36
|
+
|
37
|
+
script.server(:master) do |server|
|
38
|
+
server.root = master_path
|
39
|
+
end
|
40
|
+
|
41
|
+
script.server(:target) do |server|
|
42
|
+
server.root = target_path
|
43
|
+
end
|
44
|
+
|
45
|
+
script.copy(".")
|
46
|
+
|
47
|
+
script.on(:failure) do |exception|
|
48
|
+
logger.error{exception}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
expect(script.events).to include(:failure)
|
53
|
+
|
54
|
+
Synco::Runner.new(script).call
|
55
|
+
|
56
|
+
expect(Fingerprint).to be_identical(master_path, target_path)
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
|
3
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'logger'
|
24
|
+
require 'synco/script'
|
25
|
+
require 'synco/methods/scp'
|
26
|
+
|
27
|
+
describe Synco::Script do
|
28
|
+
it 'should build a script with desired configuration' do
|
29
|
+
script = Synco::Script.build do |script|
|
30
|
+
script.server(:master) do |server|
|
31
|
+
end
|
32
|
+
|
33
|
+
script.server(:backup) do |server|
|
34
|
+
server.root = 'backup'
|
35
|
+
|
36
|
+
server.on(:prepare) do
|
37
|
+
run "synco", "mount", chdir: server.root
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# After building, everything should be frozen..
|
43
|
+
expect(script).to be_frozen
|
44
|
+
|
45
|
+
# We should have the two servers defined:
|
46
|
+
expect(script.servers).to include(:master, :backup)
|
47
|
+
|
48
|
+
# We should have a single event for backup server:
|
49
|
+
expect(script[:backup].events).to include(:prepare)
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
|
3
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'synco/server'
|
24
|
+
require 'synco/shells/ssh'
|
25
|
+
|
26
|
+
module Synco::ShellSpec
|
27
|
+
describe Synco::Shells::SSH do
|
28
|
+
let(:server) {Synco::Server.new('localhost')}
|
29
|
+
|
30
|
+
it 'should generate a connection command' do
|
31
|
+
expect(subject.connection_command(server)).to be == ['ssh', 'localhost']
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe Synco::Shells::SSH.new(batch_mode: true) do
|
36
|
+
let(:server) {Synco::Server.new('localhost')}
|
37
|
+
|
38
|
+
it 'should generate a connection command with options' do
|
39
|
+
expect(subject.connection_command(server)).to be == ['ssh', '-o', 'BatchMode=yes', 'localhost']
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
|
3
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'synco/disk'
|
24
|
+
require 'synco/methods/rsync'
|
25
|
+
require_relative 'backup_script'
|
26
|
+
|
27
|
+
describe Synco::Methods::RSyncSnapshot, if: Synco::Disk.available?('TEST') do
|
28
|
+
include_context "backup script"
|
29
|
+
|
30
|
+
before(:each) do
|
31
|
+
Synco::Disk.unmount(target_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
after(:each) do
|
35
|
+
Synco::Disk.unmount(target_path)
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should mount and backup to an attached USB stick' do
|
39
|
+
script = Synco::Script.build do |script|
|
40
|
+
script.method = Synco::Methods::RSyncSnapshot.new
|
41
|
+
|
42
|
+
script.master = :source
|
43
|
+
|
44
|
+
script.server(:source) do |server|
|
45
|
+
server.root = master_path
|
46
|
+
end
|
47
|
+
|
48
|
+
script.server(:destination) do |server|
|
49
|
+
server.mountpoint = target_path
|
50
|
+
server.root = target_path
|
51
|
+
|
52
|
+
server.on(:prepare) do
|
53
|
+
target_server.run "synco", "mount", target_server.mountpoint, 'TEST'
|
54
|
+
end
|
55
|
+
|
56
|
+
# Runs after all directories have been successfully backed up.
|
57
|
+
server.on(:success) do
|
58
|
+
run "synco", "rotate", chdir: server.root
|
59
|
+
run "synco", "prune", chdir: server.root
|
60
|
+
end
|
61
|
+
|
62
|
+
server.on(:finish) do
|
63
|
+
target_server.run "synco", "unmount", target_server.mountpoint
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
script.backup('.')
|
68
|
+
end
|
69
|
+
|
70
|
+
Synco::Runner.new(script).call
|
71
|
+
|
72
|
+
Synco::Disk.mount(target_path, 'TEST')
|
73
|
+
|
74
|
+
expect(Fingerprint).to be_identical(master_path, File.join(target_path, Synco::LATEST_NAME))
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
|
3
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
require 'logger'
|
24
|
+
require 'synco/script'
|
25
|
+
require 'synco/scope'
|
26
|
+
require 'synco/methods/zfs'
|
27
|
+
|
28
|
+
describe Synco::Methods::ZFS do
|
29
|
+
xit 'should mirror two ZFS partitions' do
|
30
|
+
script = Synco::Script.build(master: :source) do |script|
|
31
|
+
script.method = Synco::Methods::ZFS.new
|
32
|
+
|
33
|
+
script.server(:master) do |server|
|
34
|
+
server.host = 'hinoki.local'
|
35
|
+
server.root = '/tank/test/source'
|
36
|
+
end
|
37
|
+
|
38
|
+
script.server(:backup) do |server|
|
39
|
+
server.host = 'hinoki.local'
|
40
|
+
server.root = '/tank/test/destination'
|
41
|
+
end
|
42
|
+
|
43
|
+
script.copy("./")
|
44
|
+
end
|
45
|
+
|
46
|
+
Synco::Runner.new(script).call
|
47
|
+
|
48
|
+
expect(Fingerprint).to be_identical(script[:master].root, script[:backup].root)
|
49
|
+
end
|
50
|
+
end
|
data/synco.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'synco/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "synco"
|
8
|
+
spec.version = Synco::VERSION
|
9
|
+
spec.authors = ["Samuel Williams"]
|
10
|
+
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
11
|
+
spec.summary = %q{Synco is a tool for scripted synchronization and backups.}
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency("periodical", "~> 1.1")
|
21
|
+
spec.add_dependency("samovar", "~> 1.2")
|
22
|
+
spec.add_dependency("fingerprint", "~> 2.0")
|
23
|
+
spec.add_dependency("mapping", "~> 1.0")
|
24
|
+
spec.add_dependency("build-files", "~> 1.0")
|
25
|
+
spec.add_dependency("process-group", "~> 1.1")
|
26
|
+
|
27
|
+
spec.add_dependency("lockfile")
|
28
|
+
spec.add_dependency("rainbow", "~> 2.0")
|
29
|
+
|
30
|
+
spec.has_rdoc = "yard"
|
31
|
+
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
34
|
+
spec.add_development_dependency "rake"
|
35
|
+
end
|