From 2ef02ba29b95f4cba63829a4ec37574dcb9ff029 Mon Sep 17 00:00:00 2001 From: Jose Lorenzo Rodriguez Date: Mon, 7 Mar 2011 00:45:00 -0430 Subject: [PATCH] Starting to move all console related classes, ViewTask tests passing --- app/console/{shells => }/templates/empty | 0 lib/Cake/Console/Command/Task/TemplateTask.php | 4 ++-- lib/Cake/Console/Command/Task/ViewTask.php | 4 ++-- lib/Cake/Console/TaskCollection.php | 2 +- lib/Cake/Core/App.php | 12 ++++++++++-- .../cases/console/libs/task_collection.test.php | 2 +- .../tests/cases/console/shells/tasks/view.test.php | 4 ++++ 7 files changed, 20 insertions(+), 8 deletions(-) rename app/console/{shells => }/templates/empty (100%) diff --git a/app/console/shells/templates/empty b/app/console/templates/empty similarity index 100% rename from app/console/shells/templates/empty rename to app/console/templates/empty diff --git a/lib/Cake/Console/Command/Task/TemplateTask.php b/lib/Cake/Console/Command/Task/TemplateTask.php index cdf308868..34c122ed9 100644 --- a/lib/Cake/Console/Command/Task/TemplateTask.php +++ b/lib/Cake/Console/Command/Task/TemplateTask.php @@ -54,8 +54,8 @@ class TemplateTask extends Shell { * @return array Array of bake themes that are installed. */ protected function _findThemes() { - $paths = App::path('shells'); - $core = array_pop($paths); + $paths = App::path('Console'); + $core = current(App::core('Console')); $separator = DS === '/' ? '/' : '\\\\'; $core = preg_replace('#shells' . $separator . '$#', '', $core); diff --git a/lib/Cake/Console/Command/Task/ViewTask.php b/lib/Cake/Console/Command/Task/ViewTask.php index 6483312fd..c69813320 100644 --- a/lib/Cake/Console/Command/Task/ViewTask.php +++ b/lib/Cake/Console/Command/Task/ViewTask.php @@ -147,7 +147,7 @@ class ViewTask extends BakeTask { protected function _methodsToBake() { $methods = array_diff( array_map('strtolower', get_class_methods($this->controllerName . 'Controller')), - array_map('strtolower', get_class_methods('appcontroller')) + array_map('strtolower', get_class_methods('AppController')) ); $scaffoldActions = false; if (empty($methods)) { @@ -277,7 +277,7 @@ class ViewTask extends BakeTask { } $controllerClassName = $this->controllerName . 'Controller'; - App::uses($controllerName, $plugin . 'Controller'); + App::uses($controllerClassName, $plugin . 'Controller'); if (!class_exists($controllerClassName)) { $file = $controllerClassName . '.php'; $this->err(__("The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", $file)); diff --git a/lib/Cake/Console/TaskCollection.php b/lib/Cake/Console/TaskCollection.php index 4a8513890..3c911a2ce 100644 --- a/lib/Cake/Console/TaskCollection.php +++ b/lib/Cake/Console/TaskCollection.php @@ -60,7 +60,7 @@ class TaskCollection extends ObjectCollection { } $taskFile = Inflector::underscore($name); $taskClass = $name . 'Task'; - App::uses($taskClass, 'Console/Command/Task'); + App::uses($taskClass, $plugin . 'Console/Command/Task'); if (!class_exists($taskClass)) { if (!class_exists($taskClass)) { throw new MissingTaskClassException($taskClass); diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 03c543c6e..88b68668a 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -302,13 +302,21 @@ class App { '%s' . 'vendors' . DS . 'shells' . DS, VENDORS . 'shells' . DS ), + 'Console/Command' => array( + '%s' . 'console' . DS . 'shells' . DS, + '%s' . 'vendors' . DS . 'shells' . DS, + VENDORS . 'shells' . DS + ), + 'Console/Command/Task' => array( + '%s' . 'console' . DS . 'shells' . DS . 'tasks' . DS, + '%s' . 'vendors' . DS . 'shells' . DS . 'tasks' . DS, + VENDORS . 'shells' . DS . 'tasks' . DS + ), 'libs' => array('%s' . 'libs' . DS), 'locales' => array('%s' . 'locale' . DS), 'vendors' => array('%s' . 'vendors' . DS, VENDORS), 'plugins' => array(APP . 'plugins' . DS) ); - - self::$__packageFormat['Console/Command'] = self::$__packageFormat['Console']; } if ($reset == true) { diff --git a/lib/Cake/tests/cases/console/libs/task_collection.test.php b/lib/Cake/tests/cases/console/libs/task_collection.test.php index 7ed3f7822..bb961736f 100644 --- a/lib/Cake/tests/cases/console/libs/task_collection.test.php +++ b/lib/Cake/tests/cases/console/libs/task_collection.test.php @@ -72,7 +72,7 @@ class TaskCollectionTest extends CakeTestCase { /** * test missinghelper exception * - * @expectedException MissingTaskFileException + * @expectedException MissingTaskClassException * @return void */ function testLoadMissingTaskFile() { diff --git a/lib/Cake/tests/cases/console/shells/tasks/view.test.php b/lib/Cake/tests/cases/console/shells/tasks/view.test.php index 56fb5c977..b41cdd233 100644 --- a/lib/Cake/tests/cases/console/shells/tasks/view.test.php +++ b/lib/Cake/tests/cases/console/shells/tasks/view.test.php @@ -20,12 +20,16 @@ */ App::uses('ShellDispatcher', 'Console'); +App::uses('ConsoleOutput', 'Console'); +App::uses('ConsoleInput', 'Console'); App::uses('Shell', 'Console'); App::uses('ViewTask', 'Console/Command/Task'); App::uses('ControllerTask', 'Console/Command/Task'); App::uses('TemplateTask', 'Console/Command/Task'); App::uses('ProjectTask', 'Console/Command/Task'); App::uses('DbConfigTask', 'Console/Command/Task'); +App::uses('Model', 'Model'); +App::uses('Controller', 'Controller'); /** * Test View Task Comment Model