mirror of
https://github.com/opdavies/versa.git
synced 2025-03-13 05:26:56 +00:00
Refactor is Docker Compose check
This commit is contained in:
parent
9228a223fa
commit
f01f7b422d
8
versa
8
versa
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue