closes #2754, fix for project task

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5409 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-07-08 19:33:20 +00:00
parent c9eb45232d
commit e746fedf45

View file

@ -59,23 +59,21 @@ class ProjectTask extends Shell {
} }
} }
$working = $this->params['working'];
$app = basename($working);
$root = dirname($working) . DS;
if ($project) { if ($project) {
if ($project{0} != '/') { if ($project{0} == DS || $project{0} == '/') {
$root = $working; $app = basename($project);
$root = dirname($project);
} else {
$app = $project; $app = $project;
} $root = $this->params['root'] . DS;
if ($root{strlen($root) -1} != '/') {
$root = $root . DS;
} }
$path = $root . $app; $root = str_replace(DS . DS, DS, $root . DS);
$project = $root . $app;
$response = false; $response = false;
while ($response == false && is_dir($path) === true && config('database') === true) { while ($response == false && is_dir($project) === true && config('core') === 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');
if (low($response) === 'n') { if (low($response) === 'n') {
$this->out('Bake Aborted'); $this->out('Bake Aborted');
@ -94,7 +92,7 @@ class ProjectTask extends Shell {
$this->err('The directory path you supplied was not found. Please try again.'); $this->err('The directory path you supplied was not found. Please try again.');
} }
$this->__buildDirLayout($path); $this->__buildDirLayout($project);
exit(); exit();
} }
@ -163,7 +161,7 @@ class ProjectTask extends Shell {
$this->err('Unable to to set CAKE_CORE_INCLUDE_PATH, please change this yourself in ' . $path . 'webroot' .DS .'index.php'); $this->err('Unable to to set CAKE_CORE_INCLUDE_PATH, please change this yourself in ' . $path . 'webroot' .DS .'index.php');
} }
if ($Folder->chmod($path . DS . 'tmp', 0777) === false) { if (!$Folder->chmod($path . DS . 'tmp', 0777)) {
$this->err('Could path set permissions on '. $project . DS .'tmp' . DS . '*'); $this->err('Could path set permissions on '. $project . DS .'tmp' . DS . '*');
$this->out('You must manually check that these directories can be wrote to by the server'); $this->out('You must manually check that these directories can be wrote to by the server');
} }