mirror of
https://github.com/opdavies/build-configs.git
synced 2025-09-07 11:55:33 +01:00
Replace just
with run
This commit is contained in:
parent
bfe0117e5e
commit
75bbef2dc9
5 changed files with 96 additions and 107 deletions
93
run
Executable file
93
run
Executable file
|
@ -0,0 +1,93 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Do not edit this file. It is automatically generated by https://www.oliverdavies.uk/build-configs.
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
export PATH="$PATH:./vendor/bin"
|
||||
|
||||
function build {
|
||||
nix build .
|
||||
}
|
||||
|
||||
function ci:test {
|
||||
composer install
|
||||
test:snapshots
|
||||
test --testdox
|
||||
}
|
||||
|
||||
function clean {
|
||||
rm -fr dist/* tmp vendor vendor-bin/box/vendor
|
||||
touch dist/.keep var/.keep
|
||||
}
|
||||
|
||||
function create-snapshot {
|
||||
local config="$1"
|
||||
|
||||
config_file="tests/snapshots/configs/$config.yaml"
|
||||
output_path="tests/snapshots/output/$config"
|
||||
|
||||
cat "$config_file"
|
||||
|
||||
rm -fr "$output_path"
|
||||
|
||||
./bin/build-configs app:generate --config-file "$config_file" --output-dir "$output_path"
|
||||
|
||||
git status "$output_path"
|
||||
}
|
||||
|
||||
# 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"
|
||||
}
|
||||
|
||||
function test {
|
||||
phpunit "$@"
|
||||
}
|
||||
|
||||
function test:snapshots {
|
||||
rm -rf .ignored/snapshots
|
||||
mkdir -p .ignored/snapshots
|
||||
|
||||
local configs=(
|
||||
# TODO: add more configurations for different types and configurations.
|
||||
drupal
|
||||
drupal-commerce-kickstart
|
||||
drupal-localgov
|
||||
fractal
|
||||
)
|
||||
|
||||
for config in "${configs[@]}"; do
|
||||
config_file="tests/snapshots/configs/$config.yaml"
|
||||
input_path="tests/snapshots/output/$config"
|
||||
output_path=".ignored/snapshots/output/$config"
|
||||
|
||||
cat "${config_file}"
|
||||
|
||||
./bin/build-configs app:generate --config-file "$config_file" --output-dir "$output_path"
|
||||
|
||||
find "$input_path" -type f -print0 | while IFS= read -r -d '' original_file; do
|
||||
generated_file="${output_path}/${original_file#"${input_path}"/}"
|
||||
|
||||
if cmp -s "$original_file" "$generated_file"; then
|
||||
echo "Files match: $original_file"
|
||||
else
|
||||
# TODO: show the diff for all failed files. This will stop after the first failure.
|
||||
echo "Files do not match: $original_file"
|
||||
diff "$original_file" "$generated_file"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
TIMEFORMAT=$'\nTask completed in %3lR'
|
||||
time "${@:-help}"
|
||||
|
||||
# vim: ft=bash
|
Loading…
Add table
Add a link
Reference in a new issue