From 5d6b5de61b5fb7c18bf721fb10934101898c336c Mon Sep 17 00:00:00 2001 From: mumumu-org Date: Thu, 1 May 2008 14:48:48 +0000 Subject: [PATCH] - ETHNA_UTF8_BRANCH followed r519 in trunk. --- CHANGES | 7 ++- Ethna.php | 2 +- bin/ethna_make_package.php | 9 ++-- class/Ethna_Controller.php | 19 ++++++-- class/Ethna_SmartyPlugin.php | 7 ++- class/Ethna_UnitTestManager.php | 57 ++++++++++++++++++++++ class/Ethna_UnitTestReporter.php | 2 +- .../Handle/Ethna_Plugin_Handle_PearLocal.php | 15 +++--- .../Validator/Ethna_Plugin_Validator_Mbregexp.php | 2 +- misc/optional_package/Smarty/build/build.conf | 7 +-- misc/optional_package/simpletest/build/build.conf | 7 +-- skel/skel.template.tpl | 2 +- skel/template.index.tpl | 2 +- tpl/info.tpl | 2 +- tpl/unittest.tpl | 2 +- 15 files changed, 106 insertions(+), 36 deletions(-) diff --git a/CHANGES b/CHANGES index cbff775..834c9da 100644 --- a/CHANGES +++ b/CHANGES @@ -1,12 +1,17 @@ * 変更点一覧 -** 2.5.0-dev +** 2.3.5 *** features +- PEAR チャンネルサーバに ethna/simpletest, ethna/Smarty を追加 +-- インストール後のsimpletest, Smartyのパスで悩む罠を軽減することが目的 +-- pear コマンドで Ethna をインストールするときにこれらを Optional に依存するように設定。既存のインストールを考慮して、required にはしていない。 - Ethnaコマンドに一般的なテストケースコマンドとして add-test コマンドを追加(thanks: BoBpp) -- ethna add-test -s [skelname] [name] で実行できます -- http://blog.as-roma.com/BoBlog/index.php?itemid=1338 +-- これは自動登録されるため、[appid]_UnitTestManager に定義を追加する必要はありません(thanks: id:okonomi) +--- http://d.hatena.ne.jp/okonomi/20080408 - Ethna_Renderer_Rhacoを追加(experimental) - Ethna_DB_ADOdbのdebug時のログ出力をEthnaのLoggerに変更(@see http://d.hatena.ne.jp/sotarok/20071224) - Ethna add-[|action|view]-test コマンドで生成されるテストケースがデフォルトでfailするように改善 diff --git a/Ethna.php b/Ethna.php index 7c46cae..83a21f5 100644 --- a/Ethna.php +++ b/Ethna.php @@ -32,7 +32,7 @@ if (!defined('DIRECTORY_SEPARATOR')) { } /** バージョン定義 */ -define('ETHNA_VERSION', '2.3.2'); +define('ETHNA_VERSION', '2.3.5'); /** Ethnaベースディレクトリ定義 */ define('ETHNA_BASE', dirname(__FILE__)); diff --git a/bin/ethna_make_package.php b/bin/ethna_make_package.php index dc396dd..538facb 100644 --- a/bin/ethna_make_package.php +++ b/bin/ethna_make_package.php @@ -41,7 +41,7 @@ $package = 'Ethna'; // x.0.y -> beta // x.1.y -> stable $major_version = "2.3"; -$minor_version = "2"; +$minor_version = "5"; if ($state == 'alpha' || $state == 'beta') { $version = $major_version . strftime('.%Y%m%d%H'); @@ -58,7 +58,7 @@ $config = array( 'baseinstalldir' => 'Ethna', 'packagedirectory' => dirname(dirname(__FILE__)), 'filelistgenerator' => 'file', - 'ignore' => array('CVS/', '.svn/', 'package.xml', 'ethna_make_package.php', 'ethna_make_package.sh'), + 'ignore' => array('CVS/', '.svn/', 'package.xml', 'ethna_make_package.php', 'ethna_make_package.sh', '*optional_package*', ), 'changelogoldtonew' => false, 'exceptions' => array('README' => 'doc', 'LICENSE' => 'doc', 'CHANGES' => 'doc'), 'description' => $description, @@ -67,12 +67,13 @@ $config = array( 'installas' => array('bin/ethna.sh' => 'ethna', 'bin/ethna.bat' => 'ethna.bat'), ); +$ethna_channel = 'pear.ethna.jp'; $packagexml = new PEAR_PackageFileManager2(); $packagexml->setOptions($config); $packagexml->setPackage($package); $packagexml->setSummary('Ethna PHP Framework Package'); $packagexml->setDescription($description); -$packagexml->setChannel('pear.ethna.jp'); +$packagexml->setChannel($ethna_channel); $packagexml->setAPIVersion($version); $packagexml->setReleaseVersion($version); $packagexml->setReleaseStability($state); @@ -84,6 +85,8 @@ $packagexml->addRole('*', 'php'); $packagexml->setPhpDep('4.1.0'); $packagexml->setPearinstallerDep('1.3.5'); +$packagexml->addPackageDepWithChannel('optional', 'Smarty', $ethna_channel); +$packagexml->addPackageDepWithChannel('optional', 'simpletest', $ethna_channel); $packagexml->addMaintainer('lead', 'fujimoto' , 'Masaki Fujimoto', 'fujimoto@php.net'); $packagexml->addMaintainer('lead', 'halt' , 'halt feits', 'halt.feits@gmail.com'); diff --git a/class/Ethna_Controller.php b/class/Ethna_Controller.php index ff6ef5c..5693a3f 100644 --- a/class/Ethna_Controller.php +++ b/class/Ethna_Controller.php @@ -468,7 +468,7 @@ class Ethna_Controller * ビューディレクトリ名を決定する * * @access public - * @return string アクションディレクトリ + * @return string ビューディレクトリ */ function getViewdir() { @@ -476,6 +476,17 @@ class Ethna_Controller } /** + * (action,view以外の)テストケースを置くディレクトリ名を決定する + * + * @access public + * @return string テストケースを置くディレクトリ + */ + function getTestdir() + { + return (empty($this->directory['test']) ? ($this->base . (empty($this->base) ? '' : '/')) : ($this->directory['test'] . "/")); + } + + /** * アプリケーションディレクトリ設定を返す * * @access public @@ -2108,14 +2119,14 @@ class Ethna_Controller */ function ethnaManagerCheckErrorMsg($action_name) { - $appid = $this->getAppId(); + $appid = strtolower($this->getAppId()); $run_action = ($action_name == '__ethna_info__') ? ' show Application Info List ' : ' run Unit Test '; echo "Ethna cannot {$run_action} under your application setting.
"; - echo "HINT: You must set {$appid}/etc/{$appid}.ini debug setting 'true'.
"; + echo "HINT: You must set {$appid}/etc/{$appid}-ini.php debug setting 'true'.
"; echo "
"; - echo "In {$appid}.ini, please set as follows :

"; + echo "In {$appid}-ini.php, please set as follows :

"; echo "\$config = array ( 'debug' => true, );"; } diff --git a/class/Ethna_SmartyPlugin.php b/class/Ethna_SmartyPlugin.php index e9ef506..1209a46 100644 --- a/class/Ethna_SmartyPlugin.php +++ b/class/Ethna_SmartyPlugin.php @@ -242,9 +242,12 @@ function smarty_modifier_wordwrap_i18n($string, $width, $break = "\n", $indent = continue; } - $s = mb_strimwidth($tmp, 0, $width, "", "EUC-JP"); + $s = mb_strimwidth($tmp, 0, $width, "", "UTF-8"); - // EUC-JPのみ対応 + // + // eucjpのみ対応 + // TODO: 修正の対象 + // $n = strlen($s); if ($n >= $width && $tmp{$n} != "" && $tmp{$n} != " ") { while ((ord($s{$n-1}) & 0x80) == 0) { diff --git a/class/Ethna_UnitTestManager.php b/class/Ethna_UnitTestManager.php index 4a7cf29..24c4b5a 100644 --- a/class/Ethna_UnitTestManager.php +++ b/class/Ethna_UnitTestManager.php @@ -38,6 +38,63 @@ class Ethna_UnitTestManager extends Ethna_AppManager parent::Ethna_AppManager($backend); $this->ctl =& Ethna_Controller::getInstance(); $this->class_factory =& $this->ctl->getClassFactory(); + $this->testcase = array_merge($this->testcase, $this->_getTestCaseList()); + } + + /** + * action, view 以外のテストケースの一覧を取得する + * + * @access private + * @param テストケースが含まれているディレクトリ名 + */ + function _getTestCaseList($test_dir = NULL) + { + $r = array(); + + if (is_null($test_dir)) { + $test_dir = $this->ctl->getTestdir(); + } + $base = $this->ctl->getBasedir(); + + $child_dir_list = array(); + + $dh = opendir($test_dir); + if ($dh == false) { + return; + } + + $ext = $this->ctl->getExt('php'); + while (($file = readdir($dh)) !== false) { + if ($file == "." || $file == "..") { + continue; + } + $file = $test_dir . $file; + + if (is_dir($file)) { + $child_dir_list[] = $file; + continue; + } + + if (preg_match("/\.$ext\$/", $file) == 0) { + continue; + } + + $file = str_replace($this->ctl->getTestdir(), '', $file); + + $key = ereg_replace("^(.*)Test\.$ext", '\1', $file); + $key = str_replace('/', '', $key); + + $r[$key] = str_replace($base . '/', '', $this->ctl->getTestdir() . $file); + } + + closedir($dh); + + foreach ($child_dir_list as $child_dir) { + $tmp = $this->_getTestCaseList($child_dir . "/"); + $r = array_merge($r, $tmp); + } + + return $r; } /** diff --git a/class/Ethna_UnitTestReporter.php b/class/Ethna_UnitTestReporter.php index 8bbaa0f..73dc841 100644 --- a/class/Ethna_UnitTestReporter.php +++ b/class/Ethna_UnitTestReporter.php @@ -30,7 +30,7 @@ class Ethna_UnitTestReporter extends SimpleReporter { * @access public * @param string $character_set キャラクタセット */ - function Ethna_UnitTestReporter($character_set = 'EUC-JP') + function Ethna_UnitTestReporter($character_set = 'UTF-8') { $this->SimpleReporter(); $this->_character_set = $character_set; diff --git a/class/Plugin/Handle/Ethna_Plugin_Handle_PearLocal.php b/class/Plugin/Handle/Ethna_Plugin_Handle_PearLocal.php index 3c60088..10b5d7f 100644 --- a/class/Plugin/Handle/Ethna_Plugin_Handle_PearLocal.php +++ b/class/Plugin/Handle/Ethna_Plugin_Handle_PearLocal.php @@ -39,16 +39,17 @@ class Ethna_PearConfig_Local extends Ethna_PearWrapper $base = $this->target_ctl->getBaseDir(); $bin = $this->target_ctl->getDirectory('bin'); $tmp = $this->target_ctl->getDirectory('tmp'); + $lib = "{$base}/lib"; $dirs = array( - 'php_dir' => "{$base}/lib", + 'php_dir' => "$lib", 'bin_dir' => "{$base}/bin", 'cache_dir' => "{$tmp}/.pear/cache", - 'download_dir' => "{$tmp}/.pear/download", - 'temp_dir' => "{$tmp}/.pear/temp", - 'doc_dir' => "{$tmp}/.pear/doc", - 'ext_dir' => "{$tmp}/.pear/ext", - 'data_dir' => "{$tmp}/.pear/data", - 'test_dir' => "{$tmp}/.pear/test", + 'download_dir' => "{$lib}/.pear/download", + 'temp_dir' => "{$lib}/.pear/temp", + 'doc_dir' => "{$lib}/.pear/doc", + 'ext_dir' => "{$lib}/.pear/ext", + 'data_dir' => "{$lib}/.pear/data", + 'test_dir' => "{$lib}/.pear/test", ); $default_pearrc = "{$base}" diff --git a/class/Plugin/Validator/Ethna_Plugin_Validator_Mbregexp.php b/class/Plugin/Validator/Ethna_Plugin_Validator_Mbregexp.php index 5b923f4..9665b97 100644 --- a/class/Plugin/Validator/Ethna_Plugin_Validator_Mbregexp.php +++ b/class/Plugin/Validator/Ethna_Plugin_Validator_Mbregexp.php @@ -31,7 +31,7 @@ class Ethna_Plugin_Validator_Mbregexp extends Ethna_Plugin_Validator $encoding = (isset($params['encoding'])) ? $params['encoding'] - : 'EUC-JP'; + : 'UTF-8'; mb_regex_encoding($encoding); if (mb_ereg($params['mbregexp'], $var) !== 1) { diff --git a/misc/optional_package/Smarty/build/build.conf b/misc/optional_package/Smarty/build/build.conf index a6467a1..4bf1cde 100644 --- a/misc/optional_package/Smarty/build/build.conf +++ b/misc/optional_package/Smarty/build/build.conf @@ -8,7 +8,7 @@ release_dir = ../release package_name = Smarty package_type = php baseinstalldir = /Smarty -channel = pear.ethna.jp +channel = pear.ethna.jp summary = PHP Template Engine ;description = Most Popular Template Engine notes = PEAR Style Package @@ -52,11 +52,6 @@ name = Andrei Zmievski email = andrei@php.net role = lead -[maintainer://tsuruoka] -name = TSURUOKA Naoya -email = tsuruoka@labs.cybozu.co.jp -role = helper - ;[file://] ;commandscript = command ;ignore = 1 diff --git a/misc/optional_package/simpletest/build/build.conf b/misc/optional_package/simpletest/build/build.conf index ce22703..e1aeb5b 100644 --- a/misc/optional_package/simpletest/build/build.conf +++ b/misc/optional_package/simpletest/build/build.conf @@ -8,7 +8,7 @@ release_dir = ../release package_name = simpletest package_type = php baseinstalldir = /simpletest -channel = pear.ethna.jp +channel = pear.ethna.jp summary = Unit testing, mock objects and web testing framework for PHP built around test cases. ;description = notes = PEAR Style Package @@ -47,11 +47,6 @@ name = lastcraft email = lastcraft at users.sourceforge.net role = lead -[maintainer://ha1t] -name = halt feits -email = halt.feits at gmail.com -role = helper - ;[file://] ;commandscript = command ;ignore = 1 diff --git a/skel/skel.template.tpl b/skel/skel.template.tpl index 5a3663b..2cbdb41 100644 --- a/skel/skel.template.tpl +++ b/skel/skel.template.tpl @@ -1,7 +1,7 @@ - +

{$project_id}

diff --git a/skel/template.index.tpl b/skel/template.index.tpl index 4165af0..43dbdeb 100644 --- a/skel/template.index.tpl +++ b/skel/template.index.tpl @@ -1,7 +1,7 @@ - + diff --git a/tpl/info.tpl b/tpl/info.tpl index ea7efa6..6d86012 100644 --- a/tpl/info.tpl +++ b/tpl/info.tpl @@ -1,7 +1,7 @@ - +