#!/usr/bin/env bash 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 { rm -fr dist/* tmp vendor vendor-bin/box/vendor touch dist/.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 # Generate the phar file. box compile --config box.json.dist rm .env.local.php tree dist/ # TODO: build a Nix derivation and add it to the store. } function ci:test { nix develop --command composer install nix develop --command phpunit } # Display a list of all available commands. function help { printf "%s [args]\n\nTasks:\n" "${0}" compgen -A function | grep -v "^_" | cat -n printf "\nExtended help:\n Each task has comments for general usage\n" } function test { phpunit "${@}" } TIMEFORMAT=$'\nTask completed in %3lR' time "${@:-help}"