Skip to content

Commit

Permalink
Updating bake all to reflect changes in Task apis. Adding additional …
Browse files Browse the repository at this point in the history
…messages.
  • Loading branch information
markstory committed Jul 16, 2009
1 parent 9f3a9e6 commit 08ce38c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 11 additions & 7 deletions cake/console/libs/bake.php
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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));
Expand Down
4 changes: 3 additions & 1 deletion cake/console/libs/tasks/model.php
Expand Up @@ -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)) {
Expand Down

0 comments on commit 08ce38c

Please sign in to comment.