なにはともあれ、MapleのWikiから「クイックスタート」をやってみる。
・・・・できねぇ。orz
と思ったら、Wikiのドキュメントは対象がMaple3.1で、ダウンロードしてきたのは最新版(といっても3年前)の3.2だった。そのドキュメントはhttp://kunit.jp/maple/wiki/index.php?%C9%D5%CF%BF%2F3.2から見ないとだめなのね。
PEARでインストールとか面倒なんで
なんか、ちろっと試すのにPEAR使うんもなーって思ったんだけど、クイックスタートするのに、mapleコマンド必要みたい・・・・。
あーもう、って思って適当な場所に展開したMapleのうち、maple/generate/script/maple.sh を
if [ -z "$MAPLE_DIR" ]; then if [ -x "@PEAR-DIR@" ]; then MAPLE_DIR="@PEAR-DIR@/maple" else MAPLE_DIR=`pwd`/maple fi fi
ってした。
このコマンドを叩くときはMapleを置いたディレクトリの一個上からたたくことになる。
$ ls -l
合計 12
drwxr-xr-x 11 user user 4096 3月 6 2008 maple
- rw-r--r-- 1 user user 548 10月 16 13:46 sample1.php
drwxrwxr-x 5 user user 4096 10月 16 12:57 webapp
$ maple/generate/script/maple.sh
Usage: maple [options][args] Options:
-w, --webapp-dir=DIR WEBAPP_DIR.
-b, --base-dir=DIR BASE_DIR. If this option is not specified, the parent
directory of the WEBAPP_DIR is used, instead.
-a, --webapp-name=name directory name of the WEBAPP_DIR.
If -w is specified, this option is ignored.
-c, --config-path=FILE a path to the configuration file.Installed Generators:
action, component, converter, filter, simple, validator, webappType "maple help
" to get the help for the specified generator.
って感じ。
すると、
$ maple/generate/script/maple.sh webapp
[create] /home/user/htdocs/maple_study/webapp
[create] /home/user/htdocs/maple_study/webapp/modules
[create] /home/user/htdocs/maple_study/webapp/logs
[create] /home/user/htdocs/maple_study/webapp/components
[create] /home/user/htdocs/maple_study/webapp/templates
[create] /home/user/htdocs/maple_study/webapp/templates_c
[create] /home/user/htdocs/maple_study/webapp/config
[create] /home/user/htdocs/maple_study/webapp/config/maple.inc.php
[create] /home/user/htdocs/maple_study/webapp/config/global-config.ini
[create] /home/user/htdocs/maple_study/webapp/config/base.ini
[create] /home/user/htdocs/maple_study/webapp/cache
おー、できた。
で、次。Actionを加えてみる。
$ maple/generate/script/maple.sh action hello_start smarty hell
o_start index
Error:
- /home/user/htdocs/maple_study is not a valid WEBAPP_DIR
- failed to initialize TargetWebappConfig
ありゃ。
うーむ、調べたところMapleコマンドはwebappディレクトリでやらないと駄目なそうだ。ま、しらべたっつーか、単純にエラー吐いたところを見たら
<?php !file_exists($webappDir ."/config/". GLOBAL_CONFIG))
ってなってるんで、そのファイルパスを調べただけだけど。
しかし、そうなると、今度は
webapp]$ ../maple/generate/script/maple.sh action hello_start smarty hello_
start index
Could not open input file: /home/user/htdocs/maple_study/webapp/maple/generate/script/generate.php
ってなる。
うーん。
$ ls -l /home/user/htdocs/maple_study
合計 20
drwxrwxr-x 2 smbuser smbuser 4096 10月 16 14:29 htdocs
drwxr-xr-x 11 smbuser smbuser 4096 3月 6 2008 maple
-rw-r--r-- 1 smbuser smbuser 548 10月 16 14:18 sample1.php
drwxrwxr-x 9 smbuser smbuser 4096 10月 16 14:29 webapp
って構造なんだよなー。webappの下にmapleライブラリ一式は無いんだよ。うーん。
と、2分ほど試行錯誤した後に、てやー、と力技
$ ln -s ../maple ./maple
[user@sc440 webapp]$ ls -l
合計 28
drwxrwxrwx 2 user user 4096 10月 16 14:10 cache
drwxrwxr-x 2 user user 4096 10月 16 14:10 components
drwxrwxr-x 2 user user 4096 10月 16 14:10 config
drwxrwxrwx 2 user user 4096 10月 16 14:10 logs
lrwxrwxrwx 1 user user 8 10月 16 14:29 maple -> ../maple
drwxrwxr-x 2 user user 4096 10月 16 14:10 modules
drwxrwxr-x 2 user user 4096 10月 16 14:10 templates
drwxrwxrwx 2 user user 4096 10月 16 14:10 templates_c
すると、
[webapp]$ ../maple/generate/script/maple.sh action hello_start smarty hello_
start index
[create] /home/user/htdocs/maple_study/webapp/modules/hello/start/Start.class.php
[create] /home/user/htdocs/maple_study/webapp/modules/hello/start/maple.ini
[create] /home/user/htdocs/maple_study/webapp/templates/hello/start.html
[create] /home/user/htdocs/maple_study/htdocs/index.php
おー、できた。
エントリーポイントでPATHを通してやんないと
さっそく出来たエントリポイントにブラウザでアクセス。
・・・・?MapleのあるディレクトリとSmartyのあるディレクトリへのパスを通し忘れた。
エントリポイントの頭で
<?php ini_set('include_path', ini_get('include_path'). ':'. dirname(dirname(__FILE__)). ':'. dirname(dirname(dirname(__FILE__))).'/smarty');
とかしてやって、ようやくHello Worldできたー。
・・・長かった。orz