magallanes/src/Task/BuiltIn/Symfony/AssetsInstallTask.php

54 lines
1.2 KiB
PHP
Raw Normal View History

2016-12-31 07:52:25 +01:00
<?php
2022-04-10 06:20:03 +02:00
2016-12-31 07:52:25 +01:00
/*
* 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.
*/
namespace Mage\Task\BuiltIn\Symfony;
use Symfony\Component\Process\Process;
/**
* Symfony Task - Install Assets
*
* @author Andrés Montañez <andresmontanez@gmail.com>
*/
2017-04-14 20:43:27 +02:00
class AssetsInstallTask extends AbstractSymfonyTask
2016-12-31 07:52:25 +01:00
{
2022-04-10 06:20:03 +02:00
public function getName(): string
2016-12-31 07:52:25 +01:00
{
return 'symfony/assets-install';
}
2022-04-10 06:20:03 +02:00
public function getDescription(): string
2016-12-31 07:52:25 +01:00
{
return '[Symfony] Assets Install';
}
2022-04-10 06:20:03 +02:00
public function execute(): bool
2016-12-31 07:52:25 +01:00
{
$options = $this->getOptions();
2022-04-10 06:20:03 +02:00
$command = sprintf(
'%s assets:install %s --env=%s %s',
$options['console'],
$options['target'],
$options['env'],
$options['flags']
);
2016-12-31 07:52:25 +01:00
$process = $this->runtime->runCommand(trim($command));
2016-12-31 07:52:25 +01:00
return $process->isSuccessful();
}
2022-04-10 06:20:03 +02:00
protected function getSymfonyOptions(): array
2016-12-31 07:52:25 +01:00
{
2017-04-14 20:43:27 +02:00
return ['target' => 'web', 'flags' => '--symlink --relative'];
2016-12-31 07:52:25 +01:00
}
}