mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-08 14:28:57 +02:00
[Nostromo] Refactor some tasks, add new tests
This commit is contained in:
+5
-5
@@ -18,25 +18,25 @@ use Mage\Task\AbstractTask;
|
||||
*
|
||||
* @author Andrés Montañez <andresmontanez@gmail.com>
|
||||
*/
|
||||
class GenerateAutoloadTask extends AbstractTask
|
||||
class DumpAutoloadTask extends AbstractTask
|
||||
{
|
||||
public function getName()
|
||||
{
|
||||
return 'composer/generate-autoload';
|
||||
return 'composer/dump-autoload';
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return '[Composer] Generate Autoload';
|
||||
return '[Composer] Dump Autoload';
|
||||
}
|
||||
|
||||
public function execute()
|
||||
{
|
||||
$options = $this->getOptions();
|
||||
$command = $options['path'] . ' dumpautoload ' . $options['flags'];
|
||||
$command = sprintf('%s dump-autoload %s', $options['path'], $options['flags']);
|
||||
|
||||
/** @var Process $process */
|
||||
$process = $this->runtime->runCommand($command);
|
||||
$process = $this->runtime->runCommand(trim($command));
|
||||
|
||||
return $process->isSuccessful();
|
||||
}
|
||||
@@ -33,10 +33,10 @@ class InstallTask extends AbstractTask
|
||||
public function execute()
|
||||
{
|
||||
$options = $this->getOptions();
|
||||
$command = trim($options['path'] . ' install ' . $options['flags']);
|
||||
$command = sprintf('%s install %s', $options['path'], $options['flags']);
|
||||
|
||||
/** @var Process $process */
|
||||
$process = $this->runtime->runCommand($command);
|
||||
$process = $this->runtime->runCommand(trim($command));
|
||||
|
||||
return $process->isSuccessful();
|
||||
}
|
||||
@@ -45,7 +45,7 @@ class InstallTask extends AbstractTask
|
||||
{
|
||||
$userOptions = $this->runtime->getConfigOptions('composer', []);
|
||||
$options = array_merge(
|
||||
['path' => 'composer', 'flags' => ''],
|
||||
['path' => 'composer', 'flags' => '--optimize-autoloader'],
|
||||
(is_array($userOptions) ? $userOptions : []),
|
||||
$this->options
|
||||
);
|
||||
|
||||
@@ -33,20 +33,22 @@ class AsseticDumpTask extends AbstractTask
|
||||
public function execute()
|
||||
{
|
||||
$options = $this->getOptions();
|
||||
$command = $options['console'] . ' assetic:dump --env=' . $options['env'] . ' ' . $options['flags'];
|
||||
$command = sprintf('%s assetic:dump --env=%s %s', $options['console'], $options['env'], $options['flags']);
|
||||
|
||||
/** @var Process $process */
|
||||
$process = $this->runtime->runCommand($command);
|
||||
$process = $this->runtime->runCommand(trim($command));
|
||||
|
||||
return $process->isSuccessful();
|
||||
}
|
||||
|
||||
protected function getOptions()
|
||||
{
|
||||
$userOptions = $this->runtime->getConfigOptions('symfony', []);
|
||||
$userGlobalOptions = $this->runtime->getConfigOptions('symfony', []);
|
||||
$userEnvironmentOptions = $this->runtime->getEnvironmentConfig('symfony', []);
|
||||
$options = array_merge(
|
||||
['console' => 'bin/console', 'env' => 'dev', 'flags' => ''],
|
||||
(is_array($userOptions) ? $userOptions : []),
|
||||
(is_array($userGlobalOptions) ? $userGlobalOptions : []),
|
||||
(is_array($userEnvironmentOptions) ? $userEnvironmentOptions : []),
|
||||
$this->options
|
||||
);
|
||||
|
||||
|
||||
@@ -33,20 +33,22 @@ class AssetsInstallTask extends AbstractTask
|
||||
public function execute()
|
||||
{
|
||||
$options = $this->getOptions();
|
||||
$command = $options['console'] . ' assets:install --env=' . $options['env'] . ' ' . $options['flags'] . ' ' . $options['target'];
|
||||
$command = sprintf('%s assets:install %s --env=%s %s', $options['console'], $options['target'], $options['env'], $options['flags']);
|
||||
|
||||
/** @var Process $process */
|
||||
$process = $this->runtime->runCommand($command);
|
||||
$process = $this->runtime->runCommand(trim($command));
|
||||
|
||||
return $process->isSuccessful();
|
||||
}
|
||||
|
||||
protected function getOptions()
|
||||
{
|
||||
$userOptions = $this->runtime->getConfigOptions('symfony', []);
|
||||
$userGlobalOptions = $this->runtime->getConfigOptions('symfony', []);
|
||||
$userEnvironmentOptions = $this->runtime->getEnvironmentConfig('symfony', []);
|
||||
$options = array_merge(
|
||||
['console' => 'bin/console', 'env' => 'dev', 'target' => 'web', 'flags' => '--symlink --relative'],
|
||||
(is_array($userOptions) ? $userOptions : []),
|
||||
(is_array($userGlobalOptions) ? $userGlobalOptions : []),
|
||||
(is_array($userEnvironmentOptions) ? $userEnvironmentOptions : []),
|
||||
$this->options
|
||||
);
|
||||
|
||||
|
||||
@@ -36,17 +36,19 @@ class CacheClearTask extends AbstractTask
|
||||
$command = $options['console'] . ' cache:clear --env=' . $options['env'] . ' ' . $options['flags'];
|
||||
|
||||
/** @var Process $process */
|
||||
$process = $this->runtime->runCommand($command);
|
||||
$process = $this->runtime->runCommand(trim($command));
|
||||
|
||||
return $process->isSuccessful();
|
||||
}
|
||||
|
||||
protected function getOptions()
|
||||
{
|
||||
$userOptions = $this->runtime->getConfigOptions('symfony', []);
|
||||
$userGlobalOptions = $this->runtime->getConfigOptions('symfony', []);
|
||||
$userEnvironmentOptions = $this->runtime->getEnvironmentConfig('symfony', []);
|
||||
$options = array_merge(
|
||||
['console' => 'bin/console', 'env' => 'dev', 'flags' => ''],
|
||||
(is_array($userOptions) ? $userOptions : []),
|
||||
(is_array($userGlobalOptions) ? $userGlobalOptions : []),
|
||||
(is_array($userEnvironmentOptions) ? $userEnvironmentOptions : []),
|
||||
$this->options
|
||||
);
|
||||
|
||||
|
||||
@@ -36,17 +36,19 @@ class CacheWarmupTask extends AbstractTask
|
||||
$command = $options['console'] . ' cache:warmup --env=' . $options['env'] . ' ' . $options['flags'];
|
||||
|
||||
/** @var Process $process */
|
||||
$process = $this->runtime->runCommand($command);
|
||||
$process = $this->runtime->runCommand(trim($command));
|
||||
|
||||
return $process->isSuccessful();
|
||||
}
|
||||
|
||||
protected function getOptions()
|
||||
{
|
||||
$userOptions = $this->runtime->getConfigOptions('symfony', []);
|
||||
$userGlobalOptions = $this->runtime->getConfigOptions('symfony', []);
|
||||
$userEnvironmentOptions = $this->runtime->getEnvironmentConfig('symfony', []);
|
||||
$options = array_merge(
|
||||
['console' => 'bin/console', 'env' => 'dev', 'flags' => ''],
|
||||
(is_array($userOptions) ? $userOptions : []),
|
||||
(is_array($userGlobalOptions) ? $userGlobalOptions : []),
|
||||
(is_array($userEnvironmentOptions) ? $userEnvironmentOptions : []),
|
||||
$this->options
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user