build-configs/run

59 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
2023-11-22 21:43:07 +00:00
set -o errexit
set -o pipefail
export PATH=$PATH:./bin:./vendor/bin:./vendor-bin/box/vendor/bin
# Delete any temporary or generated files.
function clean {
2023-11-29 19:27:06 +00:00
rm -fr dist/* tmp vendor vendor-bin/box/vendor
2023-11-29 19:56:04 +00:00
touch dist/.keep var/.keep
}
# Build the phar version of build-configs.
function build {
clean
# Install dependencies.
composer validate
composer install --no-dev --prefer-dist --optimize-autoloader
composer install --prefer-dist --optimize-autoloader --working-dir ./vendor-bin/box
2023-11-29 21:31:37 +00:00
nix develop --command composer dump-env prod
2023-11-29 21:27:02 +00:00
2023-11-29 21:34:19 +00:00
nix develop --command build-configs cache:clear
nix develop --command build-configs cache:warmup
2023-11-29 21:27:02 +00:00
# Generate the phar file.
box compile --config box.json.dist
rm -f .env.local.php
2023-11-29 09:25:21 +00:00
tree dist/
# TODO: build a Nix derivation and add it to the store.
}
2023-11-06 01:17:53 +00:00
function ci:test {
nix develop --command composer install
nix develop --command phpunit
}
# Display a list of all available commands.
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"
}
2023-11-22 21:46:26 +00:00
function test {
phpunit "${@}"
}
TIMEFORMAT=$'\nTask completed in %3lR'
time "${@:-help}"