Improve tar command

This commit is contained in:
Andrés Montañez 2021-02-18 22:18:45 -03:00
parent d1a89c6934
commit eae991dc60
2 changed files with 8 additions and 3 deletions

View file

@ -43,7 +43,12 @@ class PrepareTask extends AbstractTask
$excludes = $this->getExcludes();
$tarPath = $this->runtime->getEnvOption('tar_create_path', 'tar');
$flags = $this->runtime->getEnvOption('tar_create', stripos(PHP_OS, 'WIN') === 0 ? '--force-local -c -z -p -f' : 'cfzp');
$from = $this->runtime->getEnvOption('from', './');
$from = './';
if ($fromPath = $this->runtime->getEnvOption('from', false)) {
$from = sprintf('-C %s %s', $fromPath, $from);
}
$cmdTar = sprintf('%s %s %s %s %s', $tarPath, $flags, $tarLocal, $excludes, $from);
/** @var Process $process */

View file

@ -139,7 +139,7 @@ class DeployCommandWithReleasesTest extends TestCase
2 => 'git pull',
3 => 'composer install --optimize-autoloader',
4 => 'composer dump-autoload --optimize',
5 => 'tar cfzp /tmp/mageXYZ --exclude=".git" --exclude="./var/cache/*" --exclude="./var/log/*" --exclude="./web/app_dev.php" ./dist',
5 => 'tar cfzp /tmp/mageXYZ --exclude=".git" --exclude="./var/cache/*" --exclude="./var/log/*" --exclude="./web/app_dev.php" -C ./dist ./',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost "mkdir -p /var/www/test/releases/1234567890"',
7 => 'scp -P 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /tmp/mageXYZ tester@testhost:/var/www/test/releases/1234567890/mageXYZ',
8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost "cd /var/www/test/releases/1234567890 && tar xfzop mageXYZ"',
@ -189,7 +189,7 @@ class DeployCommandWithReleasesTest extends TestCase
2 => 'git pull',
3 => 'composer install --optimize-autoloader',
4 => 'composer dump-autoload --optimize',
5 => 'tar cfzp /tmp/mageXYZ --exclude=".git" --exclude="./var/cache/*" --exclude="./var/log/*" --exclude="./web/app_dev.php" ./',
5 => 'tar cfzp /tmp/mageXYZ --exclude=".git" --exclude="./var/cache/*" --exclude="./var/log/*" --exclude="./web/app_dev.php" -C ./ ./',
6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost "mkdir -p /var/www/test/releases/1234567890"',
7 => 'scp -P 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /tmp/mageXYZ tester@testhost:/var/www/test/releases/1234567890/mageXYZ',
8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost "cd /var/www/test/releases/1234567890 && tar xfzop mageXYZ"',