Skip to content

Commit 61d56cd

Browse files
committed
Changing order of text in project task.
Making ProjectTask::getPrefix silent when interactive = false. Making ProjectTask silent from View task if all or a controller name is provided.
1 parent db526dd commit 61d56cd

File tree

2 files changed

+22
-12
lines changed

2 files changed

+22
-12
lines changed

cake/console/libs/tasks/project.php

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -281,30 +281,39 @@ function getPrefix() {
281281
$admin = '';
282282
$prefixes = Configure::read('Routing.prefixes');
283283
if (!empty($prefixes)) {
284+
if ($this->interactive) {
285+
$this->out();
286+
$this->out(__('You have more than one routing prefix configured', true));
287+
}
284288
if (count($prefixes) == 1) {
285289
return $prefixes[0] . '_';
286290
}
287291
$options = array();
288292
foreach ($prefixes as $i => $prefix) {
289293
$options[] = $i + 1;
290-
$this->out($i + 1 . '. ' . $prefix);
294+
if ($this->interactive) {
295+
$this->out($i + 1 . '. ' . $prefix);
296+
}
291297
}
292298
$selection = $this->in(__('Please choose a prefix to bake with.', true), $options, 1);
293299
return $prefixes[$selection - 1] . '_';
294300
}
295-
296-
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
297-
$this->out(__('What would you like the prefix route to be?', true));
298-
$this->out(__('Example: www.example.com/admin/controller', true));
299-
while ($admin == '') {
300-
$admin = $this->in(__("What would you like the prefix route to be?", true), null, 'admin');
301-
}
302-
if ($this->cakeAdmin($admin) !== true) {
303-
$this->out(__('Unable to write to /app/config/core.php.', true));
301+
if ($this->interactive) {
302+
$this->hr();
304303
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
305-
$this->_stop();
304+
$this->out(__('What would you like the prefix route to be?', true));
305+
$this->out(__('Example: www.example.com/admin/controller', true));
306+
while ($admin == '') {
307+
$admin = $this->in(__("Enter a routing prefix:", true), null, 'admin');
308+
}
309+
if ($this->cakeAdmin($admin) !== true) {
310+
$this->out(__('Unable to write to /app/config/core.php.', true));
311+
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
312+
$this->_stop();
313+
}
314+
return $admin . '_';
306315
}
307-
return $admin . '_';
316+
return '';
308317
}
309318

310319
/**

cake/console/libs/tasks/view.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ function execute() {
112112
$this->controllerName = Inflector::camelize($this->args[0]);
113113
$this->controllerPath = Inflector::underscore($this->controllerName);
114114

115+
$this->Project->interactive = false;
115116
if (strtolower($this->args[0]) == 'all') {
116117
return $this->all();
117118
}

0 commit comments

Comments
 (0)