Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aliases on most commonly used tasks #247

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'])]
lyrixx marked this conversation as resolved.
Show resolved Hide resolved
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