Class: LogicalConstruct::RemoteCopyFile
- Inherits:
-
Mattock::Rake::CommandTask
- Object
- Mattock::Rake::CommandTask
- LogicalConstruct::RemoteCopyFile
- Defined in:
- lib/logical-construct/ground-control/setup/copy-files.rb
Instance Method Summary collapse
- #default_configuration(copy) ⇒ Object
- #resolve_configuration ⇒ Object
- #resolve_runtime_configuration ⇒ Object
- #secure_shell_command ⇒ Object
Instance Method Details
#default_configuration(copy) ⇒ Object
12 13 14 15 |
# File 'lib/logical-construct/ground-control/setup/copy-files.rb', line 12 def default_configuration(copy) super self.remote_server = copy.proxy_value.remote_server end |
#resolve_configuration ⇒ Object
17 18 19 20 21 |
# File 'lib/logical-construct/ground-control/setup/copy-files.rb', line 17 def resolve_configuration super self.source_path ||= File::join(source_dir, basename) self.destination_path ||= File::join(destination_dir, basename) end |
#resolve_runtime_configuration ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/logical-construct/ground-control/setup/copy-files.rb', line 30 def resolve_runtime_configuration self.destination_address ||= [remote_server.address, destination_path].join(":") self.command = cmd("rsync") do |rsync| rsync. << "-a" rsync. << "--copy-unsafe-links" rsync. << "-e #{secure_shell_command}" exclude.each do |pattern| rsync. << "--exclude #{pattern}" end rsync. << source_path rsync. << destination_address end super end |
#secure_shell_command ⇒ Object
23 24 25 26 27 28 |
# File 'lib/logical-construct/ground-control/setup/copy-files.rb', line 23 def secure_shell_command escaped_command("ssh") do |ssh| ssh. += RunOnTarget::SSH_OPTIONS.map{|opt| "-o #{opt}"} ssh. << "-l #{remote_server.user}" unless remote_server.user.nil? end end |