Anonymous avatar Anonymous committed 673d0e1

updating project task

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

Comments (0)

Files changed (1)

cake/console/libs/tasks/project.php

 	uses('file');
 }
 class ProjectTask extends Shell {
+	
+	
+	function initialize() {}
 
 /**
  * Checks that given project path does not already exist, and
 	function execute($project = null) {
 		if($project === null) {
 			$project = $this->params['app'];
-			if(isset($this->args[1])) {
-				$project = $this->args[1];
+			if(isset($this->args[0])) {
+				$project = $this->args[0];				
 				$this->Dispatch->shiftArgs();
 			}
 		}
 
 		$working = $this->params['working'];
+		$app = basename($working);
+		$root = dirname($working);
+		
 		if($project) {
 			if($project{0} == '/') {
 				$app = basename($project);
-				$working = dirname($project);
+				$root = dirname($project);
 			} else {
 				$app = $project;
 			}
-			$path = $working . DS . basename($app);
-
-			while (is_dir($path) === true && config('database') === true) {
+			$path = $root . DS . $app;
+			
+			$response = false;
+			while ($response == false && is_dir($path) === true && config('database') === true) {
 				$response = $this->in('A project already exists in this location: '.$project.' Overwrite?', array('y','n'), 'n');
-				if(low($response) == 'n') {
-					$this->execute(false);
+				if(low($response) === 'n') {
+					$this->out('Bake Aborted');
 					exit();
 				}
 			}
 		}
-
+		
 		while (!$project) {
 			$project = $this->in("What is the full path for this app including the app directory name?\nExample: ".$working . DS . "myapp", null, $working . DS . 'myapp');
 			$this->execute($project);
 				$this->out(__(sprintf("Created: %s in %s", $app, $path), true));
 				$this->hr();
 
-				$this->__defaultHome($path, $app);
-
-				$this->out('Welcome page created');
+				if($this->__defaultHome($path, $app)) {
+					$this->out('Welcome page created');
+				} else {
+					$this->out('The Welcome page was NOT created');
+				}
 
 				if($this->__generateHash($path) === true ){
 					$this->out('Random hash key created for CAKE_SESSION_STRING');
 				} else {
 					$this->err('Unable to generate random hash for CAKE_SESSION_STRING, please change this yourself in ' . CONFIGS . 'core.php');
 				}
-
-				if($this->__setCake($path) === true ){
+				
+				$corePath = $this->__setCake($path);
+				if($corePath === true ){
 					$this->out('CAKE_CORE_INCLUDE_PATH set to ' . CAKE_CORE_INCLUDE_PATH);
-				} else {
+				} else if($corePath === false){
 					$this->err('Unable to to set CAKE_CORE_INCLUDE_PATH, please change this yourself in ' . $path . 'webroot' .DS .'index.php');
 				}
 
  * @return bool
  */
 	function __setCake($path){
-		if(ROOT !== CAKE_CORE_INCLUDE_PATH) {
+		if(dirname($path) !== CAKE_CORE_INCLUDE_PATH) {
 			$File =& new File($path . 'webroot' . DS . 'index.php');
 			$contents = $File->read();
 			if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
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.