Module: RemoteSh::RsyncHelper
- Defined in:
- lib/remote_sh/rsync_helper.rb
Class Method Summary collapse
- .down(from, to, host, _ignore_paths) ⇒ Object
-
.up(from, to, host, _ignore_paths) ⇒ Object
def create_filters(ignore_paths) included_files_arg = “” excluded_files_arg = “”.
Class Method Details
.down(from, to, host, _ignore_paths) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/remote_sh/rsync_helper.rb', line 38 def down(from, to, host, _ignore_paths) # result = `rsync -varz --rsync-path="sudo rsync" #{create_filters(ignore_paths)} #{host}:#{to}/ #{from}/` result = `rsync -azl --safe-links --rsync-path="sudo rsync" -f'- .remote_sh' #{host}:#{to}/ #{from}/` raise result if $?.exitstatus != 0 result end |
.up(from, to, host, _ignore_paths) ⇒ Object
def create_filters(ignore_paths)
included_files_arg = ""
excluded_files_arg = ""
ignore_paths.each do |path|
= "#{WorkspaceConfiguration::WOKRING_DIR}/#{path}"
next unless File.exist?()
File.foreach() do |line|
line = line.strip
next if line.start_with?("#")
if line.start_with?("!")
included_files_arg += "--include='#{line[1..-1]}' "
else
excluded_files_arg += "--exclude='#{line}' "
end
end
end
"#{excluded_files_arg} #{included_files_arg} -f'- .remote_sh'"
end
31 32 33 34 35 36 |
# File 'lib/remote_sh/rsync_helper.rb', line 31 def up(from, to, host, _ignore_paths) # result = `rsync -varz --delete --rsync-path="sudo rsync" #{create_filters(ignore_paths)} #{from}/ #{host}:#{to}/` result = `rsync -azl --safe-links --delete --rsync-path="sudo rsync" -f'- .remote_sh' #{from}/ #{host}:#{to}/` raise result if $?.exitstatus != 0 result end |