mirror of
https://github.com/opdavies/versa.git
synced 2025-01-22 11:37:33 +00:00
Use an Enum for project type conditions
This commit is contained in:
parent
0eb7d1a1b6
commit
44e7f63760
|
@ -4,6 +4,7 @@
|
|||
"versa"
|
||||
],
|
||||
"directories": [
|
||||
"src",
|
||||
"vendor"
|
||||
],
|
||||
"check-requirements": true,
|
||||
|
|
12
src/Enum/ProjectType.php
Normal file
12
src/Enum/ProjectType.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
declare(strict_type=1);
|
||||
|
||||
namespace App\Enum;
|
||||
|
||||
enum ProjectType: string
|
||||
{
|
||||
// PHP.
|
||||
case Drupal = 'drupal';
|
||||
case Sculpin = 'sculpin';
|
||||
}
|
5
versa
5
versa
|
@ -3,6 +3,7 @@
|
|||
<?php
|
||||
require __DIR__.'/vendor/autoload.php';
|
||||
|
||||
use App\Enum\ProjectType;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\SingleCommandApplication;
|
||||
|
@ -52,7 +53,7 @@ $application->setCode(function (InputInterface $input): int {
|
|||
switch ($input->getArgument('command')) {
|
||||
case 'build':
|
||||
switch ($input->getOption('type')) {
|
||||
case 'sculpin':
|
||||
case ProjectType::Sculpin->value:
|
||||
$process = new Process(command: array_filter(['./vendor/bin/sculpin', 'generate', $extraArgs]));
|
||||
$process->setTty(true);
|
||||
$process->setWorkingDirectory($workingDir);
|
||||
|
@ -78,7 +79,7 @@ $application->setCode(function (InputInterface $input): int {
|
|||
$process->run();
|
||||
} else {
|
||||
switch ($input->getOption('type')) {
|
||||
case 'sculpin':
|
||||
case ProjectType::Sculpin->value:
|
||||
$process = new Process(command: array_filter(['./vendor/bin/sculpin', 'generate', '--server', '--watch', $extraArgs]));
|
||||
$process->setTimeout(null);
|
||||
$process->setTty(true);
|
||||
|
|
Loading…
Reference in a new issue