dev command updated

This commit is contained in:
Andras Bacsai 2024-07-06 14:33:59 +02:00
parent 38d9999814
commit f8f0aa171c
3 changed files with 32 additions and 12 deletions

View File

@ -9,13 +9,41 @@
class Dev extends Command
{
protected $signature = 'dev:init';
protected $signature = 'dev {--init} {--generate-openapi}';
protected $description = 'Init the app in dev mode';
protected $description = 'Helper commands for development.';
public function handle()
{
if ($this->option('init')) {
$this->init();
return;
}
if ($this->option('generate-openapi')) {
$this->generateOpenApi();
return;
}
}
public function generateOpenApi()
{
// Generate OpenAPI documentation
echo "Generating OpenAPI documentation.\n";
$process = Process::run(['/var/www/html/vendor/bin/openapi', 'app', '-o', 'openapi.yaml']);
$error = $process->errorOutput();
$error = preg_replace('/^.*an object literal,.*$/m', '', $error);
$error = preg_replace('/^\h*\v+/m', '', $error);
echo $error;
echo $process->output();
}
public function init()
{
// Generate APP_KEY if not exists
if (empty(env('APP_KEY'))) {
echo "Generating APP_KEY.\n";
Artisan::call('key:generate');

View File

@ -1,5 +1,5 @@
#!/command/execlineb -P
foreground { composer -d /var/www/html/ install }
foreground { php /var/www/html/artisan migrate --step }
foreground { php /var/www/html/artisan dev:init }
foreground { php /var/www/html/artisan dev --init }

View File

@ -20,12 +20,6 @@ function help {
compgen -A function | cat -n
}
# function dev:init {
# docker exec coolify bash -c "php artisan migrate --seed"
# echo "Need to update privileges on a few files. I need your password for that."
# sudo chmod -R o+rwx .
# }
# function sync:v3 {
# if [ -z "$1" ]; then
# echo -e "Please provide a version.\n\nExample: run sync:v3 3.12.32"
@ -53,7 +47,6 @@ function sync:bunny {
# bash spin exec -u webuser coolify php artisan schedule:run
# }
# function db {
# bash spin exec -u webuser coolify php artisan db
# }
@ -85,7 +78,7 @@ function coolify:root {
bash spin exec coolify bash
}
function coolify:proxy {
docker exec -ti coolify-proxy sh
docker exec -ti coolify-proxy sh
}
function redis {
@ -100,7 +93,6 @@ function tinker {
bash spin exec -u webuser coolify php artisan tinker
}
# function build:helper {
# act -W .github/workflows/coolify-helper.yml --secret-file .env.secrets
# }