updating console paths fixes #3092 and fixes #3109

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5627 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-09-11 19:03:34 +00:00
parent 8d62f0cac4
commit b2e263cd46
4 changed files with 24 additions and 32 deletions

View file

@ -27,7 +27,7 @@
clear
LIB=${0/%cake/}
APP=`pwd`/
APP=`pwd`
echo "Hello $USER,"

View file

@ -32,6 +32,6 @@
SET app=%0
SET lib=%~dp0
php -q "%lib%cake.php" %* -working "%CD%\"
php -q "%lib%cake.php" %* -working "%CD%"
echo.

View file

@ -416,31 +416,27 @@ class ShellDispatcher {
$app = 'app';
$root = dirname(dirname(dirname(__FILE__)));
if (!empty($this->params['working'])) {
$root = dirname($this->params['working']);
$app = basename($this->params['working']);
if (!empty($this->params['working']) && (!isset($this->args[0]) || isset($this->args[0]) && $this->args[0]{0} !== '.')) {
if (empty($this->params['app'])) {
$root = dirname($this->params['working']);
$app = basename($this->params['working']);
} else {
$root = $this->params['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']);
} elseif (!empty($this->params['working'])) {
$root = realpath($this->params['working']);
}
$app = $this->params['app'];
}
$app = basename($this->params['app']);
unset($this->params['app']);
}
if (in_array($app, array('cake', 'console')) || realpath($root.DS.$app) === dirname(dirname(dirname(__FILE__)))) {
$root = dirname(dirname(dirname(__FILE__)));
$app = 'app';
}
$working = str_replace(DS . DS, DS, $root . DS . $app);
$working = $root . DS . $app;
$this->params = array_merge(array('app'=> $app, 'root'=> $root, 'working'=> $working), $this->params);
$this->params = array_merge($this->params, array('app'=> $app, 'root'=> $root, 'working'=> $working));
}
/**
* Removes first argument and shifts other arguments up

View file

@ -59,34 +59,30 @@ class ProjectTask extends Shell {
*/
function execute($project = null) {
if ($project === null) {
$project = $this->params['app'];
if (isset($this->args[0])) {
$project = $this->args[0];
$this->Dispatch->shiftArgs();
}
}
if($project) {
if($project{0} == '/' || $project{0} == DS) {
$this->Dispatch->parseParams(array('-working', $project));
} else {
$this->Dispatch->parseParams(array('-app', $project));
}
}
$project = $this->params['working'];
if (empty($this->params['skel'])) {
$this->params['skel'] = '';
if (is_dir(CAKE_CORE_INCLUDE_PATH.DS.'cake'.DS.'console'.DS.'libs'.DS.'templates'.DS.'skel') === true) {
$this->params['skel'] = CAKE_CORE_INCLUDE_PATH.DS.'cake'.DS.'console'.DS.'libs'.DS.'templates'.DS.'skel';
}
}
if ($project) {
if ($project{0} == DS || $project{0} == '/') {
$this->params['app'] = basename($project);
$this->params['root'] = dirname($project);
$this->params['working'] = $this->params['root'];
} else {
$this->params['app'] = basename($project);
}
if ($this->params['root'] === dirname(dirname(dirname(dirname(dirname(__FILE__)))))) {
$this->params['working'] = $this->params['root'] . DS;
}
$project = str_replace(DS.DS, DS, $this->params['working'] . DS . $this->params['app']);
$response = false;
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');