Update build configuration files

This commit is contained in:
Oliver Davies 2024-07-20 13:57:25 +01:00
parent 1e1b3af879
commit d18bf2242f
2 changed files with 19 additions and 0 deletions

View file

@ -12,3 +12,7 @@ export DRUSH_OPTIONS_URI="https://${COMPOSE_PROJECT_NAME}.docker.localhost"
export MYSQL_DATABASE=app export MYSQL_DATABASE=app
export MYSQL_PASSWORD=app export MYSQL_PASSWORD=app
export MYSQL_USER=app export MYSQL_USER=app
export DB_NAME="$MYSQL_DATABASE"
export DB_PASSWORD="$MYSQL_PASSWORD"
export DB_USER="$MYSQL_USER"

15
run
View file

@ -39,22 +39,34 @@ function cmd {
docker compose exec php "${@}" docker compose exec php "${@}"
} }
# Run coding standards checks.
function coding-standards { function coding-standards {
cmd phpcs "${@}" cmd phpcs "${@}"
} }
# Execute any Composer command.
function composer { function composer {
_exec php composer "${@}" _exec php composer "${@}"
} }
# Connect to the database.
function db {
[[ -f ".env" ]] && source .env
docker compose exec database mysql -u"$DB_USER" -p"$DB_PASSWORD" "$DB_NAME"
}
# Execute any Drush command.
function drush { function drush {
_exec php drush "${@}" _exec php drush "${@}"
} }
# Disable Git hooks.
function git-hooks:off { function git-hooks:off {
git config --unset core.hooksPath git config --unset core.hooksPath
} }
# Enable Git hooks.
function git-hooks:on { function git-hooks:on {
git config core.hooksPath .githooks git config core.hooksPath .githooks
} }
@ -73,16 +85,19 @@ function install {
drush site:install -y "${@}" drush site:install -y "${@}"
} }
# Lint the Dockerfile.
function lint:dockerfile { function lint:dockerfile {
docker container run --rm -i \ docker container run --rm -i \
hadolint/hadolint hadolint --ignore DL3008 --ignore DL3022 --ignore DL3059 -t style "${@}" - < Dockerfile hadolint/hadolint hadolint --ignore DL3008 --ignore DL3022 --ignore DL3059 -t style "${@}" - < Dockerfile
} }
# Run code quality checks.
function quality { function quality {
coding-standards coding-standards
static-analysis static-analysis
} }
# Start the project.
function start { function start {
cp -v --no-clobber .env.example .env || true cp -v --no-clobber .env.example .env || true