synco 1.1.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +5 -5
  2. checksums.yaml.gz.sig +3 -0
  3. data/bin/synco +3 -3
  4. data/lib/synco/command/disk.rb +8 -23
  5. data/lib/synco/command/prune.rb +10 -25
  6. data/lib/synco/command/rotate.rb +46 -61
  7. data/lib/synco/command/spawn.rb +10 -25
  8. data/lib/synco/command.rb +23 -35
  9. data/lib/synco/controller.rb +4 -19
  10. data/lib/synco/directory.rb +8 -23
  11. data/lib/synco/disk.rb +4 -19
  12. data/lib/synco/method.rb +11 -26
  13. data/lib/synco/methods/rsync.rb +14 -29
  14. data/lib/synco/methods/scp.rb +8 -23
  15. data/lib/synco/methods/zfs.rb +7 -22
  16. data/lib/synco/scope.rb +33 -68
  17. data/lib/synco/script.rb +15 -32
  18. data/lib/synco/server.rb +9 -24
  19. data/lib/synco/shell.rb +5 -20
  20. data/lib/synco/shells/ssh.rb +10 -25
  21. data/lib/synco/version.rb +5 -20
  22. data/lib/synco.rb +13 -29
  23. data/license.md +21 -0
  24. data/readme.md +248 -0
  25. data.tar.gz.sig +0 -0
  26. metadata +60 -120
  27. metadata.gz.sig +0 -0
  28. data/.gitignore +0 -22
  29. data/.rspec +0 -4
  30. data/.simplecov +0 -9
  31. data/.travis.yml +0 -14
  32. data/Gemfile +0 -11
  33. data/README.md +0 -246
  34. data/Rakefile +0 -8
  35. data/lib/synco/compact_formatter.rb +0 -115
  36. data/media/LSync Logo.artx/Preview/preview.png +0 -0
  37. data/media/LSync Logo.artx/QuickLook/Preview.pdf +0 -0
  38. data/media/LSync Logo.artx/doc.thread +0 -0
  39. data/media/LSync Logo.png +0 -0
  40. data/spec/synco/backup_script.rb +0 -63
  41. data/spec/synco/directory_spec.rb +0 -33
  42. data/spec/synco/local_backup.rb +0 -56
  43. data/spec/synco/local_sync.rb +0 -91
  44. data/spec/synco/method_spec.rb +0 -62
  45. data/spec/synco/rsync_spec.rb +0 -89
  46. data/spec/synco/scp_spec.rb +0 -58
  47. data/spec/synco/script_spec.rb +0 -51
  48. data/spec/synco/shell_spec.rb +0 -42
  49. data/spec/synco/usb_spec.rb +0 -76
  50. data/spec/synco/zfs_spec.rb +0 -50
  51. data/synco.gemspec +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c010b88d796296e7d601db57d7668bea27452bf4
4
- data.tar.gz: 38defa9392d35ccdf751bf407a003492447ba8fc
2
+ SHA256:
3
+ metadata.gz: 2220364fdaf5ff681db98ef502f6ba6cf3564a126881f4836f99c900a11c2683
4
+ data.tar.gz: 0e540bde6b6037f01a2d1afde4e7625e053d548a5ee2abfb773f7338767bb893
5
5
  SHA512:
6
- metadata.gz: 48ced35efeb57e29b8f9e063f171f08af459e58aa1d9f12f16edd59c5dee5b015e6820549ba646e2235b24153d3f46e7ee542377723a489861e0b3f71193febe
7
- data.tar.gz: 7868549488bc957338966e87f1d676e70e064012f47060c6e057fbab3bef12d71206b052cad4431a308bb7c81b452136ab125d9dd8d333b6fbeff39b0efc6641
6
+ metadata.gz: 2c19fc3258b7fa09c588c29161d184783d334e6e9454ef7c9b202c9ae5bc0fb7fe0755a4f2ed9313359e1411e6848b42c619a5a273d1cbdb385ccb2a6f4b6805
7
+ data.tar.gz: 1d9dde6a44640464d8651ebce01acbdadcb470139e665c15985cb10172e1cd47467ad1ec2cb700fcdf9506ba8e4e6e03122f716193c8a039d4bb9e10dcc69b72
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,3 @@
1
+ ��T��5=�6Xo� �ԃ^ʁd͓�H����q��f�+hX��^�Gi������W}j/1�4�����
2
+ _�8�΅��fPa�K�ģ�y(JH:�$��B���}ʒ�CY��:Q���1���;m%`[�����s� .��������J�3�T��|o!Z��A�������$�
3
+
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 'synco/command'
28
+ require "synco/command"
28
29
 
29
- application = Synco::Command::Top.new(ARGV)
30
- application.invoke
30
+ Synco::Command::Top.call
@@ -1,30 +1,15 @@
1
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
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 'samovar'
10
+ require "samovar"
26
11
 
27
- require_relative '../disk'
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 invoke(parent)
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 invoke(parent)
35
+ def call
51
36
  Disk.unmount(@path)
52
37
  end
53
38
  end
@@ -1,33 +1,18 @@
1
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
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 'samovar'
10
+ require "samovar"
26
11
 
27
- require 'periodical/filter'
12
+ require "periodical/filter"
28
13
 
29
14
  # Required for strptime
30
- require 'date'
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: 'old'
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['*'].each do |path|
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 invoke(parent)
126
+ def call
142
127
  backups = current_backups
143
128
 
144
129
  retain, erase = policy.filter(backups, keep: @options[:keep].to_sym, &:time)
@@ -1,86 +1,71 @@
1
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
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 'samovar'
10
+ require "samovar"
26
11
 
27
- require_relative '../method'
12
+ require_relative "../method"
28
13
 
29
14
  module Synco
30
15
  module Command
31
16
  class Rotate < Samovar::Command
32
- self.description = "Rotate a backup snapshot into a timestamped directory."
17
+ self.description = "Rotate a backup snapshot into a timestamped directory."
33
18
 
34
- options do
35
- option "--format <name>", "Set the name of the backup rotations, including strftime expansions.", default: BACKUP_NAME
36
- option "--latest <name>", "The name of the latest backup symlink.", default: LATEST_NAME
37
- option "--snapshot <name>", "The name of the in-progress backup snapshot.", default: SNAPSHOT_NAME
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
- # option "--timezone <name>", "The default timezone for backup timestamps.", default: BACKUP_TIMEZONE
40
- end
24
+ # option "--timezone <name>", "The default timezone for backup timestamps.", default: BACKUP_TIMEZONE
25
+ end
41
26
 
42
- def backup_timestamp
43
- timestamp = Time.now.utc
27
+ def backup_timestamp
28
+ timestamp = Time.now.utc
44
29
 
45
- #if timezone = @options[:timezone]
46
- # timestamp = timestamp.in_time_zone(timezone)
47
- #end
30
+ #if timezone = @options[:timezone]
31
+ # timestamp = timestamp.in_time_zone(timezone)
32
+ #end
48
33
 
49
- return timestamp
50
- end
34
+ return timestamp
35
+ end
51
36
 
52
- def backup_name
53
- backup_timestamp.strftime(@options[:format])
54
- end
37
+ def backup_name
38
+ backup_timestamp.strftime(@options[:format])
39
+ end
55
40
 
56
- def invoke(parent)
57
- snapshot_name = @options[:snapshot]
58
- unless File.exist? snapshot_name
59
- $stderr.puts "Snapshot directory #{snapshot_name} does not exist!"
60
- exit(10)
61
- end
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
- rotated_name = backup_name
64
- if File.exist? rotated_name
65
- $stderr.puts "Destination rotation name #{rotated_name} already exists!"
66
- exit(20)
67
- end
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
- puts "Rotating #{snapshot_name} to #{rotated_name} in #{Dir.pwd}"
54
+ puts "Rotating #{snapshot_name} to #{rotated_name} in #{Dir.pwd}"
70
55
 
71
- # Move rotated dir
72
- FileUtils.mv(snapshot_name, rotated_name)
56
+ # Move rotated dir
57
+ FileUtils.mv(snapshot_name, rotated_name)
73
58
 
74
- # Recreate latest symlink
75
- latest_link = @options[:latest]
76
- if File.symlink?(latest_link)
77
- puts "Removing old latest link..."
78
- FileUtils.rm(latest_link)
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
@@ -1,39 +1,24 @@
1
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
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 'samovar'
10
+ require "samovar"
26
11
 
27
12
  module Synco
28
13
  module Command
29
14
  class Spawn < Samovar::Command
30
- self.description = "Run a command using the synco environment and root directory."
15
+ self.description = "Run a command using the synco environment and root directory."
31
16
 
32
- split :argv, "Command to spawn."
17
+ split :argv, "Command to spawn."
33
18
 
34
- def invoke(parent)
35
- Process.exec(*@argv)
36
- end
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
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
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 'samovar'
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 'command/spawn'
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 '--root <path>', "Work in the given root directory."
39
- option '-h/--help', "Print out help information."
40
- option '-v/--version', "Print out the application version."
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 '<command>',
52
- 'spawn' => Spawn,
53
- 'rotate' => Rotate,
54
- 'prune' => Prune,
55
- 'mount' => Mount,
56
- 'unmount' => Unmount
38
+ nested :command, {
39
+ "spawn" => Spawn,
40
+ "rotate" => Rotate,
41
+ "prune" => Prune,
42
+ "mount" => Mount,
43
+ "unmount" => Unmount
44
+ }
57
45
 
58
- def invoke(program_name: File.basename($0))
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.invoke(self)
53
+ @command.call
66
54
  end
67
55
  end
68
56
  end
@@ -1,22 +1,7 @@
1
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
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.
@@ -1,24 +1,9 @@
1
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
- require_relative 'controller'
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?('/') ? path : path + '/'
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
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
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
- # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
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
- require 'fileutils'
22
- require 'pathname'
23
- require_relative 'controller'
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 = 'latest.snapshot'
27
- LATEST_NAME = 'latest'
28
- BACKUP_NAME = '%Y.%m.%d-%H.%M.%S'
29
- BACKUP_TIMEZONE = 'UTC'
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