Run composer install for install

This commit is contained in:
Oliver Davies 2024-02-19 08:00:00 +00:00
parent 4906322e41
commit dcb600379a
3 changed files with 81 additions and 6 deletions

View file

@ -11,11 +11,10 @@
"symfony/dotenv": "7.0.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "7.0.*",
"symfony/process": "7.0.*",
"symfony/runtime": "7.0.*",
"symfony/yaml": "7.0.*"
},
"require-dev": {
},
"config": {
"allow-plugins": {
"php-http/discovery": true,

63
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "e35f3617f3b9fbf8a1fd858641bffd14",
"content-hash": "ed896bf496f3acf356d14377785d8cfa",
"packages": [
{
"name": "psr/cache",
@ -1843,6 +1843,67 @@
],
"time": "2024-01-29T20:11:03+00:00"
},
{
"name": "symfony/process",
"version": "v7.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "937a195147e0c27b2759ade834169ed006d0bc74"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/937a195147e0c27b2759ade834169ed006d0bc74",
"reference": "937a195147e0c27b2759ade834169ed006d0bc74",
"shasum": ""
},
"require": {
"php": ">=8.2"
},
"type": "library",
"autoload": {
"psr-4": {
"Symfony\\Component\\Process\\": ""
},
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v7.0.3"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-01-23T15:02:46+00:00"
},
{
"name": "symfony/routing",
"version": "v7.0.3",

21
versa
View file

@ -3,10 +3,19 @@
<?php
require __DIR__.'/vendor/autoload.php';
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\SingleCommandApplication;
use Symfony\Component\Process\Process;
$application = new SingleCommandApplication();
$application->addArgument(
name: 'command',
mode: InputArgument::REQUIRED,
description: 'The command to run',
);
$application->addOption(
name: 'type',
mode: InputArgument::OPTIONAL,
@ -15,9 +24,15 @@ $application->addOption(
);
$application->setCode(function (InputInterface $input): int {
dd(
$input->getOption('type'),
);
// TODO: only allow defined commands - build, install, test, run.
switch ($input->getArgument('command')) {
case 'install':
// TODO: Composer in Docker Compose?
$process = new Process(command: ['composer', 'install']);
$process->setTty(true);
$process->run();
break;
}
return 0;
});