annotate bin/artisan @ 597:fb8bb030a573

Merge
author nanaya <me@myconan.net>
date Wed, 22 Mar 2017 00:29:46 +0900
parents 2ac0fa5ba73c
children cd80bafc1257
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
594
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
1 #!/bin/sh
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
2 # License: MIT (nanaya <me@myconan.net>)
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
3 # starts up artisan wherever
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
4
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
5 set -e
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
6 set -u
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
7
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
8 _artisan_path="$(basename "${0}")"
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
9 if [ ! -f "${_artisan_path}" ]; then
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
10 _git_root="$(git rev-parse --show-toplevel 2> /dev/null || true)"
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
11 _hg_root="$(hg root 2> /dev/null || true)"
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
12
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
13 for i in "${_git_root}" "${_hg_root}"; do
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
14 [ "${i}" = "" ] && continue
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
15 _new_artisan_path="${i}/${_artisan_path}"
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
16 if [ -f "${_new_artisan_path}" ]; then
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
17 _artisan_path="${_new_artisan_path}"
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
18 break
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
19 fi
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
20 done
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
21 fi
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
22
2ac0fa5ba73c Add artisan convenience script
nanaya <me@myconan.net>
parents:
diff changeset
23 exec php "${_artisan_path}" "${@}"