changeset 594:2ac0fa5ba73c

Add artisan convenience script
author nanaya <me@myconan.net>
date Wed, 02 Nov 2016 04:03:09 +0900
parents 23e326f74bfd
children 0e72765944d4
files bin/artisan
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/artisan	Wed Nov 02 04:03:09 2016 +0900
@@ -0,0 +1,23 @@
+#!/bin/sh
+# License: MIT (nanaya <me@myconan.net>)
+# starts up artisan wherever
+
+set -e
+set -u
+
+_artisan_path="$(basename "${0}")"
+if [ ! -f "${_artisan_path}" ]; then
+  _git_root="$(git rev-parse --show-toplevel 2> /dev/null || true)"
+  _hg_root="$(hg root 2> /dev/null || true)"
+
+  for i in "${_git_root}" "${_hg_root}"; do
+    [ "${i}" = "" ] && continue
+    _new_artisan_path="${i}/${_artisan_path}"
+    if [ -f "${_new_artisan_path}" ]; then
+      _artisan_path="${_new_artisan_path}"
+      break
+    fi
+  done
+fi
+
+exec php "${_artisan_path}" "${@}"