Sha256: 06e130fe958f830f04e20d5e9f48158e13e8110e871e6b09345d2303ac5ecf2e

Contents?: true

Size: 528 Bytes

Versions: 9

Compression:

Stored size: 528 Bytes

Contents

class KuberKit::Shell::RsyncCommands
  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

  private
    def path_is_directory?(path)
      File.directory?(path)
    end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
kuber_kit-0.1.8 lib/kuber_kit/shell/rsync_commands.rb
kuber_kit-0.1.7 lib/kuber_kit/shell/rsync_commands.rb
kuber_kit-0.1.6 lib/kuber_kit/shell/rsync_commands.rb
kuber_kit-0.1.5 lib/kuber_kit/shell/rsync_commands.rb
kuber_kit-0.1.4 lib/kuber_kit/shell/rsync_commands.rb
kuber_kit-0.1.3 lib/kuber_kit/shell/rsync_commands.rb
kuber_kit-0.1.2 lib/kuber_kit/shell/rsync_commands.rb
kuber_kit-0.1.1 lib/kuber_kit/shell/rsync_commands.rb
kuber_kit-0.1.0 lib/kuber_kit/shell/rsync_commands.rb