First Commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Wrapper script for SysCMS Docker commands to speed up development.
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory=$true, Position=0)]
|
||||
[string]$Command,
|
||||
|
||||
[Parameter(ValueFromRemainingArguments=$true)]
|
||||
[string[]]$RestArgs
|
||||
)
|
||||
|
||||
$ContainerName = "dockersyscms"
|
||||
$WorkDir = "/app"
|
||||
|
||||
switch ($Command) {
|
||||
"php" {
|
||||
# Pass arguments individually to preserve quoting if possible,
|
||||
# but PowerShell -> Docker -> Linux argument parsing is complex.
|
||||
# Joining with spaces is a reasonable approximation for most CLI args.
|
||||
docker exec -w $WorkDir $ContainerName php $RestArgs
|
||||
}
|
||||
"composer" {
|
||||
docker exec -w $WorkDir $ContainerName composer $RestArgs
|
||||
}
|
||||
"mysql" {
|
||||
$query = $RestArgs -join " "
|
||||
docker exec $ContainerName mysql -u root -proot -D syscms -e "$query"
|
||||
}
|
||||
"test" {
|
||||
docker exec -w $WorkDir $ContainerName php vendor/bin/phpunit $RestArgs
|
||||
}
|
||||
"lint" {
|
||||
docker exec -w $WorkDir $ContainerName vendor/bin/phpcs --standard=PSR12 app/ kernel/ modules/
|
||||
}
|
||||
"fix" {
|
||||
docker exec -w $WorkDir $ContainerName vendor/bin/phpcbf --standard=PSR12 app/ kernel/ modules/
|
||||
}
|
||||
"logs" {
|
||||
docker logs -f --tail 100 $ContainerName
|
||||
}
|
||||
"check" {
|
||||
Write-Host "--- Running Lint ---" -ForegroundColor Cyan
|
||||
docker exec -w $WorkDir $ContainerName vendor/bin/phpcs --standard=PSR12 app/ kernel/ modules/
|
||||
Write-Host "--- Running Tests ---" -ForegroundColor Cyan
|
||||
docker exec -w $WorkDir $ContainerName php vendor/bin/phpunit
|
||||
}
|
||||
default {
|
||||
Write-Host "Unknown command: $Command" -ForegroundColor Red
|
||||
Write-Host "Available commands: php, composer, mysql, test, lint, fix, logs, check" -ForegroundColor Yellow
|
||||
Write-Host "Example: .\sys.ps1 php syscli list"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user