Class: KuberKit::Shell::RsyncCommands
- Defined in:
- lib/kuber_kit/shell/rsync_commands.rb
Instance Method Summary collapse
Instance Method Details
#rsync(shell, source_path, target_path, exclude: nil) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/kuber_kit/shell/rsync_commands.rb', line 2 def rsync(shell, source_path, target_path, exclude: nil) # Add a trailing slash to directory to have behavior similar to CP command if path_is_directory?(source_path) && !source_path.end_with?("/") source_path = "#{source_path}/" end args = [source_path, target_path] if exclude args << "--exclude=#{exclude}" end shell.exec!(%Q{rsync -a #{args.join(' ')}}) end |