10 object Rsync { |
10 object Rsync { |
11 object Context { |
11 object Context { |
12 def apply( |
12 def apply( |
13 progress: Progress = new Progress, |
13 progress: Progress = new Progress, |
14 ssh: SSH.System = SSH.Local, |
14 ssh: SSH.System = SSH.Local, |
|
15 chmod: String = "", |
|
16 chown: String = "", |
15 archive: Boolean = true, |
17 archive: Boolean = true, |
16 stats: Boolean = true |
18 stats: Boolean = true |
17 ): Context = { |
19 ): Context = { |
18 val directory = Components.provide(Component_Rsync.home, ssh = ssh, progress = progress) |
20 val directory = Components.provide(Component_Rsync.home, ssh = ssh, progress = progress) |
19 new Context(directory, progress, archive, stats) |
21 new Context(directory, progress, chmod, chown, archive, stats) |
20 } |
22 } |
21 } |
23 } |
22 |
24 |
23 final class Context private( |
25 final class Context private( |
24 directory: Components.Directory, |
26 directory: Components.Directory, |
25 val progress: Progress, |
27 val progress: Progress, |
|
28 chmod: String, |
|
29 chown: String, |
26 archive: Boolean, |
30 archive: Boolean, |
27 stats: Boolean |
31 stats: Boolean |
28 ) { |
32 ) { |
29 override def toString: String = directory.toString |
33 override def toString: String = directory.toString |
30 |
34 |
34 val program = Component_Rsync.remote_program(directory) |
38 val program = Component_Rsync.remote_program(directory) |
35 val ssh_command = ssh.client_command |
39 val ssh_command = ssh.client_command |
36 File.bash_path(Component_Rsync.local_program) + " --secluded-args" + |
40 File.bash_path(Component_Rsync.local_program) + " --secluded-args" + |
37 if_proper(ssh_command, " --rsh=" + Bash.string(ssh_command)) + |
41 if_proper(ssh_command, " --rsh=" + Bash.string(ssh_command)) + |
38 " --rsync-path=" + Bash.string(quote(File.standard_path(program))) + |
42 " --rsync-path=" + Bash.string(quote(File.standard_path(program))) + |
|
43 if_proper(chmod, " --chmod=" + Bash.string(chmod)) + |
|
44 if_proper(chown, " --chown=" + Bash.string(chown)) + |
39 if_proper(archive, " --archive") + |
45 if_proper(archive, " --archive") + |
40 if_proper(stats, " --stats") |
46 if_proper(stats, " --stats") |
41 } |
47 } |
42 |
48 |
43 def target(path: Path, direct: Boolean = false): String = |
49 def target(path: Path, direct: Boolean = false): String = |