From d7b1f706808c6defb9ac31d5744cb0e148252e5c Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 21 Nov 2010 12:47:49 -0500 Subject: [PATCH] Adding some additional output to bake tasks to make them more consistent. Adding flags for Quiet output so the shells give minimal output. --- cake/console/shells/bake.php | 7 ++----- cake/console/shells/tasks/controller.php | 2 ++ cake/console/shells/tasks/fixture.php | 2 +- cake/console/shells/tasks/model.php | 2 +- cake/console/shells/tasks/test.php | 3 ++- cake/console/shells/tasks/view.php | 1 + cake/tests/cases/console/shells/tasks/controller.test.php | 4 ++-- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cake/console/shells/bake.php b/cake/console/shells/bake.php index ce75dec10..77dd36201 100644 --- a/cake/console/shells/bake.php +++ b/cake/console/shells/bake.php @@ -162,8 +162,6 @@ class BakeShell extends Shell { $modelBaked = $this->Model->bake($object, false); if ($modelBaked && $modelExists === false) { - $this->out(sprintf(__('%s Model was baked.'), $model)); - if ($this->_checkUnitTest()) { $this->Model->bakeFixture($model); $this->Model->bakeTest($model); @@ -173,7 +171,6 @@ class BakeShell extends Shell { if ($modelExists === true) { $controller = $this->_controllerName($name); - $this->out(sprintf(__('Baking %s Controller...', 1), $controller)); if ($this->Controller->bake($controller, $this->Controller->bakeActions($controller))) { if ($this->_checkUnitTest()) { $this->Controller->bakeTest($controller); @@ -182,9 +179,9 @@ class BakeShell extends Shell { if (App::import('Controller', $controller)) { $this->View->args = array($controller); $this->View->execute(); - $this->out(sprintf(__('%s Views were baked.'), $controller)); } - $this->out(__('Bake All complete')); + $this->out('', 1, Shell::QUIET); + $this->out(__('Bake All complete'), 1, Shell::QUIET); array_shift($this->args); } else { $this->error(__('Bake All could not continue without a valid model')); diff --git a/cake/console/shells/tasks/controller.php b/cake/console/shells/tasks/controller.php index e88dc2059..f56f55d3b 100644 --- a/cake/console/shells/tasks/controller.php +++ b/cake/console/shells/tasks/controller.php @@ -302,6 +302,8 @@ class ControllerTask extends BakeTask { * @return string Baked controller */ public function bake($controllerName, $actions = '', $helpers = null, $components = null) { + $this->out("\nBaking controller class for $controllerName...", 1, Shell::QUIET); + $isScaffold = ($actions === 'scaffold') ? true : false; $this->Template->set('plugin', Inflector::camelize($this->plugin)); diff --git a/cake/console/shells/tasks/fixture.php b/cake/console/shells/tasks/fixture.php index 1313ab1dd..333359121 100644 --- a/cake/console/shells/tasks/fixture.php +++ b/cake/console/shells/tasks/fixture.php @@ -254,7 +254,7 @@ class FixtureTask extends BakeTask { $this->Template->set($vars); $content = $this->Template->generate('classes', 'fixture'); - $this->out("\nBaking test fixture for $model..."); + $this->out("\nBaking test fixture for $model...", 1, Shell::QUIET); $this->createFile($path . $filename, $content); return $content; } diff --git a/cake/console/shells/tasks/model.php b/cake/console/shells/tasks/model.php index 7e8de3e36..6abd25344 100644 --- a/cake/console/shells/tasks/model.php +++ b/cake/console/shells/tasks/model.php @@ -742,7 +742,7 @@ class ModelTask extends BakeTask { $path = $this->getPath(); $filename = $path . Inflector::underscore($name) . '.php'; - $this->out("\nBaking model class for $name..."); + $this->out("\nBaking model class for $name...", 1, Shell::QUIET); $this->createFile($filename, $out); ClassRegistry::flush(); return $out; diff --git a/cake/console/shells/tasks/test.php b/cake/console/shells/tasks/test.php index bb277bbcc..173a65079 100644 --- a/cake/console/shells/tasks/test.php +++ b/cake/console/shells/tasks/test.php @@ -115,7 +115,7 @@ class TestTask extends BakeTask { */ public function bake($type, $className) { if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) { - $this->out(__('Bake is detecting possible fixtures..')); + $this->out(__('Bake is detecting possible fixtures...')); $testSubject = $this->buildTestSubject($type, $className); $this->generateFixtureList($testSubject); } elseif ($this->interactive) { @@ -134,6 +134,7 @@ class TestTask extends BakeTask { if ($this->plugin) { $plugin = $this->plugin . '.'; } + $this->out("\nBaking test case for $className $type...", 1, Shell::QUIET); $this->Template->set('fixtures', $this->_fixtures); $this->Template->set('plugin', $plugin); diff --git a/cake/console/shells/tasks/view.php b/cake/console/shells/tasks/view.php index 2acbfdeaa..14d67b7fe 100644 --- a/cake/console/shells/tasks/view.php +++ b/cake/console/shells/tasks/view.php @@ -366,6 +366,7 @@ class ViewTask extends BakeTask { if (empty($content)) { return false; } + $this->out("\nBaking `$action` view file...", 1, Shell::QUIET); $path = $this->getPath(); $filename = $path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp'; return $this->createFile($filename, $content); diff --git a/cake/tests/cases/console/shells/tasks/controller.test.php b/cake/tests/cases/console/shells/tasks/controller.test.php index 61d00b4f1..f3601376e 100644 --- a/cake/tests/cases/console/shells/tasks/controller.test.php +++ b/cake/tests/cases/console/shells/tasks/controller.test.php @@ -304,11 +304,11 @@ class ControllerTaskTest extends CakeTestCase { $path = APP . 'plugins' . DS . 'controller_test' . DS . 'controllers' . DS . 'articles_controller.php'; - $this->Task->expects($this->at(0))->method('createFile')->with( + $this->Task->expects($this->at(1))->method('createFile')->with( $path, new PHPUnit_Framework_Constraint_IsAnything() ); - $this->Task->expects($this->at(1))->method('createFile')->with( + $this->Task->expects($this->at(3))->method('createFile')->with( $path, new PHPUnit_Framework_Constraint_PCREMatch('/ArticlesController extends ControllerTestAppController/') );