cake 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env bash
  2. ################################################################################
  3. #
  4. # Bake is a shell script for running CakePHP bake script
  5. # PHP 5
  6. #
  7. # CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  8. # Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  9. #
  10. # Licensed under The MIT License
  11. # For full copyright and license information, please see the LICENSE.txt
  12. # Redistributions of files must retain the above copyright notice.
  13. #
  14. # @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  15. # @link http://cakephp.org CakePHP(tm) Project
  16. # @package cake.Console
  17. # @since CakePHP(tm) v 1.2.0.5012
  18. # @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  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. CONSOLE=$(dirname -- "$(canonicalize "$0")")
  37. APP=`pwd`
  38. exec php -q "$CONSOLE"/cake.php -working "$APP" "$@"
  39. exit