updating paths for shell, bake

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5063 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-05-12 23:40:37 +00:00
parent 7154feb7c8
commit 9b39236117
3 changed files with 39 additions and 13 deletions

View file

@ -396,10 +396,16 @@ class ShellDispatcher {
$app = $this->params['app']; $app = $this->params['app'];
} }
} }
if(in_array($app, array('cake', 'console', 'app'))){
if(empty($this->params['app']) && in_array($app, array('cake', 'console', 'app'))){
$app = 'app'; $app = 'app';
$this->params['working'] = dirname(dirname(__FILE__)); $this->params['working'] = dirname(dirname(__FILE__));
} }
if($this->params['working'] !== dirname(dirname(__FILE__))) {
$this->params['root'] = $this->params['working'];
}
$this->params = array_merge(array('app'=> $app, 'root'=> dirname($this->params['working'])), $this->params); $this->params = array_merge(array('app'=> $app, 'root'=> dirname($this->params['working'])), $this->params);
} }
/** /**

View file

@ -71,7 +71,7 @@ class BakeShell extends Shell {
$this->hr(); $this->hr();
if(!is_dir(CONFIGS)) { if(!is_dir(CONFIGS)) {
$this->project($this->params['working']); $this->project($this->params['app']);
} }
if(!config('database')) { if(!config('database')) {
@ -1858,6 +1858,11 @@ class BakeShell extends Shell {
} else { } else {
$this->out('Unable to generate random hash for CAKE_SESSION_STRING, please change this yourself in ' . CONFIGS . 'core.php'); $this->out('Unable to generate random hash for CAKE_SESSION_STRING, please change this yourself in ' . CONFIGS . 'core.php');
} }
if($this->__setCake() === true ){
$this->out('CAKE_CORE_INCLUDE_PATH set to ' . CAKE_CORE_INCLUDE_PATH);
} else {
$this->out('Unable to to set CAKE_CORE_INCLUDE_PATH, please change this yourself in ' . WWW_ROOT . 'index.php');
}
if(chmodr($projectPath.DS.'tmp', 0777) === false) { if(chmodr($projectPath.DS.'tmp', 0777) === false) {
$this->out('Could not set permissions on '. $projectPath.DS.'tmp'.DS.'*'); $this->out('Could not set permissions on '. $projectPath.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');
@ -1956,7 +1961,8 @@ class BakeShell extends Shell {
return false; return false;
} }
} }
function __generateHash(){
function __generateHash(){
$file = file_get_contents(CONFIGS.'core.php'); $file = file_get_contents(CONFIGS.'core.php');
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_SESSION_STRING\\\',[\\t\\x20\'A-z0-9]*\\);)/', $file, $match)) { if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_SESSION_STRING\\\',[\\t\\x20\'A-z0-9]*\\);)/', $file, $match)) {
uses('Security'); uses('Security');
@ -1972,6 +1978,20 @@ class BakeShell extends Shell {
return false; return false;
} }
} }
function __setCake(){
$file = file_get_contents(APP.'webroot'.DS.'index.php');
if (preg_match('/([\\t\\x20]*define\\(\\\'CAKE_CORE_INCLUDE_PATH\\\',[\\t\\x20\'A-z0-9]*\\);)/', $file, $match)) {
$result = str_replace($match[0], "\t\tdefine('CAKE_CORE_INCLUDE_PATH', '".CAKE_CORE_INCLUDE_PATH."');", $file);
if(file_put_contents(APP.'webroot'.DS.'index.php', $result)){
return true;
} else {
return false;
}
} else {
return false;
}
}
/** /**
* Outputs an ASCII art banner to standard output. * Outputs an ASCII art banner to standard output.
* *

View file

@ -71,10 +71,10 @@ class Shell extends Object {
*/ */
function __construct(&$dispatch) { function __construct(&$dispatch) {
$this->Dispatch = & $dispatch; $this->Dispatch = & $dispatch;
$this->params = & $this->Dispatch->params; $vars = array('params', 'args', 'shellName', 'shellCommand');
$this->args = & $this->Dispatch->args; foreach($vars as $var) {
$this->name = & $this->Dispatch->shellName; $this->{$var} = & $this->Dispatch->{$var};
$this->command = & $this->Dispatch->shellCommand; }
} }
/** /**
* Initializes the Shell * Initializes the Shell