Skip to content

Commit

Permalink
Improve tar command
Browse files Browse the repository at this point in the history
  • Loading branch information
andres-montanez committed Feb 19, 2021
1 parent d1a89c6 commit eae991d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/Task/BuiltIn/Deploy/Tar/PrepareTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ public function execute()
$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 */
Expand Down
4 changes: 2 additions & 2 deletions tests/Command/BuiltIn/DeployCommandWithReleasesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function testDeploymentWithReleasesWithFromCommands()
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"',
Expand Down Expand Up @@ -189,7 +189,7 @@ public function testDeploymentWithReleasesWithTimeout()
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"',
Expand Down

0 comments on commit eae991d

Please sign in to comment.