Skip to content

Commit

Permalink
Changing order of text in project task.
Browse files Browse the repository at this point in the history
Making ProjectTask::getPrefix silent when interactive = false.
Making ProjectTask silent from View task if all or a controller name is provided.
  • Loading branch information
markstory committed Nov 11, 2009
1 parent db526dd commit 61d56cd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
33 changes: 21 additions & 12 deletions cake/console/libs/tasks/project.php
Expand Up @@ -281,30 +281,39 @@ function getPrefix() {
$admin = '';
$prefixes = Configure::read('Routing.prefixes');
if (!empty($prefixes)) {
if ($this->interactive) {
$this->out();
$this->out(__('You have more than one routing prefix configured', true));
}
if (count($prefixes) == 1) {
return $prefixes[0] . '_';
}
$options = array();
foreach ($prefixes as $i => $prefix) {
$options[] = $i + 1;
$this->out($i + 1 . '. ' . $prefix);
if ($this->interactive) {
$this->out($i + 1 . '. ' . $prefix);
}
}
$selection = $this->in(__('Please choose a prefix to bake with.', true), $options, 1);
return $prefixes[$selection - 1] . '_';
}

$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
$this->out(__('What would you like the prefix route to be?', true));
$this->out(__('Example: www.example.com/admin/controller', true));
while ($admin == '') {
$admin = $this->in(__("What would you like the prefix route to be?", true), null, 'admin');
}
if ($this->cakeAdmin($admin) !== true) {
$this->out(__('Unable to write to /app/config/core.php.', true));
if ($this->interactive) {
$this->hr();
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
$this->_stop();
$this->out(__('What would you like the prefix route to be?', true));
$this->out(__('Example: www.example.com/admin/controller', true));
while ($admin == '') {
$admin = $this->in(__("Enter a routing prefix:", true), null, 'admin');
}
if ($this->cakeAdmin($admin) !== true) {
$this->out(__('Unable to write to /app/config/core.php.', true));
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
$this->_stop();
}
return $admin . '_';
}
return $admin . '_';
return '';
}

/**
Expand Down
1 change: 1 addition & 0 deletions cake/console/libs/tasks/view.php
Expand Up @@ -112,6 +112,7 @@ function execute() {
$this->controllerName = Inflector::camelize($this->args[0]);
$this->controllerPath = Inflector::underscore($this->controllerName);

$this->Project->interactive = false;
if (strtolower($this->args[0]) == 'all') {
return $this->all();
}
Expand Down

0 comments on commit 61d56cd

Please sign in to comment.