Refactor is Docker Compose check

This commit is contained in:
Oliver Davies 2024-02-20 00:46:48 +00:00
parent 9228a223fa
commit f01f7b422d

8
versa
View file

@ -41,11 +41,13 @@ $application->addOption(
);
$application->setCode(function (InputInterface $input): int {
$filesystem = new Filesystem();
$extraArgs = $input->getOption('extra-args');
$workingDir = $input->getOption('working-dir');
$filesystem = new Filesystem();
$isDockerCompose = $filesystem->exists($workingDir.'/docker-compose.yaml');
// TODO: only allow defined commands - build, install, test, run.
switch ($input->getArgument('command')) {
case 'install':
@ -57,7 +59,7 @@ $application->setCode(function (InputInterface $input): int {
break;
case 'run':
if ($filesystem->exists($workingDir.'/docker-compose.yaml')) {
if ($isDockerCompose) {
$process = new Process(command: array_filter(['docker', 'compose', 'up', $extraArgs]));
$process->setTimeout(null);
$process->setTty(true);