Skip to content

Commit

Permalink
Adding some additional output to bake tasks to make them more consist…
Browse files Browse the repository at this point in the history
…ent. Adding flags for Quiet output so the shells give minimal output.
  • Loading branch information
markstory committed Nov 21, 2010
1 parent d373dde commit d7b1f70
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 10 deletions.
7 changes: 2 additions & 5 deletions cake/console/shells/bake.php
Expand Up @@ -162,8 +162,6 @@ public function all() {
$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);
Expand All @@ -173,7 +171,6 @@ public function all() {

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);
Expand All @@ -182,9 +179,9 @@ public function all() {
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(__('<success>Bake All complete</success>'), 1, Shell::QUIET);
array_shift($this->args);
} else {
$this->error(__('Bake All could not continue without a valid model'));
Expand Down
2 changes: 2 additions & 0 deletions cake/console/shells/tasks/controller.php
Expand Up @@ -302,6 +302,8 @@ public function bakeActions($controllerName, $admin = null, $wannaUseSession = t
* @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));
Expand Down
2 changes: 1 addition & 1 deletion cake/console/shells/tasks/fixture.php
Expand Up @@ -254,7 +254,7 @@ public function generateFixtureFile($model, $otherVars) {
$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;
}
Expand Down
2 changes: 1 addition & 1 deletion cake/console/shells/tasks/model.php
Expand Up @@ -742,7 +742,7 @@ public function bake($name, $data = array()) {

$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;
Expand Down
3 changes: 2 additions & 1 deletion cake/console/shells/tasks/test.php
Expand Up @@ -115,7 +115,7 @@ protected function _interactive($type = null) {
*/
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) {
Expand All @@ -134,6 +134,7 @@ public function bake($type, $className) {
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);
Expand Down
1 change: 1 addition & 0 deletions cake/console/shells/tasks/view.php
Expand Up @@ -366,6 +366,7 @@ public function bake($action, $content = '') {
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);
Expand Down
4 changes: 2 additions & 2 deletions cake/tests/cases/console/shells/tasks/controller.test.php
Expand Up @@ -304,11 +304,11 @@ public function testBakeWithPlugin() {

$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/')
);
Expand Down

0 comments on commit d7b1f70

Please sign in to comment.