Starting to move all console related classes, ViewTask tests passing

This commit is contained in:
Jose Lorenzo Rodriguez 2011-03-07 00:45:00 -04:30
parent ff31792e8d
commit 2ef02ba29b
7 changed files with 20 additions and 8 deletions

View file

@ -54,8 +54,8 @@ class TemplateTask extends Shell {
* @return array Array of bake themes that are installed. * @return array Array of bake themes that are installed.
*/ */
protected function _findThemes() { protected function _findThemes() {
$paths = App::path('shells'); $paths = App::path('Console');
$core = array_pop($paths); $core = current(App::core('Console'));
$separator = DS === '/' ? '/' : '\\\\'; $separator = DS === '/' ? '/' : '\\\\';
$core = preg_replace('#shells' . $separator . '$#', '', $core); $core = preg_replace('#shells' . $separator . '$#', '', $core);

View file

@ -147,7 +147,7 @@ class ViewTask extends BakeTask {
protected function _methodsToBake() { protected function _methodsToBake() {
$methods = array_diff( $methods = array_diff(
array_map('strtolower', get_class_methods($this->controllerName . 'Controller')), 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; $scaffoldActions = false;
if (empty($methods)) { if (empty($methods)) {
@ -277,7 +277,7 @@ class ViewTask extends BakeTask {
} }
$controllerClassName = $this->controllerName . 'Controller'; $controllerClassName = $this->controllerName . 'Controller';
App::uses($controllerName, $plugin . 'Controller'); App::uses($controllerClassName, $plugin . 'Controller');
if (!class_exists($controllerClassName)) { if (!class_exists($controllerClassName)) {
$file = $controllerClassName . '.php'; $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)); $this->err(__("The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", $file));

View file

@ -60,7 +60,7 @@ class TaskCollection extends ObjectCollection {
} }
$taskFile = Inflector::underscore($name); $taskFile = Inflector::underscore($name);
$taskClass = $name . 'Task'; $taskClass = $name . 'Task';
App::uses($taskClass, 'Console/Command/Task'); App::uses($taskClass, $plugin . 'Console/Command/Task');
if (!class_exists($taskClass)) { if (!class_exists($taskClass)) {
if (!class_exists($taskClass)) { if (!class_exists($taskClass)) {
throw new MissingTaskClassException($taskClass); throw new MissingTaskClassException($taskClass);

View file

@ -302,13 +302,21 @@ class App {
'%s' . 'vendors' . DS . 'shells' . DS, '%s' . 'vendors' . DS . 'shells' . DS,
VENDORS . '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), 'libs' => array('%s' . 'libs' . DS),
'locales' => array('%s' . 'locale' . DS), 'locales' => array('%s' . 'locale' . DS),
'vendors' => array('%s' . 'vendors' . DS, VENDORS), 'vendors' => array('%s' . 'vendors' . DS, VENDORS),
'plugins' => array(APP . 'plugins' . DS) 'plugins' => array(APP . 'plugins' . DS)
); );
self::$__packageFormat['Console/Command'] = self::$__packageFormat['Console'];
} }
if ($reset == true) { if ($reset == true) {

View file

@ -72,7 +72,7 @@ class TaskCollectionTest extends CakeTestCase {
/** /**
* test missinghelper exception * test missinghelper exception
* *
* @expectedException MissingTaskFileException * @expectedException MissingTaskClassException
* @return void * @return void
*/ */
function testLoadMissingTaskFile() { function testLoadMissingTaskFile() {

View file

@ -20,12 +20,16 @@
*/ */
App::uses('ShellDispatcher', 'Console'); App::uses('ShellDispatcher', 'Console');
App::uses('ConsoleOutput', 'Console');
App::uses('ConsoleInput', 'Console');
App::uses('Shell', 'Console'); App::uses('Shell', 'Console');
App::uses('ViewTask', 'Console/Command/Task'); App::uses('ViewTask', 'Console/Command/Task');
App::uses('ControllerTask', 'Console/Command/Task'); App::uses('ControllerTask', 'Console/Command/Task');
App::uses('TemplateTask', 'Console/Command/Task'); App::uses('TemplateTask', 'Console/Command/Task');
App::uses('ProjectTask', 'Console/Command/Task'); App::uses('ProjectTask', 'Console/Command/Task');
App::uses('DbConfigTask', 'Console/Command/Task'); App::uses('DbConfigTask', 'Console/Command/Task');
App::uses('Model', 'Model');
App::uses('Controller', 'Controller');
/** /**
* Test View Task Comment Model * Test View Task Comment Model