updating project task paths

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5212 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-05-27 16:13:42 +00:00
parent aa81a44bb9
commit b77586db23

View file

@ -30,8 +30,8 @@ if(!class_exists('File')) {
uses('file'); uses('file');
} }
class ProjectTask extends Shell { class ProjectTask extends Shell {
function initialize() {} function initialize() {}
/** /**
@ -44,24 +44,26 @@ class ProjectTask extends Shell {
if($project === null) { if($project === null) {
$project = $this->params['app']; $project = $this->params['app'];
if(isset($this->args[0])) { if(isset($this->args[0])) {
$project = $this->args[0]; $project = $this->args[0];
$this->Dispatch->shiftArgs(); $this->Dispatch->shiftArgs();
} }
} }
$working = $this->params['working']; $working = $this->params['working'];
$app = basename($working); $app = basename($working);
$root = dirname($working); $root = dirname($working) . DS;
if($project) { if($project) {
if($project{0} == '/') { if($project{0} != '/') {
$app = basename($project); $root = $working;
$root = dirname($project);
} else {
$app = $project; $app = $project;
} }
$path = $root . DS . $app; if($root{strlen($root) -1} != '/') {
$root = $root . DS;
}
$path = $root . $app;
$response = false; $response = false;
while ($response == false && is_dir($path) === true && config('database') === true) { 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'); $response = $this->in('A project already exists in this location: '.$project.' Overwrite?', array('y','n'), 'n');
@ -71,15 +73,15 @@ class ProjectTask extends Shell {
} }
} }
} }
while (!$project) { 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'); $project = $this->in("What is the full path for this app including the app directory name?\nExample: ".$working . "myapp", null, $working . 'myapp');
$this->execute($project); $this->execute($project);
exit(); exit();
} }
if (!is_dir($root)) { if (!is_dir($root)) {
$this->err('The directory path you supplied can not be created. Please try again.'); $this->err('The directory path you supplied was not found. Please try again.');
} }
$this->__buildDirLayout($path); $this->__buildDirLayout($path);
@ -113,10 +115,7 @@ class ProjectTask extends Shell {
$app = basename($path); $app = basename($path);
$this->out(''); $this->out('');
$this->out("Skel Directory: $skel"); $this->out("Skel Directory: $skel");
$this->out("Will be copied to:"); $this->out("Will be copied to: {$path}");
$this->hr();
$this->out("App: $app");
$this->out("Path: $path");
$this->hr(); $this->hr();
$looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y'); $looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y');
@ -146,7 +145,7 @@ class ProjectTask extends Shell {
} else { } else {
$this->err('Unable to generate random hash for CAKE_SESSION_STRING, please change this yourself in ' . CONFIGS . 'core.php'); $this->err('Unable to generate random hash for CAKE_SESSION_STRING, please change this yourself in ' . CONFIGS . 'core.php');
} }
$corePath = $this->__setCake($path); $corePath = $this->__setCake($path);
if($corePath === true ){ if($corePath === true ){
$this->out('CAKE_CORE_INCLUDE_PATH set to ' . CAKE_CORE_INCLUDE_PATH); $this->out('CAKE_CORE_INCLUDE_PATH set to ' . CAKE_CORE_INCLUDE_PATH);