Skip to content

Commit

Permalink
Fix definition and process definition of AssetsInstallCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
tobias-93 committed Feb 21, 2023
1 parent 4c9af3b commit 8e191e2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions Command/AssetsInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand All @@ -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
);
Expand All @@ -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 <info>%s</info> mode.', $input->getOption('mode'))));
Expand Down

0 comments on commit 8e191e2

Please sign in to comment.