Skip to content
This repository
Browse code

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.
  • Loading branch information...
commit 61d56cd2754470f1fe6fb834d8600f19c5f092fd 1 parent db526dd
Mark Story authored
33  cake/console/libs/tasks/project.php
@@ -281,30 +281,39 @@ function getPrefix() {
281 281
 		$admin = '';
282 282
 		$prefixes = Configure::read('Routing.prefixes');
283 283
 		if (!empty($prefixes)) {
  284
+			if ($this->interactive) {
  285
+				$this->out();
  286
+				$this->out(__('You have more than one routing prefix configured', true));
  287
+			}
284 288
 			if (count($prefixes) == 1) {
285 289
 				return $prefixes[0] . '_';
286 290
 			}
287 291
 			$options = array();
288 292
 			foreach ($prefixes as $i => $prefix) {
289 293
 				$options[] = $i + 1;
290  
-				$this->out($i + 1 . '. ' . $prefix);
  294
+				if ($this->interactive) {
  295
+					$this->out($i + 1 . '. ' . $prefix);
  296
+				}
291 297
 			}
292 298
 			$selection = $this->in(__('Please choose a prefix to bake with.', true), $options, 1);
293 299
 			return $prefixes[$selection - 1] . '_';
294 300
 		}
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();
304 303
 			$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 . '_';
306 315
 		}
307  
-		return $admin . '_';
  316
+		return '';
308 317
 	}
309 318
 
310 319
 /**
1  cake/console/libs/tasks/view.php
@@ -112,6 +112,7 @@ function execute() {
112 112
 		$this->controllerName = Inflector::camelize($this->args[0]);
113 113
 		$this->controllerPath = Inflector::underscore($this->controllerName);
114 114
 
  115
+		$this->Project->interactive = false;
115 116
 		if (strtolower($this->args[0]) == 'all') {
116 117
 			return $this->all();
117 118
 		}

0 notes on commit 61d56cd

Please sign in to comment.
Something went wrong with that request. Please try again.