Source for file Ethna_Plugin_Generator.php
Documentation is available at Ethna_Plugin_Generator.php
// vim: foldmethod=marker
* Ethna_Plugin_Generator.php
* @author Masaki Fujimoto <fujimoto@php.net>
* @license http://www.opensource.org/licenses/bsd-license.php The BSD License
// {{{ Ethna_Plugin_Generator
* @author Masaki Fujimoto <fujimoto@php.net>
/** @var object Ethna_Controller スケルトン生成に使うコントローラ */
// Ethna_Generatorでpluginを取得するときに使ったコントローラ
// ex, add-projectではEthna_Controller, app-actionではApp_Controller
$this->ctl =
& $controller;
* @param string $skel スケルトンファイル
function _resolveSkelfile($skel)
$file =
"$base/skel/$skel";
$file =
"$base/skel/$skel";
* スケルトンファイルにマクロを適用してファイルを生成する
* @param string $skel スケルトンファイル
* @param string $entity 生成ファイル名
* @param array $macro 置換マクロ
* @param bool $overwrite 上書きフラグ
* @return bool true:正常終了 false:エラー
function _generateFile($skel, $entity, $macro, $overwrite =
false)
if ($overwrite ===
false) {
printf("file [%s] already exists -> skip\n", $entity);
printf("file [%s] already exists, to be overwriten.\n", $entity);
$resolved =
$this->_resolveSkelfile($skel);
if ($resolved ===
false) {
printf("skelton file [%s] not found.\n", $skel);
$rfp =
fopen($skel, "r");
$wfp =
fopen($entity, "w");
foreach ($macro as $k =>
$v) {
if (chmod($entity, $st[2]) ==
false) {
printf("file generated [%s -> %s]\n", $skel, $entity);
* ユーザ定義のマクロを設定する(~/.ethna)
if (isset
($_SERVER['USERPROFILE']) &&
is_dir($_SERVER['USERPROFILE'])) {
$home =
$_SERVER['USERPROFILE'];
$home =
$_SERVER['HOME'];
if (is_file("$home/.ethna") ==
false) {
Documentation generated on Fri, 11 Nov 2011 04:00:10 +0900 by phpDocumentor 1.4.3