2012-03-16 00:20:39 +00:00
|
|
|
#!/usr/bin/env bash
|
2010-10-16 05:15:22 +00:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# Bake is a shell script for running CakePHP bake script
|
|
|
|
# PHP 5
|
|
|
|
#
|
|
|
|
# CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
2013-02-08 12:26:18 +00:00
|
|
|
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2010-10-16 05:15:22 +00:00
|
|
|
#
|
|
|
|
# Licensed under The MIT License
|
2013-02-08 12:26:18 +00:00
|
|
|
# For full copyright and license information, please see the LICENSE.txt
|
2010-10-16 05:15:22 +00:00
|
|
|
# Redistributions of files must retain the above copyright notice.
|
|
|
|
#
|
2013-02-08 12:28:17 +00:00
|
|
|
# @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
2012-06-06 06:46:00 +00:00
|
|
|
# @link http://cakephp.org CakePHP(tm) Project
|
2013-02-08 13:41:57 +00:00
|
|
|
# @package app.Console
|
2012-12-22 23:23:01 +00:00
|
|
|
# @since CakePHP(tm) v 1.2.0.5012
|
2012-06-06 06:46:00 +00:00
|
|
|
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
2010-10-16 05:15:22 +00:00
|
|
|
#
|
|
|
|
################################################################################
|
2011-10-15 02:45:26 +00:00
|
|
|
|
2012-10-25 23:12:29 +00:00
|
|
|
# Canonicalize by following every symlink of the given name recursively
|
|
|
|
canonicalize() {
|
2012-12-22 23:23:01 +00:00
|
|
|
NAME="$1"
|
|
|
|
if [ -f "$NAME" ]
|
|
|
|
then
|
|
|
|
DIR=$(dirname -- "$NAME")
|
|
|
|
NAME=$(cd -P "$DIR" && pwd -P)/$(basename -- "$NAME")
|
|
|
|
fi
|
2012-10-25 23:12:29 +00:00
|
|
|
while [ -h "$NAME" ]; do
|
|
|
|
DIR=$(dirname -- "$NAME")
|
|
|
|
SYM=$(readlink "$NAME")
|
|
|
|
NAME=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
|
|
|
|
done
|
|
|
|
echo "$NAME"
|
|
|
|
}
|
2011-10-15 02:45:26 +00:00
|
|
|
|
2012-12-22 23:23:01 +00:00
|
|
|
CONSOLE=$(dirname -- "$(canonicalize "$0")")
|
2013-01-06 21:09:07 +00:00
|
|
|
APP=$(dirname "$CONSOLE")
|
2010-10-16 05:15:22 +00:00
|
|
|
|
2012-12-22 23:23:01 +00:00
|
|
|
exec php -q "$CONSOLE"/cake.php -working "$APP" "$@"
|
|
|
|
exit
|