2024-10-18 12:33:36 +04:00
|
|
|
#!/bin/bash
|
|
|
|
# -*- coding: utf-8 mode: sh -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
|
|
|
source "$(dirname -- "$0")/../load.sh" || exit 1
|
|
|
|
|
|
|
|
PROJDIR=
|
|
|
|
while true; do
|
|
|
|
cwd="$(pwd)"
|
|
|
|
if [ -f .runphp.conf ]; then
|
|
|
|
PROJDIR="$cwd"
|
|
|
|
break
|
|
|
|
elif [ -f composer.json ]; then
|
|
|
|
PROJDIR="$cwd"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
if [ "$cwd" == "$HOME" -o "$cwd" == / ]; then
|
|
|
|
die "Impossible de trouver un projet PHP"
|
|
|
|
fi
|
|
|
|
cd ..
|
|
|
|
done
|
|
|
|
|
2024-10-18 15:37:29 +04:00
|
|
|
case "$MYNAME" in
|
|
|
|
composer) set -- composer "$@";;
|
|
|
|
esac
|
|
|
|
|
2024-10-18 12:33:36 +04:00
|
|
|
export RUNPHP_STANDALONE=
|
|
|
|
RUNPHP=; DIST=; REGISTRY=
|
|
|
|
if [ -f "$PROJDIR/.runphp.conf" ]; then
|
|
|
|
source "$PROJDIR/.runphp.conf"
|
|
|
|
[ -n "$RUNPHP" ] && exec "$PROJDIR/$RUNPHP" "$@"
|
|
|
|
elif [ -f "$PROJDIR/sbin/runphp" ]; then
|
|
|
|
exec "$PROJDIR/sbin/runphp" "$@"
|
2024-10-18 15:28:55 +04:00
|
|
|
elif [ -f "$PROJDIR/runphp" ]; then
|
|
|
|
exec "$PROJDIR/runphp" "$@"
|
2024-10-18 12:33:36 +04:00
|
|
|
fi
|
|
|
|
|
2024-10-18 15:28:55 +04:00
|
|
|
export RUNPHP_STANDALONE="$NULIBDIR"
|
2024-10-18 12:33:36 +04:00
|
|
|
export RUNPHP_PROJDIR="$PROJDIR"
|
|
|
|
export RUNPHP_REGISTRY="$REGISTRY"
|
|
|
|
export RUNPHP_DIST="$DIST"
|
2024-10-18 15:28:55 +04:00
|
|
|
exec "$MYDIR/../runphp/runphp" "$@"
|