@@ 420-436 (lines=17) @@ | ||
417 | * @param string $destination |
|
418 | * @param array $config |
|
419 | */ |
|
420 | function upload($source, $destination, array $config = []) |
|
421 | { |
|
422 | $rsync = Deployer::get()->rsync; |
|
423 | $host = Context::get()->getHost(); |
|
424 | $source = parse($source); |
|
425 | $destination = parse($destination); |
|
426 | ||
427 | if ($host instanceof Localhost) { |
|
428 | $rsync->call($host->getHostname(), $source, $destination, $config); |
|
429 | } else { |
|
430 | $sshArguments = $host->getSshArguments()->getCliArguments(); |
|
431 | if (empty($sshArguments) === false) { |
|
432 | $config['options'] = ["-e 'ssh $sshArguments'"]; |
|
433 | } |
|
434 | $rsync->call($host->getHostname(), $source, "$host:$destination", $config); |
|
435 | } |
|
436 | } |
|
437 | ||
438 | /** |
|
439 | * Download file or directory from host |
|
@@ 445-461 (lines=17) @@ | ||
442 | * @param string $source |
|
443 | * @param array $config |
|
444 | */ |
|
445 | function download($source, $destination, array $config = []) |
|
446 | { |
|
447 | $rsync = Deployer::get()->rsync; |
|
448 | $host = Context::get()->getHost(); |
|
449 | $source = parse($source); |
|
450 | $destination = parse($destination); |
|
451 | ||
452 | if ($host instanceof Localhost) { |
|
453 | $rsync->call($host->getHostname(), $source, $destination, $config); |
|
454 | } else { |
|
455 | $sshArguments = $host->getSshArguments()->getCliArguments(); |
|
456 | if (empty($sshArguments) === false) { |
|
457 | $config['options'] = ["-e 'ssh $sshArguments'"]; |
|
458 | } |
|
459 | $rsync->call($host->getHostname(), "$host:$source", $destination, $config); |
|
460 | } |
|
461 | } |
|
462 | ||
463 | /** |
|
464 | * Writes a message to the output and adds a newline at the end. |