upload method

Future<void> upload({
  1. bool isDryRun = false,
  2. required String sourcePath,
  3. required String webServerPath,
})

Implementation

Future<void> upload({
  bool isDryRun = false,
  required String sourcePath,
  required String webServerPath,
}) async {
  await _init();

  if (webServerPath.endsWith('/')) {
    await run(
        '[ -d $webServerPath ] || (echo Directory $webServerPath not found >&2 && false)');
  }

  final rsyncArgs = [
    '-az',
    '-e',
    'ssh ${sshControlArgs.join(' ')}',
    sourcePath,
    // Must have a trailing slash, if want the contents of a folder
    '$sshUser@$host:$webServerPath',
  ];
  if (isDryRun) rsyncArgs.add('--dry-run');
  await runProcess(
    'rsync',
    rsyncArgs,
  );
}