Anonymous avatar Anonymous committed 4c9a9eb

updating shell paths and help

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5099 3807eeeb-6ff5-0310-8944-8be069107fe0

Comments (0)

Files changed (2)

cake/console/cake.php

  */
 	function dispatch() {
 		$this->stdout("\nWelcome to CakePHP v" . Configure::version() . " Console");
-
+		$this->stdout("---------------------------------------------------------------");
 		$protectedCommands = array('initialize', 'main','in','out','err','hr',
 									'createFile', 'isDir','copyDir','Object','toString',
 									'requestAction','log','cakeError', 'ShellDispatcher',
 
 		$app = 'app';
 		$root = dirname(dirname(dirname(__FILE__)));
-		$working = dirname(dirname(dirname(__FILE__)));
 
 		if(!empty($this->params['working'])) {
+			$root = dirname($this->params['working']);
 			$app = basename($this->params['working']);
-			$working = dirname($this->params['working']) . DS . basename($this->params['working']);
-			$root = dirname($working);
-			unset($this->params['working']);
  		}
 
 		if(!empty($this->params['app'])) {
 			if($this->params['app']{0} == '/') {
+				$root = dirname($this->params['app']);
 				$app = basename($this->params['app']);
-				$working = $this->params['app'];
 			} else {
+				$root = $root . DS . $app;
 				$app = $this->params['app'];
  			}
-			unset($this->params['app']);
-		}
-
-		if(empty($this->params['app']) && in_array($app, array('cake', 'console', 'app'))){
-			$app = 'app';
-			$working = dirname(dirname(__FILE__));
 		}
 
-		if($app !== basename($working) && realpath($working) !== dirname(dirname(__FILE__))) {
-			$root = $working;
-		}
 
-		if($app === basename($working) && realpath($working) === dirname(dirname(dirname(__FILE__)))) {
+		if(in_array($app, array('cake', 'console')) || realpath($root.DS.$app) === dirname(dirname(dirname(__FILE__)))) {
+			$root = dirname(dirname(dirname(__FILE__)));
 			$app = 'app';
-			$root = $working;
 		}
 
+		$working = $root . DS . $app;
+
 		$this->params = array_merge(array('app'=> $app, 'root'=> $root, 'working'=> $working), $this->params);
 	}
 /**
  * @return void
  */
 	function help() {
-		$this->stdout("\nPaths:");
+		$this->stdout("Current Paths:");
 		$this->stdout(" -working: " . $this->params['working']);
 		$this->stdout(" -root: " . ROOT);
 		$this->stdout(" -app: ". APP);
 		$this->stdout(" -core: " . CORE_PATH);
+		$this->stdout("");
+		$this->stdout("Changing Paths:");
+		$this->stdout("your working path should be the same as your application path");
+		$this->stdout("to change your path use the '-app' param.");
+		$this->stdout("Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp");
 
-		$this->stdout("\nAvailable Scripts:");
+		$this->stdout("\nAvailable Shells:");
 		foreach($this->shellPaths as $path) {
 			if(is_dir($path)) {
 				$shells = listClasses($path);
 				} else {
 					foreach ($shells as $shell) {
 						if ($shell != 'shell.php') {
-							$this->stdout("\t - " . r('.php', '', $shell));
+							$this->stdout("\t " . r('.php', '', $shell));
 						}
 					}
 				}
 			}
 		}
-		$this->stdout("\nTo run a command, type 'cake script_name [args]'");
-		$this->stdout("To get help on a specific command, type 'cake script_name help'");
+		$this->stdout("\nTo run a command, type 'cake shell_name [args]'");
+		$this->stdout("To get help on a specific command, type 'cake shell_name help'");
 		exit();
 	}
 }

cake/console/libs/shell.php

  * @return void
  */
 	function _welcome() {
-		$this->hr();
 		$this->out('App : '. APP_DIR);
 		$this->out('Path: '. ROOT . DS . APP_DIR);
 		$this->hr();
 			}
 
 			$this->taskClass = $tasks[0];
-			
+
 			foreach($tasks as $taskName) {
 				$taskKey = Inflector::underscore($taskName);
 				$loaded = false;
 						break;
 					}
 				}
-				
+
 				if ($loaded) {
 					$taskClass = Inflector::camelize($taskName.'Task');
 					if(!class_exists($taskClass)) {
 						require_once $taskPath;
 					}
-				
+
 					if(class_exists($taskClass) &&  !isset($this->{$taskName})) {
 						$task =& new $taskClass($this->Dispatch);
 						$this->taskNames[] = $taskName;
 						$this->{$taskName} =& $task;
 						ClassRegistry::addObject($taskKey, $task);
-					} 
-				
+					}
+
 					if(!isset($this->{$taskName})) {
 						$this->err("Task '".$taskName."' could not be loaded");
 						exit();
  */
 	function _pluralHumanName($name) {
 		return Inflector::humanize(Inflector::underscore(Inflector::pluralize($name)));
-	}	
+	}
 }
 ?>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.