build-configs/templates/php/sculpin/run.twig
Oliver Davies 4e255cd667 Ensure run.local files are located relative to the
...run file

Prevent erroring if `run` is being executed within a sub-directory, like
`assets`.
2024-07-31 01:20:30 +01:00

45 lines
824 B
Twig
Executable file

#!/usr/bin/env bash
# {{ managedText | raw }}
set -o errexit
set -o nounset
set -o pipefail
PATH="${PATH}:./vendor/bin"
# Generate the site.
function generate {
local args=()
if [[ "${APP_ENV:-}" == "production" ]]; then
args=(--env="prod")
else
args=(--server --watch)
fi
sculpin generate "${args[@]}" "${@}"
}
function help {
printf "%s <task> [args]\n\nTasks:\n" "${0}"
compgen -A function | grep -v "^_" | cat -n
printf "\nExtended help:\n Each task has comments for general usage\n"
}
# Start the project.
function start {
sculpin generate --server --watch "${@}"
}
# Include any local tasks.
# https://stackoverflow.com/a/6659698
[[ -e "${BASH_SOURCE%/*}/run.local" ]] && source "${BASH_SOURCE%/*}/run.local"
TIMEFORMAT="Task completed in %3lR"
time "${@:-help}"
# vim: ft=bash