Permalink
Browse files

Updating bake all to reflect changes in Task apis. Adding additional …

…messages.
  • Loading branch information...
1 parent 9f3a9e6 commit 08ce38c6cc806df6b7c4740bd13d8c55cc10d253 @markstory markstory committed Jul 16, 2009
Showing with 14 additions and 8 deletions.
  1. +11 −7 cake/console/libs/bake.php
  2. +3 −1 cake/console/libs/tasks/model.php
View
@@ -128,22 +128,25 @@ function main() {
* @access public
*/
function all() {
- $ds = 'default';
$this->hr();
$this->out('Bake All');
$this->hr();
- if (isset($this->params['connection'])) {
- $ds = $this->params['connection'];
+ if (!isset($this->params['connection']) && empty($this->connection)) {
+ $this->connection = $this->DbConfig->getConfig();
+ }
+
+ foreach (array('Model', 'Controller', 'View') as $task) {
+ $this->{$task}->connection = $this->connection;
+ $this->{$task}->interactive = false;
}
if (empty($this->args)) {
- $name = $this->Model->getName($ds);
+ $name = $this->Model->getName($this->connection);
}
if (!empty($this->args[0])) {
$name = $this->args[0];
- $this->Model->listAll($ds, false);
}
$modelExists = false;
@@ -153,7 +156,7 @@ function all() {
$modelExists = true;
} else {
App::import('Model');
- $object = new Model(array('name' => $name, 'ds' => $ds));
+ $object = new Model(array('name' => $name, 'ds' => $this->connection));
}
$modelBaked = $this->Model->bake($object, false);
@@ -177,8 +180,9 @@ function all() {
if (App::import('Controller', $controller)) {
$this->View->args = array($controller);
$this->View->execute();
+ $this->out(sprintf(__('%s Views were baked.', true), $name));
}
- $this->out(__('Bake All complete'));
+ $this->out(__('Bake All complete', true));
array_shift($this->args);
} else {
$this->err(__('Bake All could not continue without a valid model', true));
@@ -449,7 +449,9 @@ function doAssociations(&$model) {
if (!is_object($model)) {
return false;
}
- $this->out(__('One moment while the associations are detected.', true));
+ if ($this->interactive === true) {
+ $this->out(__('One moment while the associations are detected.', true));
+ }
$fields = $model->schema();
if (empty($fields)) {

0 comments on commit 08ce38c

Please sign in to comment.