synco 1.1.0 → 1.3.0
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.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +3 -0
- data/bin/synco +3 -3
- data/lib/synco/command/disk.rb +8 -23
- data/lib/synco/command/prune.rb +10 -25
- data/lib/synco/command/rotate.rb +46 -61
- data/lib/synco/command/spawn.rb +10 -25
- data/lib/synco/command.rb +23 -35
- data/lib/synco/controller.rb +4 -19
- data/lib/synco/directory.rb +8 -23
- data/lib/synco/disk.rb +4 -19
- data/lib/synco/method.rb +11 -26
- data/lib/synco/methods/rsync.rb +14 -29
- data/lib/synco/methods/scp.rb +8 -23
- data/lib/synco/methods/zfs.rb +7 -22
- data/lib/synco/scope.rb +33 -68
- data/lib/synco/script.rb +15 -32
- data/lib/synco/server.rb +9 -24
- data/lib/synco/shell.rb +5 -20
- data/lib/synco/shells/ssh.rb +10 -25
- data/lib/synco/version.rb +5 -20
- data/lib/synco.rb +13 -29
- data/license.md +21 -0
- data/readme.md +248 -0
- data.tar.gz.sig +0 -0
- metadata +60 -120
- metadata.gz.sig +0 -0
- data/.gitignore +0 -22
- data/.rspec +0 -4
- data/.simplecov +0 -9
- data/.travis.yml +0 -14
- data/Gemfile +0 -11
- data/README.md +0 -246
- data/Rakefile +0 -8
- data/lib/synco/compact_formatter.rb +0 -115
- 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 +0 -63
- data/spec/synco/directory_spec.rb +0 -33
- data/spec/synco/local_backup.rb +0 -56
- data/spec/synco/local_sync.rb +0 -91
- data/spec/synco/method_spec.rb +0 -62
- data/spec/synco/rsync_spec.rb +0 -89
- data/spec/synco/scp_spec.rb +0 -58
- data/spec/synco/script_spec.rb +0 -51
- data/spec/synco/shell_spec.rb +0 -42
- data/spec/synco/usb_spec.rb +0 -76
- data/spec/synco/zfs_spec.rb +0 -50
- data/synco.gemspec +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2220364fdaf5ff681db98ef502f6ba6cf3564a126881f4836f99c900a11c2683
|
4
|
+
data.tar.gz: 0e540bde6b6037f01a2d1afde4e7625e053d548a5ee2abfb773f7338767bb893
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c19fc3258b7fa09c588c29161d184783d334e6e9454ef7c9b202c9ae5bc0fb7fe0755a4f2ed9313359e1411e6848b42c619a5a273d1cbdb385ccb2a6f4b6805
|
7
|
+
data.tar.gz: 1d9dde6a44640464d8651ebce01acbdadcb470139e665c15985cb10172e1cd47467ad1ec2cb700fcdf9506ba8e4e6e03122f716193c8a039d4bb9e10dcc69b72
|
checksums.yaml.gz.sig
ADDED
data/bin/synco
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
5
|
#
|
@@ -24,7 +25,6 @@
|
|
24
25
|
# It then ensures that there is a symlink called "latest" that points
|
25
26
|
# to the renamed directory.
|
26
27
|
|
27
|
-
require
|
28
|
+
require "synco/command"
|
28
29
|
|
29
|
-
|
30
|
-
application.invoke
|
30
|
+
Synco::Command::Top.call
|
data/lib/synco/command/disk.rb
CHANGED
@@ -1,30 +1,15 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2008-2024, by Samuel Williams.
|
20
5
|
|
21
6
|
# This script takes a given path, and renames it with the given format.
|
22
7
|
# It then ensures that there is a symlink called "latest" that points
|
23
8
|
# to the renamed directory.
|
24
9
|
|
25
|
-
require
|
10
|
+
require "samovar"
|
26
11
|
|
27
|
-
require_relative
|
12
|
+
require_relative "../disk"
|
28
13
|
|
29
14
|
module Synco
|
30
15
|
module Command
|
@@ -34,7 +19,7 @@ module Synco
|
|
34
19
|
one :path, "The disk mount point."
|
35
20
|
one :name, "The symbolic name of the disk to mount, e.g. disk label."
|
36
21
|
|
37
|
-
def
|
22
|
+
def call
|
38
23
|
# We may not have permission to make this directory, but we should still try:
|
39
24
|
FileUtils.mkpath(@path) rescue nil
|
40
25
|
|
@@ -47,7 +32,7 @@ module Synco
|
|
47
32
|
|
48
33
|
one :path, "The disk mount point."
|
49
34
|
|
50
|
-
def
|
35
|
+
def call
|
51
36
|
Disk.unmount(@path)
|
52
37
|
end
|
53
38
|
end
|
data/lib/synco/command/prune.rb
CHANGED
@@ -1,33 +1,18 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2009-2024, by Samuel Williams.
|
20
5
|
|
21
6
|
# This script takes a given path, and renames it with the given format.
|
22
7
|
# It then ensures that there is a symlink called "latest" that points
|
23
8
|
# to the renamed directory.
|
24
9
|
|
25
|
-
require
|
10
|
+
require "samovar"
|
26
11
|
|
27
|
-
require
|
12
|
+
require "periodical/filter"
|
28
13
|
|
29
14
|
# Required for strptime
|
30
|
-
require
|
15
|
+
require "date"
|
31
16
|
|
32
17
|
module Synco
|
33
18
|
module Command
|
@@ -79,7 +64,7 @@ module Synco
|
|
79
64
|
option "--format <name>", "Set the name of the backup rotations, including strftime expansions.", default: BACKUP_NAME
|
80
65
|
option "--latest <name>", "The name of the latest backup symlink.", default: LATEST_NAME
|
81
66
|
|
82
|
-
option "--keep <new|old>", "Keep the younger or older backups within the same period division", default:
|
67
|
+
option "--keep <new|old>", "Keep the younger or older backups within the same period division", default: "old"
|
83
68
|
|
84
69
|
option "--dry", "Print out what would be done rather than doing it."
|
85
70
|
end
|
@@ -100,7 +85,7 @@ module Synco
|
|
100
85
|
def current_backups
|
101
86
|
backups = []
|
102
87
|
|
103
|
-
Dir[
|
88
|
+
Dir["*"].each do |path|
|
104
89
|
next if path == @options[:latest]
|
105
90
|
date_string = File.basename(path)
|
106
91
|
|
@@ -138,7 +123,7 @@ module Synco
|
|
138
123
|
end
|
139
124
|
end
|
140
125
|
|
141
|
-
def
|
126
|
+
def call
|
142
127
|
backups = current_backups
|
143
128
|
|
144
129
|
retain, erase = policy.filter(backups, keep: @options[:keep].to_sym, &:time)
|
data/lib/synco/command/rotate.rb
CHANGED
@@ -1,86 +1,71 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2009-2024, by Samuel Williams.
|
20
5
|
|
21
6
|
# This script takes a given path, and renames it with the given format.
|
22
7
|
# It then ensures that there is a symlink called "latest" that points
|
23
8
|
# to the renamed directory.
|
24
9
|
|
25
|
-
require
|
10
|
+
require "samovar"
|
26
11
|
|
27
|
-
require_relative
|
12
|
+
require_relative "../method"
|
28
13
|
|
29
14
|
module Synco
|
30
15
|
module Command
|
31
16
|
class Rotate < Samovar::Command
|
32
|
-
|
17
|
+
self.description = "Rotate a backup snapshot into a timestamped directory."
|
33
18
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
19
|
+
options do
|
20
|
+
option "--format <name>", "Set the name of the backup rotations, including strftime expansions.", default: BACKUP_NAME
|
21
|
+
option "--latest <name>", "The name of the latest backup symlink.", default: LATEST_NAME
|
22
|
+
option "--snapshot <name>", "The name of the in-progress backup snapshot.", default: SNAPSHOT_NAME
|
38
23
|
|
39
|
-
|
40
|
-
|
24
|
+
# option "--timezone <name>", "The default timezone for backup timestamps.", default: BACKUP_TIMEZONE
|
25
|
+
end
|
41
26
|
|
42
|
-
|
43
|
-
|
27
|
+
def backup_timestamp
|
28
|
+
timestamp = Time.now.utc
|
44
29
|
|
45
|
-
|
46
|
-
|
47
|
-
|
30
|
+
#if timezone = @options[:timezone]
|
31
|
+
# timestamp = timestamp.in_time_zone(timezone)
|
32
|
+
#end
|
48
33
|
|
49
|
-
|
50
|
-
|
34
|
+
return timestamp
|
35
|
+
end
|
51
36
|
|
52
|
-
|
53
|
-
|
54
|
-
|
37
|
+
def backup_name
|
38
|
+
backup_timestamp.strftime(@options[:format])
|
39
|
+
end
|
55
40
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
41
|
+
def call
|
42
|
+
snapshot_name = @options[:snapshot]
|
43
|
+
unless File.exist? snapshot_name
|
44
|
+
$stderr.puts "Snapshot directory #{snapshot_name} does not exist!"
|
45
|
+
exit(10)
|
46
|
+
end
|
62
47
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
48
|
+
rotated_name = backup_name
|
49
|
+
if File.exist? rotated_name
|
50
|
+
$stderr.puts "Destination rotation name #{rotated_name} already exists!"
|
51
|
+
exit(20)
|
52
|
+
end
|
68
53
|
|
69
|
-
|
54
|
+
puts "Rotating #{snapshot_name} to #{rotated_name} in #{Dir.pwd}"
|
70
55
|
|
71
|
-
|
72
|
-
|
56
|
+
# Move rotated dir
|
57
|
+
FileUtils.mv(snapshot_name, rotated_name)
|
73
58
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
puts "Creating latest symlink to #{rotated_name}"
|
82
|
-
FileUtils.ln_s(rotated_name, latest_link)
|
59
|
+
# Recreate latest symlink
|
60
|
+
latest_link = @options[:latest]
|
61
|
+
if File.symlink?(latest_link)
|
62
|
+
puts "Removing old latest link..."
|
63
|
+
FileUtils.rm(latest_link)
|
83
64
|
end
|
65
|
+
|
66
|
+
puts "Creating latest symlink to #{rotated_name}"
|
67
|
+
FileUtils.ln_s(rotated_name, latest_link)
|
68
|
+
end
|
84
69
|
end
|
85
70
|
end
|
86
71
|
end
|
data/lib/synco/command/spawn.rb
CHANGED
@@ -1,39 +1,24 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2009-2024, by Samuel Williams.
|
20
5
|
|
21
6
|
# This script takes a given path, and renames it with the given format.
|
22
7
|
# It then ensures that there is a symlink called "latest" that points
|
23
8
|
# to the renamed directory.
|
24
9
|
|
25
|
-
require
|
10
|
+
require "samovar"
|
26
11
|
|
27
12
|
module Synco
|
28
13
|
module Command
|
29
14
|
class Spawn < Samovar::Command
|
30
|
-
|
15
|
+
self.description = "Run a command using the synco environment and root directory."
|
31
16
|
|
32
|
-
|
17
|
+
split :argv, "Command to spawn."
|
33
18
|
|
34
|
-
|
35
|
-
|
36
|
-
|
19
|
+
def call
|
20
|
+
Process.exec(*@argv)
|
21
|
+
end
|
37
22
|
end
|
38
23
|
end
|
39
24
|
end
|
data/lib/synco/command.rb
CHANGED
@@ -1,33 +1,20 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2016-2024, by Samuel Williams.
|
20
5
|
|
21
6
|
# This script takes a given path, and renames it with the given format.
|
22
7
|
# It then ensures that there is a symlink called "latest" that points
|
23
8
|
# to the renamed directory.
|
24
9
|
|
25
|
-
require
|
10
|
+
require "samovar"
|
11
|
+
|
12
|
+
require_relative "command/spawn"
|
13
|
+
require_relative "command/rotate"
|
14
|
+
require_relative "command/prune"
|
15
|
+
require_relative "command/disk"
|
26
16
|
|
27
|
-
require_relative
|
28
|
-
require_relative 'command/rotate'
|
29
|
-
require_relative 'command/prune'
|
30
|
-
require_relative 'command/disk'
|
17
|
+
require_relative "version"
|
31
18
|
|
32
19
|
module Synco
|
33
20
|
module Command
|
@@ -35,9 +22,9 @@ module Synco
|
|
35
22
|
self.description = "A backup and synchronizatio tool."
|
36
23
|
|
37
24
|
options do
|
38
|
-
option
|
39
|
-
option
|
40
|
-
option
|
25
|
+
option "--root <path>", "Work in the given root directory."
|
26
|
+
option "-h/--help", "Print out help information."
|
27
|
+
option "-v/--version", "Print out the application version."
|
41
28
|
end
|
42
29
|
|
43
30
|
def chdir(&block)
|
@@ -48,21 +35,22 @@ module Synco
|
|
48
35
|
end
|
49
36
|
end
|
50
37
|
|
51
|
-
nested
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
38
|
+
nested :command, {
|
39
|
+
"spawn" => Spawn,
|
40
|
+
"rotate" => Rotate,
|
41
|
+
"prune" => Prune,
|
42
|
+
"mount" => Mount,
|
43
|
+
"unmount" => Unmount
|
44
|
+
}
|
57
45
|
|
58
|
-
def
|
46
|
+
def call
|
59
47
|
if @options[:version]
|
60
48
|
puts "synco v#{Synco::VERSION}"
|
61
49
|
elsif @options[:help] or @command.nil?
|
62
50
|
print_usage(program_name)
|
63
51
|
else
|
64
52
|
chdir do
|
65
|
-
@command.
|
53
|
+
@command.call
|
66
54
|
end
|
67
55
|
end
|
68
56
|
end
|
data/lib/synco/controller.rb
CHANGED
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2011-2024, by Samuel Williams.
|
20
5
|
|
21
6
|
module Synco
|
22
7
|
# Basic event handling and delegation.
|
data/lib/synco/directory.rb
CHANGED
@@ -1,24 +1,9 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
20
2
|
|
21
|
-
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2009-2024, by Samuel Williams.
|
5
|
+
|
6
|
+
require_relative "controller"
|
22
7
|
|
23
8
|
module Synco
|
24
9
|
class AbsolutePathError < ArgumentError
|
@@ -28,7 +13,7 @@ module Synco
|
|
28
13
|
# such as excludes and other options may be specified.
|
29
14
|
class Directory < Controller
|
30
15
|
def initialize(path, arguments: [])
|
31
|
-
if path.start_with?(
|
16
|
+
if path.start_with?("/")
|
32
17
|
raise AbsolutePathError.new("#{path} must be relative!")
|
33
18
|
end
|
34
19
|
|
@@ -50,11 +35,11 @@ module Synco
|
|
50
35
|
end
|
51
36
|
|
52
37
|
def self.normalize(path)
|
53
|
-
path.end_with?(
|
38
|
+
path.end_with?("/") ? path : path + "/"
|
54
39
|
end
|
55
40
|
|
56
41
|
def self.depth(path)
|
57
|
-
path.count(
|
42
|
+
path.count("/")
|
58
43
|
end
|
59
44
|
end
|
60
45
|
end
|
data/lib/synco/disk.rb
CHANGED
@@ -1,22 +1,7 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2016-2024, by Samuel Williams.
|
20
5
|
|
21
6
|
module Synco
|
22
7
|
# Depending on how you have things set up, you'll probably want to add
|
data/lib/synco/method.rb
CHANGED
@@ -1,32 +1,17 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
# of this software and associated documentation files (the "Software"), to deal
|
5
|
-
# in the Software without restriction, including without limitation the rights
|
6
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
-
# copies of the Software, and to permit persons to whom the Software is
|
8
|
-
# furnished to do so, subject to the following conditions:
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in
|
11
|
-
# all copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
# THE SOFTWARE.
|
1
|
+
# frozen_string_literal: true
|
20
2
|
|
21
|
-
|
22
|
-
|
23
|
-
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2008-2024, by Samuel Williams.
|
5
|
+
|
6
|
+
require "fileutils"
|
7
|
+
require "pathname"
|
8
|
+
require_relative "controller"
|
24
9
|
|
25
10
|
module Synco
|
26
|
-
SNAPSHOT_NAME =
|
27
|
-
LATEST_NAME =
|
28
|
-
BACKUP_NAME =
|
29
|
-
BACKUP_TIMEZONE =
|
11
|
+
SNAPSHOT_NAME = "latest.snapshot"
|
12
|
+
LATEST_NAME = "latest"
|
13
|
+
BACKUP_NAME = "%Y.%m.%d-%H.%M.%S"
|
14
|
+
BACKUP_TIMEZONE = "UTC"
|
30
15
|
|
31
16
|
# A backup method provides the interface to copy data from one system to another.
|
32
17
|
class Method < Controller
|