merge from 1.0.

This commit is contained in:
qiang.xue
2009-07-21 21:03:45 +00:00
parent 6bf45d462e
commit 5c60a2fcfa
4 changed files with 28 additions and 14 deletions

View File

@@ -20,10 +20,12 @@
class ModuleCommand extends CConsoleCommand
{
/**
* @var string the template file for the controller class.
* Defaults to null, meaning using 'framework/cli/views/shell/controller/controller.php'.
* @var string the directory that contains templates for the module command.
* Defaults to null, meaning using 'framework/cli/views/shell/module'.
* If you set this path and some views are missing in the directory,
* the default views will be used.
*/
public $templateFile;
public $templatePath;
public function getHelp()
{
@@ -57,9 +59,7 @@ EOD;
$moduleClass=ucfirst($moduleID).'Module';
$modulePath=Yii::app()->getModulePath().DIRECTORY_SEPARATOR.$moduleID;
$sourceDir=realpath(dirname(__FILE__).'/../../views/shell/module');
if($sourceDir===false)
die('Unable to locate the source directory.');
$sourceDir=$this->templatePath===null?YII_PATH.'/cli/views/shell/module':$this->templatePath;
$list=$this->buildFileList($sourceDir,$modulePath);
$list['module.php']['target']=$modulePath.DIRECTORY_SEPARATOR.$moduleClass.'.php';
$list['module.php']['callback']=array($this,'generateModuleClass');