Skip to content

Commit

Permalink
dev command updated
Browse files Browse the repository at this point in the history
  • Loading branch information
andrasbacsai committed Jul 6, 2024
1 parent 38d9999 commit f8f0aa1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 12 deletions.
32 changes: 30 additions & 2 deletions app/Console/Commands/Dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion docker/dev/etc/s6-overlay/s6-rc.d/init-setup/up
Original file line number Diff line number Diff line change
@@ -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 }

10 changes: 1 addition & 9 deletions scripts/run
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
# }
Expand Down Expand Up @@ -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 {
Expand All @@ -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
# }
Expand Down

0 comments on commit f8f0aa1

Please sign in to comment.