Skip to content
Permalink
Browse files

Adding some additional output to bake tasks to make them more consist…

…ent. Adding flags for Quiet output so the shells give minimal output.
  • Loading branch information...
markstory committed Nov 21, 2010
1 parent d373dde commit d7b1f706808c6defb9ac31d5744cb0e148252e5c
@@ -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);
@@ -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);
@@ -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'));
@@ -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));
@@ -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;
}
@@ -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;
@@ -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) {
@@ -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);
@@ -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);
@@ -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/')
);

0 comments on commit d7b1f70

Please sign in to comment.
You can’t perform that action at this time.