mirror of https://github.com/hauke68/Magallanes
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.2 KiB
49 lines
1.2 KiB
9 years ago
|
<?php
|
||
|
/*
|
||
|
* This file is part of the Magallanes package.
|
||
|
*
|
||
|
* (c) Andrés Montañez <andres@andresmontanez.com>
|
||
|
*
|
||
|
* For the full copyright and license information, please view the LICENSE
|
||
|
* file that was distributed with this source code.
|
||
|
*/
|
||
|
|
||
9 years ago
|
namespace Mage\Task\BuiltIn\Deploy\Tar;
|
||
9 years ago
|
|
||
9 years ago
|
use Mage\Task\Exception\ErrorException;
|
||
9 years ago
|
use Symfony\Component\Process\Process;
|
||
|
use Mage\Task\AbstractTask;
|
||
|
|
||
|
/**
|
||
9 years ago
|
* Tar Task - Delete temporal Tar
|
||
9 years ago
|
*
|
||
|
* @author Andrés Montañez <andresmontanez@gmail.com>
|
||
|
*/
|
||
|
class CleanupTask extends AbstractTask
|
||
|
{
|
||
|
public function getName()
|
||
|
{
|
||
9 years ago
|
return 'deploy/tar/cleanup';
|
||
9 years ago
|
}
|
||
|
|
||
|
public function getDescription()
|
||
|
{
|
||
9 years ago
|
return '[Deploy] Cleanup Tar file';
|
||
9 years ago
|
}
|
||
|
|
||
|
public function execute()
|
||
|
{
|
||
9 years ago
|
if (!$this->runtime->getEnvOption('releases', false)) {
|
||
9 years ago
|
throw new ErrorException('This task is only available with releases enabled', 40);
|
||
9 years ago
|
}
|
||
|
|
||
9 years ago
|
$tarLocal = $this->runtime->getVar('tar_local');
|
||
9 years ago
|
|
||
9 years ago
|
$cmdDeleteTar = sprintf('rm %s', $tarLocal);
|
||
9 years ago
|
|
||
|
/** @var Process $process */
|
||
9 years ago
|
$process = $this->runtime->runLocalCommand($cmdDeleteTar);
|
||
9 years ago
|
return $process->isSuccessful();
|
||
9 years ago
|
}
|
||
|
}
|