#!/bin/bash # Change to parent directory of this script SOURCE=${BASH_SOURCE[0]} while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) SOURCE=$(readlink "$SOURCE") [[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located done DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) cd "$DIR/.." # Requires the target project contains a script called _bin/debug. # See https://www.mslinn.com/blog/2022/02/21/jekyll-debugging.html if [ -z "$1" ]; then echo "Error: Please provide the project directory to run the test from." exit 1 fi if [ ! -f "$1/_bin/debug" ]; then echo "Error: $1/_bin/debug does not exist." exit 1 fi GIT_ROOT="$( git rev-parse --show-toplevel )" cd "${GIT_ROOT}" bin/build set -e cd "$1" > /dev/null || exit 1 shift _bin/debug "$@"