mirror of
https://github.com/andres-montanez/Magallanes
synced 2024-06-23 15:50:06 +02:00
Refactor tar gz to reuse function.
This commit is contained in:
parent
f7e2163fed
commit
b869876c26
|
@ -75,25 +75,11 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||||
$result = $this->runCommandLocal($command) && $result;
|
$result = $this->runCommandLocal($command) && $result;
|
||||||
|
|
||||||
// Extract Tar Gz
|
// Extract Tar Gz
|
||||||
if ($this->getConfig()->release('enabled', false) == true) {
|
$this->getReleasesAwareCommand('tar xfz ' . $remoteTarGz . '.tar.gz');
|
||||||
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
|
|
||||||
|
|
||||||
$deployToDirectory = $releasesDirectory . '/' . $this->getConfig()->getReleaseId();
|
|
||||||
$command = 'cd ' . $deployToDirectory . ' && tar xfz ' . $remoteTarGz . '.tar.gz';
|
|
||||||
} else {
|
|
||||||
$command = 'tar xfz ' . $remoteTarGz . '.tar.gz';
|
|
||||||
}
|
|
||||||
$result = $this->runCommandRemote($command) && $result;
|
$result = $this->runCommandRemote($command) && $result;
|
||||||
|
|
||||||
// Delete Tar Gz from Remote Host
|
// Delete Tar Gz from Remote Host
|
||||||
if ($this->getConfig()->release('enabled', false) == true) {
|
$this->getReleasesAwareCommand('rm ' . $remoteTarGz . '.tar.gz');
|
||||||
$releasesDirectory = $this->getConfig()->release('directory', 'releases');
|
|
||||||
|
|
||||||
$deployToDirectory = $releasesDirectory . '/' . $this->getConfig()->getReleaseId();
|
|
||||||
$command = 'rm ' . $deployToDirectory . '/' . $remoteTarGz . '.tar.gz';
|
|
||||||
} else {
|
|
||||||
$command = 'rm ' . $remoteTarGz . '.tar.gz';
|
|
||||||
}
|
|
||||||
$result = $this->runCommandRemote($command) && $result;
|
$result = $this->runCommandRemote($command) && $result;
|
||||||
|
|
||||||
// Delete Tar Gz from Local
|
// Delete Tar Gz from Local
|
||||||
|
@ -137,4 +123,4 @@ class TarGzTask extends BaseStrategyTaskAbstract implements IsReleaseAware
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue