diff --git a/cake/config/paths.php b/cake/config/paths.php index 43050dfae..fd97412a5 100644 --- a/cake/config/paths.php +++ b/cake/config/paths.php @@ -105,9 +105,9 @@ */ define ('IMAGES', WWW_ROOT.'img'.DS); /** - * Path to the scripts direcotry. + * Path to the console libs direcotry. */ - define('SCRIPTS', CAKE.'scripts'.DS); + define('CONSOLE_LIBS', CAKE.'console'.DS.'libs'.DS); /** * Path to the tests directory. */ diff --git a/cake/console/cake b/cake/console/cake index e6ba5248a..4342d8846 100755 --- a/cake/console/cake +++ b/cake/console/cake @@ -24,12 +24,14 @@ # @license http://www.opensource.org/licenses/mit-license.php The MIT License # ################################################################################ +clear -LIB=${0/%cake/}; -APP=`pwd`/; +LIB=${0/%cake/} +APP=`pwd`/ -exec php -q ${LIB}dispatch.php "$@" -working "${APP}" +echo "Hello $USER," + +exec php -q ${LIB}cake.php "$@" -working "${APP}" echo " "; - exit; \ No newline at end of file diff --git a/cake/console/cake.bat b/cake/console/cake.bat index 8806163fc..6309dd454 100644 --- a/cake/console/cake.bat +++ b/cake/console/cake.bat @@ -6,6 +6,6 @@ SET app=%0 SET lib=%~dp0 -php -q %lib%dispatch.php %* -working "%CD%\" +php -q %lib%cake.php %* -working "%CD%\" echo. \ No newline at end of file diff --git a/cake/console/cake.php b/cake/console/cake.php index 5fc5070f5..e3c1a099b 100644 --- a/cake/console/cake.php +++ b/cake/console/cake.php @@ -93,15 +93,15 @@ class ConsoleDispatcher { * @var string */ var $scriptPath = null; - + /** * The name of the script in lowercase underscore. * * @var string */ - var $scriptName = null; - - + var $scriptName = null; + + /** * Constructs this ConsoleDispatcher instance. * @@ -111,7 +111,7 @@ class ConsoleDispatcher { function ConsoleDispatcher($args = array()) { $this->__construct($args); } - + function __construct($args = array()) { $this->__initConstants(); $this->parseParams($args); @@ -144,7 +144,7 @@ class ConsoleDispatcher { * @return void */ function __initEnvironment() { - + $this->stdin = fopen('php://stdin', 'r'); $this->stdout = fopen('php://stdout', 'w'); $this->stderr = fopen('php://stderr', 'w'); @@ -152,7 +152,7 @@ class ConsoleDispatcher { if (!isset($this->args[0]) || !isset($this->params['working'])) { $this->stdout("\nCakePHP Console: "); $this->stdout('This file has been loaded incorrectly and cannot continue.'); - $this->stdout('Please make sure that ' . DIRECTORY_SEPARATOR . 'cake' . DIRECTORY_SEPARATOR . 'scripts is in your system path,'); + $this->stdout('Please make sure that ' . DIRECTORY_SEPARATOR . 'cake' . DIRECTORY_SEPARATOR . 'console is in your system path,'); $this->stdout('and check the manual for the correct usage of this command.'); $this->stdout('(http://manual.cakephp.org/)'); exit(); @@ -165,20 +165,20 @@ class ConsoleDispatcher { exit(); } } - + if (!$this->__bootstrap()) { $this->stdout("\nCakePHP Console: "); $this->stdout("\nUnable to load Cake core:"); $this->stdout("\tMake sure " . DS . 'cake' . DS . 'libs exists in ' . CAKE_CORE_INCLUDE_PATH); exit(); } - + $this->shiftArgs(); $this->scriptPaths = array( - VENDORS . 'scritps' . DS, + VENDORS . 'scripts' . DS, APP . 'vendors' . DS . 'scripts' . DS, - SCRIPTS + CONSOLE_LIBS ); } /** @@ -198,7 +198,7 @@ class ConsoleDispatcher { ); if(!file_exists(APP_PATH . 'config' . DS . 'core.php')) { - $includes[] = CORE_PATH . 'cake' . DS . 'scripts'.DS.'templates'.DS.'skel'.DS.'config'.DS.'core.php'; + $includes[] = CORE_PATH . 'cake' . DS . 'console' . DS . 'libs' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php'; } else { $includes[] = APP_PATH . 'config' . DS . 'core.php'; } @@ -265,7 +265,7 @@ class ConsoleDispatcher { $this->stdout("'{$script}.php' does not exist in: \n" . implode("\nor ", $this->scriptPaths)); exit(); } else { - require SCRIPTS . 'cake_script.php'; + require CONSOLE_LIBS . 'cake_script.php'; require $this->scriptPath; if(class_exists($this->scriptClass)) { $script = new $this->scriptClass($this); @@ -313,8 +313,8 @@ class ConsoleDispatcher { } } else { $this->stdout('Available Scripts:'); - foreach (listClasses(CAKE . 'scripts') as $script) { - if ($script != 'dispatch.php' && $script != 'cake_script.php') { + foreach (listClasses(CONSOLE_LIBS) as $script) { + if ($script != 'cake_script.php') { $this->stdout("\t - " . r('.php', '', $script)); } } @@ -387,7 +387,7 @@ class ConsoleDispatcher { } } $this->params = array_merge(array('working'=> dirname(dirname(dirname(__FILE__)))), $this->params); - + $app = 'app'; if(isset($this->params['app'])) { if($this->params['app']{0} == '/') { @@ -396,7 +396,7 @@ class ConsoleDispatcher { $app = $this->params['app']; } } - + if(strpos($this->params['working'], 'scripts')) { $this->params['working'] = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . $app; } diff --git a/cake/console/libs/bake.php b/cake/console/libs/bake.php index 4fca418f9..3bc59dc00 100644 --- a/cake/console/libs/bake.php +++ b/cake/console/libs/bake.php @@ -69,11 +69,11 @@ class BakeScript extends CakeScript { $this->out('Name: '. APP_DIR); $this->out('Path: '. ROOT . DS . APP_DIR); $this->hr(); - + if(!is_dir(CONFIGS)) { $this->project($this->params['working']); } - + if(!config('database')) { $this->out(''); $this->out('Your database configuration was not found. Take a moment to create one:'); @@ -1815,12 +1815,12 @@ class BakeScript extends CakeScript { */ function __buildDirLayout($projectPath, $appName) { $skel = ''; - if($this->__checkPath(CAKE_CORE_INCLUDE_PATH.DS.'cake'.DS.'scripts'.DS.'templates'.DS.'skel') === true) { - $skel = CAKE_CORE_INCLUDE_PATH.DS.'cake'.DS.'scripts'.DS.'templates'.DS.'skel'; + if($this->__checkPath(CAKE_CORE_INCLUDE_PATH.DS.'cake'.DS.'console'.DS.'libs'.DS.'templates'.DS.'skel') === true) { + $skel = CAKE_CORE_INCLUDE_PATH.DS.'cake'.DS.'console'.DS.'libs'.DS.'templates'.DS.'skel'; } else { while ($skel == '') { - $skel = $this->in("What is the full path for the cake install app directory?\nExample: ", null, ROOT.'myapp'.DS); + $skel = $this->in("What is the full path for the cake install app directory?\nExample: ", null, ROOT.DS.'myapp'.DS); if ($skel == '') { $this->out('The directory path you supplied was empty. Please try again.'); diff --git a/cake/console/libs/bake2.php b/cake/console/libs/bake2.php index eab110642..6a87a776b 100644 --- a/cake/console/libs/bake2.php +++ b/cake/console/libs/bake2.php @@ -27,9 +27,9 @@ * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ class Bake2Script extends CakeScript { - + var $task = null; - + function initialize() { pr($this->args); if(isset($this->args[0])) { @@ -42,7 +42,7 @@ class Bake2Script extends CakeScript { $this->err('No Task specified'); exit(); } - + $task = $this->_loadTask($this->task); if ($task !== null) { $task->execute($this->args); @@ -60,11 +60,11 @@ class Bake2Script extends CakeScript { break; } } - + if ($loaded) { - require SCRIPTS . 'tasks' . DS . 'bake_task.php'; + require CONSOLE_LIBS . 'tasks' . DS . 'bake_task.php'; require $this->taskPath; - + $this->taskClass = $taskName.'Task'; if(class_exists($this->taskClass)) { return new $this->taskClass($this); diff --git a/cake/console/libs/tasks/app.php b/cake/console/libs/tasks/app.php index ed201a938..a34117ad9 100644 --- a/cake/console/libs/tasks/app.php +++ b/cake/console/libs/tasks/app.php @@ -27,10 +27,10 @@ * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ class AppTask extends BakeTask { - + function execute($params) { if (count($params) == 2) { - $skel = SCRIPTS.'templates'.DS.'skel'; + $skel = CONSOLE_LIBS .'templates'.DS.'skel'; $this->copydirr($skel, $params[1], 0755); $this->makeTmpWritable($params[1].DS.'tmp'); $this->addAppAlias($params[0], $params[1]); @@ -38,15 +38,15 @@ class AppTask extends BakeTask { $this->help(); } } - + function help() { echo "The app task creates an application skeleton for you.\n"; echo "Usage: bake2 app alias app-path \n"; } - + function addAppAlias($alias, $path) { $filename = CORE_PATH . 'apps.ini'; - + if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename) \n"; exit; @@ -58,7 +58,7 @@ class AppTask extends BakeTask { } fclose($handle); } - + function copydirr($fromDir, $toDir, $chmod = 0755) { $errors = array(); @@ -80,10 +80,10 @@ class AppTask extends BakeTask { foreach($errors as $err) { echo 'Error: '.$err."\n"; } - + return false; } - + $exceptions = array('.', '..', '.svn'); $handle = opendir($fromDir); @@ -120,7 +120,7 @@ class AppTask extends BakeTask { } return true; } - + function makeTmpWritable($path) { if(chmodr($path, 0777) === false) { echo 'Could not set permissions on '. $path.DS."*\n";