Skip to content

Commit

Permalink
fixing up the console scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dogmatic69 committed Nov 11, 2012
1 parent ea67631 commit 909d22b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
24 changes: 12 additions & 12 deletions Console/cake
@@ -1,33 +1,33 @@
#!/bin/bash
#!/usr/bin/env bash
################################################################################
#
# Bake is a shell script for running CakePHP bake script
# PHP 5
#
# CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
# Copyright 2005-2011, Cake Software Foundation, Inc.
# Copyright 2005-2012, Cake Software Foundation, Inc.
#
# Licensed under The MIT License
# Redistributions of files must retain the above copyright notice.
#
# @copyright Copyright 2005-2011, Cake Software Foundation, Inc.
# @link http://cakephp.org CakePHP(tm) Project
# @package app.Console
# @since CakePHP(tm) v 2.0
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
# @copyright Copyright 2005-2012, Cake Software Foundation, Inc.
# @link http://cakephp.org CakePHP(tm) Project
# @package app.Console
# @since CakePHP(tm) v 2.0
# @license MIT License (http://www.opensource.org/licenses/mit-license.php)
#
################################################################################
LIB=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && LIB=$LIB/$(basename -- "$0")

while [ -h "$LIB" ]; do
DIR=$(dirname -- "$LIB")
SYM=$(readlink "$LIB")
LIB=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
DIR=$(dirname -- "$LIB")
SYM=$(readlink "$LIB")
LIB=$(cd "$DIR" && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
done

LIB=$(dirname -- "$LIB")/
APP=`pwd`
APP=$(dirname $(cd $(dirname $0) && pwd))

exec php -q "$LIB"cake.php -working "$APP" "$@"

exit;
exit;
28 changes: 13 additions & 15 deletions Console/cake.php
Expand Up @@ -6,36 +6,34 @@
* PHP 5
*
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
* Copyright 2005-2011, Cake Software Foundation, Inc.
* Copyright 2005-2012, Cake Software Foundation, Inc.
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package app.Console
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
$ds = DIRECTORY_SEPARATOR;
$dispatcher = 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php';
$found = false;
$paths = explode(PATH_SEPARATOR, ini_get('include_path'));

foreach ($paths as $path) {
if (file_exists($path . $ds . $dispatcher)) {
$found = $path;
}
}

if (!$found && function_exists('ini_set')) {
if (function_exists('ini_set')) {
$root = dirname(dirname(dirname(__FILE__)));
ini_set('include_path', $root . $ds. 'lib' . PATH_SEPARATOR . ini_get('include_path'));
$cakeSubmodule = dirname(dirname(__FILE__)) . $ds . 'CakePHP' . $ds . 'lib';
if(is_dir($cakeSubmodule)) {
define('INFINITAS_CAKEPHP_SUBMODULE', true);
ini_set('include_path', $cakeSubmodule . PATH_SEPARATOR . ini_get('include_path'));
} else {
ini_set('include_path', $root . $ds . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
}
}

if (!include($dispatcher)) {
if (!include ($dispatcher)) {
trigger_error('Could not locate CakePHP core files.', E_USER_ERROR);
}
unset($paths, $path, $found, $dispatcher, $root, $ds);
unset($paths, $path, $dispatcher, $root, $ds);

return ShellDispatcher::run($argv);
return ShellDispatcher::run($argv);

0 comments on commit 909d22b

Please sign in to comment.