2012-03-16 00:20:39 +00:00
|
|
|
#!/usr/bin/env bash
|
2008-05-30 11:40:08 +00:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# Bake is a shell script for running CakePHP bake script
|
|
|
|
#
|
2010-01-26 22:15:15 +00:00
|
|
|
# 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)
|
2008-05-30 11:40:08 +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
|
2008-05-30 11:40:08 +00:00
|
|
|
# Redistributions of files must retain the above copyright notice.
|
|
|
|
#
|
2013-05-30 22:11:14 +00:00
|
|
|
# @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
|
|
|
|
# @link http://cakephp.org CakePHP(tm) Project
|
|
|
|
# @package Cake.Console
|
|
|
|
# @since CakePHP(tm) v 1.2.0.5012
|
|
|
|
# @license http://www.opensource.org/licenses/mit-license.php MIT License
|
2008-05-30 11:40:08 +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-19 22:35:56 +00:00
|
|
|
NAME="$1"
|
2012-12-19 01:31:57 +00:00
|
|
|
if [ -f "$NAME" ]
|
|
|
|
then
|
2012-12-19 22:35:56 +00:00
|
|
|
DIR=$(dirname -- "$NAME")
|
2014-05-19 16:05:28 +00:00
|
|
|
NAME=$(cd -P "$DIR" > /dev/null && pwd -P)/$(basename -- "$NAME")
|
2012-12-19 01:31:57 +00:00
|
|
|
fi
|
2012-10-25 23:12:29 +00:00
|
|
|
while [ -h "$NAME" ]; do
|
|
|
|
DIR=$(dirname -- "$NAME")
|
|
|
|
SYM=$(readlink "$NAME")
|
2014-05-19 16:05:28 +00:00
|
|
|
NAME=$(cd "$DIR" > /dev/null && cd $(dirname -- "$SYM") > /dev/null && pwd)/$(basename -- "$SYM")
|
2012-10-25 23:12:29 +00:00
|
|
|
done
|
|
|
|
echo "$NAME"
|
|
|
|
}
|
2011-10-15 02:45:26 +00:00
|
|
|
|
2012-12-19 22:35:56 +00:00
|
|
|
CONSOLE=$(dirname -- "$(canonicalize "$0")")
|
2008-05-30 11:40:08 +00:00
|
|
|
APP=`pwd`
|
|
|
|
|
2012-12-19 22:35:56 +00:00
|
|
|
exec php -q "$CONSOLE"/cake.php -working "$APP" "$@"
|
|
|
|
exit
|