Skip to content

Commit

Permalink
Add aliases on most commonly used tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
HedicGuibert committed Oct 18, 2023
1 parent 92014f5 commit 8afe377
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions .castor/infra.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function stop(): void
docker_compose(['stop']);
}

#[AsTask(description: 'Opens a shell (bash) into a builder container')]
#[AsTask(description: 'Opens a shell (bash) into a builder container', aliases: ['builder'])]
function builder(): void
{
$c = get_context()
Expand All @@ -63,19 +63,19 @@ function builder(): void
docker_compose_run('bash', c: $c);
}

#[AsTask(description: 'Displays infrastructure logs')]
#[AsTask(description: 'Displays infrastructure logs', aliases: ['logs'])]
function logs(): void
{
docker_compose(['logs', '-f', '--tail', '150'], c: get_context()->withTty());
}

#[AsTask(description: 'Lists containers status')]
#[AsTask(description: 'Lists containers status', aliases: ['ps'])]
function ps(): void
{
docker_compose(['ps'], withBuilder: false);
}

#[AsTask(description: 'Cleans the infrastructure (remove container, volume, networks)')]
#[AsTask(description: 'Cleans the infrastructure (remove container, volume, networks)', aliases: ['destroy'])]
function destroy(
#[AsOption(description: 'Force the destruction without confirmation', shortcut: 'f')]
bool $force = false,
Expand Down Expand Up @@ -164,7 +164,7 @@ function generate_certificates(
}
}

#[AsTask(description: 'Starts the workers', namespace: 'infra:worker', name: 'start')]
#[AsTask(description: 'Starts the workers', namespace: 'infra:worker', name: 'start', aliases: ['start-workers'])]
function workers_start(): void
{
$workers = get_workers();
Expand All @@ -187,7 +187,7 @@ function workers_start(): void
], quiet: true);
}

#[AsTask(description: 'Stops the workers', namespace: 'infra:worker', name: 'stop')]
#[AsTask(description: 'Stops the workers', namespace: 'infra:worker', name: 'stop', aliases: ['stop-workers'])]
function workers_stop(): void
{
$workers = get_workers();
Expand Down
4 changes: 2 additions & 2 deletions .castor/qa.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ function install(): void
docker_compose_run('composer install -o', workDir: '/home/app/root/tools/phpstan');
}

#[AsTask(description: 'Runs PHPStan')]
#[AsTask(description: 'Runs PHPStan', aliases: ['phpstan'])]
function phpstan(): void
{
docker_compose_run('phpstan --configuration=/home/app/root/phpstan.neon', workDir: '/home/app/application');
}

#[AsTask(description: 'Fixes Coding Style')]
#[AsTask(description: 'Fixes Coding Style', aliases: ['cs'])]
function cs(bool $dryRun = false): void
{
if ($dryRun) {
Expand Down
6 changes: 3 additions & 3 deletions castor.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function start(): void
about();
}

#[AsTask(description: 'Installs the application (composer, yarn, ...)', namespace: 'app')]
#[AsTask(description: 'Installs the application (composer, yarn, ...)', namespace: 'app', aliases: ['install'])]
function install(): void
{
$basePath = sprintf('%s/%s', variable('root_dir'), variable('project_directory'));
Expand All @@ -63,13 +63,13 @@ function install(): void
qa\install();
}

#[AsTask(description: 'Clear the application cache', namespace: 'app')]
#[AsTask(description: 'Clear the application cache', namespace: 'app', aliases: ['cache-clear'])]
function cache_clear(): void
{
// docker_compose_run('rm -rf var/cache/ && bin/console cache:warmup');
}

#[AsTask(description: 'Migrates database schema', namespace: 'app:db')]
#[AsTask(description: 'Migrates database schema', namespace: 'app:db', aliases: ['migrate'])]
function migrate(): void
{
// docker_compose_run('bin/console doctrine:database:create --if-not-exists');
Expand Down

0 comments on commit 8afe377

Please sign in to comment.