23 lines
795 B
Bash
Executable File
23 lines
795 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Create a fresh, git-initialized sandbox copy of the right fixture for a scenario.
|
|
# Usage: sandbox <S1|S2|S3|S4|S5|S6> <dest-dir>
|
|
set -euo pipefail
|
|
|
|
SCENARIO="${1:?usage: sandbox <scenario> <dest-dir>}"
|
|
DEST="${2:?usage: sandbox <scenario> <dest-dir>}"
|
|
EVAL_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
case "$SCENARIO" in
|
|
S1|S2|S3|S4) FIXTURE="$EVAL_ROOT/fixture/project" ;;
|
|
S5|S6) FIXTURE="$EVAL_ROOT/fixture/legacy-project" ;;
|
|
*) echo "unknown scenario: $SCENARIO" >&2; exit 2 ;;
|
|
esac
|
|
|
|
if [ -e "$DEST" ]; then echo "refusing to overwrite existing $DEST" >&2; exit 2; fi
|
|
mkdir -p "$DEST"
|
|
cp -r "$FIXTURE/." "$DEST/"
|
|
git -C "$DEST" init -q
|
|
git -C "$DEST" add -A
|
|
git -C "$DEST" -c user.email=eval@local -c user.name=eval commit -qm "fixture baseline"
|
|
echo "$DEST"
|