OSDN Git Service

- ETHNA_UTF8_BRANCH followed r519 in trunk.
authormumumu-org <mumumu-org@2ef88817-412d-0410-a32c-8029a115e976>
Thu, 1 May 2008 14:48:48 +0000 (14:48 +0000)
committermumumu-org <mumumu-org@2ef88817-412d-0410-a32c-8029a115e976>
Thu, 1 May 2008 14:48:48 +0000 (14:48 +0000)
15 files changed:
CHANGES
Ethna.php
bin/ethna_make_package.php
class/Ethna_Controller.php
class/Ethna_SmartyPlugin.php
class/Ethna_UnitTestManager.php
class/Ethna_UnitTestReporter.php
class/Plugin/Handle/Ethna_Plugin_Handle_PearLocal.php
class/Plugin/Validator/Ethna_Plugin_Validator_Mbregexp.php
misc/optional_package/Smarty/build/build.conf
misc/optional_package/simpletest/build/build.conf
skel/skel.template.tpl
skel/template.index.tpl
tpl/info.tpl
tpl/unittest.tpl

diff --git a/CHANGES b/CHANGES
index cbff775..834c9da 100644 (file)
--- 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するように改善
index 7c46cae..83a21f5 100644 (file)
--- 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__));
index dc396dd..538facb 100644 (file)
@@ -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');
index ff6ef5c..5693a3f 100644 (file)
@@ -468,7 +468,7 @@ class Ethna_Controller
      *  ビューディレクトリ名を決定する
      *
      *  @access public
-     *  @return string  ã\82¢ã\82¯ã\82·ã\83§ã\83³ディレクトリ
+     *  @return string  ã\83\93ã\83¥ã\83¼ディレクトリ
      */
     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.<br>";
-         echo "HINT: You must set {$appid}/etc/{$appid}.ini debug setting 'true'.<br>";
+         echo "HINT: You must set {$appid}/etc/{$appid}-ini.php debug setting 'true'.<br>";
          echo "<br>";
-         echo "In {$appid}.ini, please set as follows :<br><br>";
+         echo "In {$appid}-ini.php, please set as follows :<br><br>";
          echo "\$config = array ( 'debug' => true, );";
      } 
 
index e9ef506..1209a46 100644 (file)
@@ -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) {
index 4a7cf29..24c4b5a 100644 (file)
@@ -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;
     }
 
     /**
index 8bbaa0f..73dc841 100644 (file)
@@ -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;
index 3c60088..10b5d7f 100644 (file)
@@ -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}"
index 5b923f4..9665b97 100644 (file)
@@ -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) {
index a6467a1..4bf1cde 100644 (file)
@@ -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://<filepath>]
 ;commandscript = command
 ;ignore = 1
index ce22703..e1aeb5b 100644 (file)
@@ -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://<filepath>]
 ;commandscript = command
 ;ignore = 1
index 5a3663b..2cbdb41 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
     <head>
-        <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
+        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     </head>
     <body>
         <h1>{$project_id}</h1>
index 4165af0..43dbdeb 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
-<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" />
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <link rel="stylesheet" href="{$config.url}css/ethna.css" type="text/css" />
 </head>
 <body>
index ea7efa6..6d86012 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
 <html>
     <head>
-        <meta http-equiv="content-type" content="text/html;charset=EUC-JP" />
+        <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
         <style type="text/css">
         <!--
         {literal}
index aeb3b3e..6f0f0aa 100644 (file)
@@ -1,7 +1,7 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html lang="ja">
 <head>
-  <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
+  <meta http-equiv="Content-Type" content="text/html; charset="UTF-8">
   <meta http-equiv="Content-Style-Type" content="text/css">
     <title>{$app.app_id} - Ethna UnitTest</title>
     <style type="text/css">