synco 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5836163e56294236c873d3ed73f1f10ae20f164db3339118a3477831e9551f2d
4
- data.tar.gz: 59f01018eaa9cd7bb703efc6f4f23c2c0b2eadc89d031482decf15398417d8cd
3
+ metadata.gz: 2220364fdaf5ff681db98ef502f6ba6cf3564a126881f4836f99c900a11c2683
4
+ data.tar.gz: 0e540bde6b6037f01a2d1afde4e7625e053d548a5ee2abfb773f7338767bb893
5
5
  SHA512:
6
- metadata.gz: 42ec3e6db31d1d9c723509c200a36b41db10a95023374d9a6506704c344e8306090680c1524c08f400a78967f067085e24fb90aaa8dd4fe1014a97a4eb664d32
7
- data.tar.gz: 92577fbd8cde9a481648fffeca5301401e19353fc5d85149e6b19eb8590811093f1f7ba9fd3ccb0c96fa960ab6af4457dd48d62269c53eb184366484985225f7
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,6 +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
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
@@ -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
 
@@ -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 call
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 call
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)
@@ -49,11 +36,11 @@ module Synco
49
36
  end
50
37
 
51
38
  nested :command, {
52
- 'spawn' => Spawn,
53
- 'rotate' => Rotate,
54
- 'prune' => Prune,
55
- 'mount' => Mount,
56
- 'unmount' => Unmount
39
+ "spawn" => Spawn,
40
+ "rotate" => Rotate,
41
+ "prune" => Prune,
42
+ "mount" => Mount,
43
+ "unmount" => Unmount
57
44
  }
58
45
 
59
46
  def call
@@ -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
@@ -1,25 +1,10 @@
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 '../method'
22
- require 'shellwords'
3
+ # Released under the MIT License.
4
+ # Copyright, 2011-2024, by Samuel Williams.
5
+
6
+ require_relative "../method"
7
+ require "shellwords"
23
8
 
24
9
  module Synco
25
10
  module Methods
@@ -48,16 +33,16 @@ module Synco
48
33
 
49
34
  class RSync < Method
50
35
  def default_command
51
- ['rsync']
36
+ ["rsync"]
52
37
  end
53
38
 
54
39
  def initialize(*command, arguments: [], archive: false, stats: nil, **options)
55
40
  if archive
56
- arguments << '--archive'
41
+ arguments << "--archive"
57
42
  end
58
43
 
59
44
  if stats
60
- arguments << '--stats'
45
+ arguments << "--stats"
61
46
  end
62
47
 
63
48
  super
@@ -67,7 +52,7 @@ module Synco
67
52
  def escape(command)
68
53
  case command
69
54
  when Array
70
- command.collect{|arg| escape(arg)}.join(' ')
55
+ command.collect{|arg| escape(arg)}.join(" ")
71
56
  when String
72
57
  command =~ /\s|"|'/ ? command.dump : command
73
58
  else
@@ -88,7 +73,7 @@ module Synco
88
73
  command.pop
89
74
  end
90
75
 
91
- return ['-e', escape(command)]
76
+ return ["-e", escape(command)]
92
77
  end
93
78
 
94
79
  def call(scope)
@@ -131,7 +116,7 @@ module Synco
131
116
 
132
117
  latest_path = File.join("../" * depth, latest_name, directory.path)
133
118
 
134
- return ['--link-dest', latest_path]
119
+ return ["--link-dest", latest_path]
135
120
  end
136
121
 
137
122
  def call(scope)
@@ -143,7 +128,7 @@ module Synco
143
128
  link_arguments = compute_link_arguments(directory, incremental_path)
144
129
 
145
130
  # Create the destination backup directory
146
- target_server.run('mkdir', '-p', target_server.full_path(incremental_path))
131
+ target_server.run("mkdir", "-p", target_server.full_path(incremental_path))
147
132
 
148
133
  master_server.run(
149
134
  *@command,
@@ -159,4 +144,4 @@ module Synco
159
144
  end
160
145
  end
161
146
  end
162
- end
147
+ end