From 8e191e24c8e48d89913cb71f6372dc40ca4cfb9f Mon Sep 17 00:00:00 2001 From: Tobias Feijten Date: Tue, 21 Feb 2023 19:03:07 +0100 Subject: [PATCH] Fix definition and process definition of AssetsInstallCommand --- Command/AssetsInstallCommand.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Command/AssetsInstallCommand.php b/Command/AssetsInstallCommand.php index c33ba91..3de1523 100644 --- a/Command/AssetsInstallCommand.php +++ b/Command/AssetsInstallCommand.php @@ -3,7 +3,6 @@ namespace Admingenerator\GeneratorBundle\Command; use Admingenerator\GeneratorBundle\Filesystem\RelativePathComputer; -use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -18,9 +17,11 @@ * Automatically call bower install to properly import bowers components. * Push them to the web root directory */ -#[AsCommand(name: 'admin:assets-install', description: 'Fetch bower declared dependencies and push them into web root directory')] class AssetsInstallCommand extends Command { + protected static $defaultName = 'admin:assets-install'; + protected static $defaultDescription = 'Fetch bower declared dependencies and push them into web root directory'; + public function __construct(private readonly string $projectDir) { parent::__construct(); @@ -44,7 +45,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $formatter = $this->getHelperSet()->get('formatter'); $cmd = sprintf( - '%s --config.directory=%s', + '%s %s --config.directory=%s', + $input->getOption('bower-bin'), $input->getOption('mode'), $targetDir ); @@ -53,7 +55,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln($formatter->formatSection('Bower', sprintf('Running command %s with argument %s', $input->getOption('bower-bin'), $cmd))); } - $process = new Process([$input->getOption('bower-bin') => $cmd]); + $process = Process::fromShellCommandline($cmd); $process->setTimeout(300); $process->setWorkingDirectory($bowerFileLocation); $output->writeln($formatter->formatSection('Bower', sprintf('Fetching vendors using the %s mode.', $input->getOption('mode'))));