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