| 
594
 | 
     1 #!/bin/sh
 | 
| 
 | 
     2 # starts up artisan wherever
 | 
| 
 | 
     3 
 | 
| 
 | 
     4 set -e
 | 
| 
 | 
     5 set -u
 | 
| 
 | 
     6 
 | 
| 
 | 
     7 _artisan_path="$(basename "${0}")"
 | 
| 
 | 
     8 if [ ! -f "${_artisan_path}" ]; then
 | 
| 
 | 
     9   _git_root="$(git rev-parse --show-toplevel 2> /dev/null || true)"
 | 
| 
 | 
    10   _hg_root="$(hg root 2> /dev/null || true)"
 | 
| 
 | 
    11 
 | 
| 
 | 
    12   for i in "${_git_root}" "${_hg_root}"; do
 | 
| 
 | 
    13     [ "${i}" = "" ] && continue
 | 
| 
 | 
    14     _new_artisan_path="${i}/${_artisan_path}"
 | 
| 
 | 
    15     if [ -f "${_new_artisan_path}" ]; then
 | 
| 
 | 
    16       _artisan_path="${_new_artisan_path}"
 | 
| 
 | 
    17       break
 | 
| 
 | 
    18     fi
 | 
| 
 | 
    19   done
 | 
| 
 | 
    20 fi
 | 
| 
 | 
    21 
 | 
| 
 | 
    22 exec php "${_artisan_path}" "${@}"
 |