| 16591 |
anikendra |
1 |
#!/usr/bin/env bash
|
|
|
2 |
################################################################################
|
|
|
3 |
#
|
|
|
4 |
# Bake is a shell script for running CakePHP bake script
|
|
|
5 |
#
|
|
|
6 |
# CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
|
|
7 |
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
|
8 |
#
|
|
|
9 |
# Licensed under The MIT License
|
|
|
10 |
# For full copyright and license information, please see the LICENSE.txt
|
|
|
11 |
# Redistributions of files must retain the above copyright notice.
|
|
|
12 |
#
|
|
|
13 |
# @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
|
14 |
# @link http://cakephp.org CakePHP(tm) Project
|
|
|
15 |
# @package app.Console
|
|
|
16 |
# @since CakePHP(tm) v 1.2.0.5012
|
|
|
17 |
# @license http://www.opensource.org/licenses/mit-license.php MIT License
|
|
|
18 |
#
|
|
|
19 |
################################################################################
|
|
|
20 |
|
|
|
21 |
# Canonicalize by following every symlink of the given name recursively
|
|
|
22 |
canonicalize() {
|
|
|
23 |
NAME="$1"
|
|
|
24 |
if [ -f "$NAME" ]
|
|
|
25 |
then
|
|
|
26 |
DIR=$(dirname -- "$NAME")
|
|
|
27 |
NAME=$(cd -P "$DIR" && pwd -P)/$(basename -- "$NAME")
|
|
|
28 |
fi
|
|
|
29 |
while [ -h "$NAME" ]; do
|
|
|
30 |
DIR=$(dirname -- "$NAME")
|
|
|
31 |
SYM=$(readlink "$NAME")
|
|
|
32 |
NAME=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
|
|
|
33 |
done
|
|
|
34 |
echo "$NAME"
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
CONSOLE=$(dirname -- "$(canonicalize "$0")")
|
|
|
38 |
APP=$(dirname "$CONSOLE")
|
|
|
39 |
|
|
|
40 |
exec php -q "$CONSOLE"/cake.php -working "$APP" "$@"
|
|
|
41 |
exit
|