2016-12-31 07:52:25 +01:00
|
|
|
<?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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Mage\Task\BuiltIn\Symfony;
|
|
|
|
|
|
|
|
use Symfony\Component\Process\Process;
|
|
|
|
use Mage\Task\AbstractTask;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Symfony Task - Dump Assetics
|
|
|
|
*
|
|
|
|
* @author Andrés Montañez <andresmontanez@gmail.com>
|
|
|
|
*/
|
|
|
|
class AsseticDumpTask extends AbstractTask
|
|
|
|
{
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return 'symfony/assetic-dump';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDescription()
|
|
|
|
{
|
|
|
|
return '[Symfony] Assetic Dump';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function execute()
|
|
|
|
{
|
|
|
|
$options = $this->getOptions();
|
2017-01-06 00:38:42 +01:00
|
|
|
$command = sprintf('%s assetic:dump --env=%s %s', $options['console'], $options['env'], $options['flags']);
|
2016-12-31 07:52:25 +01:00
|
|
|
|
|
|
|
/** @var Process $process */
|
2017-01-06 00:38:42 +01:00
|
|
|
$process = $this->runtime->runCommand(trim($command));
|
2016-12-31 07:52:25 +01:00
|
|
|
|
|
|
|
return $process->isSuccessful();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getOptions()
|
|
|
|
{
|
|
|
|
$options = array_merge(
|
2016-12-31 21:51:47 +01:00
|
|
|
['console' => 'bin/console', 'env' => 'dev', 'flags' => ''],
|
2017-02-01 15:23:31 +01:00
|
|
|
$this->runtime->getMergedEnvAndConfigOption('symfony', [], []),
|
2016-12-31 07:52:25 +01:00
|
|
|
$this->options
|
|
|
|
);
|
|
|
|
|
|
|
|
return $options;
|
|
|
|
}
|
|
|
|
}
|