42 lines
1.9 KiB
Bash
Executable file
42 lines
1.9 KiB
Bash
Executable file
#!/bin/bash
|
|
# scripts/ontoref — thin wrapper for projects consuming the ontoref protocol
|
|
# Set ONTOREF_ROOT to the ontoref checkout, then delegate to its entry point.
|
|
#
|
|
# Usage: ./scripts/ontoref <command> [args...]
|
|
# Alias: Add `alias ontoref="./scripts/ontoref"` to your shell profile.
|
|
#
|
|
# Required env vars (exported here):
|
|
# ONTOREF_ROOT — absolute path to ontoref checkout
|
|
# ONTOREF_PROJECT_ROOT — absolute path to THIS project root
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
readonly SCRIPT_DIR
|
|
# Constellation layout: scripts/ is inside code/, constellation root is two levels up
|
|
CONSTELLATION_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
|
readonly CONSTELLATION_ROOT
|
|
|
|
# ── Ontoref root ──────────────────────────────────────────────────────────────
|
|
# ontoref is also a constellation; the entry point lives in its code/ sub-repo.
|
|
ONTOREF_ROOT="${ONTOREF_ROOT:-/Users/Akasha/Development/ontoref/code}"
|
|
readonly ONTOREF_ROOT
|
|
|
|
if [[ ! -f "${ONTOREF_ROOT}/ontoref" ]]; then
|
|
echo "ontoref: cannot find ontoref entry point at ${ONTOREF_ROOT}/ontoref"
|
|
echo " Set ONTOREF_ROOT to the correct path or update this script."
|
|
exit 1
|
|
fi
|
|
|
|
# ── Export project context ────────────────────────────────────────────────────
|
|
# ONTOREF_PROJECT_ROOT points to the constellation root so the installed binary
|
|
# finds .ontoref/config.ncl there and expands nickel_import_paths relative to it.
|
|
# Do not pre-set NICKEL_IMPORT_PATH — the delegate loads it from config.ncl.
|
|
|
|
export ONTOREF_ROOT
|
|
export ONTOREF_PROJECT_ROOT="${ONTOREF_PROJECT_ROOT:-${CONSTELLATION_ROOT}}"
|
|
|
|
# Preserve caller name for dispatcher help output
|
|
export ONTOREF_CALLER="${ONTOREF_CALLER:-./scripts/ontoref}"
|
|
|
|
exec "${ONTOREF_ROOT}/ontoref" "$@"
|