From 61d56cd2754470f1fe6fb834d8600f19c5f092fd Mon Sep 17 00:00:00 2001 From: mark_story Date: Wed, 11 Nov 2009 09:56:35 -0500 Subject: [PATCH] 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. --- cake/console/libs/tasks/project.php | 33 ++++++++++++++++++----------- cake/console/libs/tasks/view.php | 1 + 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/cake/console/libs/tasks/project.php b/cake/console/libs/tasks/project.php index 6194fab310b..9ed44c6a6b5 100644 --- a/cake/console/libs/tasks/project.php +++ b/cake/console/libs/tasks/project.php @@ -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 ''; } /** diff --git a/cake/console/libs/tasks/view.php b/cake/console/libs/tasks/view.php index 1bad40f5acb..e330775b255 100644 --- a/cake/console/libs/tasks/view.php +++ b/cake/console/libs/tasks/view.php @@ -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(); }