2 // vim: foldmethod=marker
6 * please go to http://ethna.jp/ethna-document-dev_guide-pearchannel.html
9 * @author Yoshinari Takaoka <takaoka@beatcraft.com>
10 * @license http://www.opensource.org/licenses/bsd-license.php The BSD License
15 // {{{ Ethna_Plugin_Handle_CreatePlugin
17 * create Ethna Plugin Skelton handler.
19 * @author Yoshinari Takaoka <takaoka@beatcraft.com>
23 class Ethna_Plugin_Handle_CreatePlugin extends Ethna_Plugin_Handle
38 if (Ethna::isError($r)) {
41 list($opt_list, $arg_list) = $r;
44 $plugin_name = array_shift($arg_list);
45 if (empty($plugin_name)) {
46 return Ethna::raiseError('Please specify plugin Name.', 'usage');
50 $type = end($opt_list['type']);
51 $types = explode(',', $type);
53 $types = array('v', 'f', 'sm'); // Validator, Filter, Smarty modifier.
57 if (isset($opt_list['basedir'])) {
58 $basedir = realpath(end($opt_list['basedir']));
64 $forpackage = (isset($opt_list['plugin-package'])) ? true : false;
66 $r = Ethna_Generator::generate('CreatePlugin', NULL, $basedir, $types, $forpackage, $plugin_name);
67 if (Ethna::isError($r)) {
68 printf("error occurred while generating plugin skelton. please see also error messages given above\n\n");
71 printf("\nplugin skelton for [%s] is successfully generated.\n\n", $plugin_name);
76 // {{{ getDescription()
83 ethna {$this->id} [-b|--basedir=dir] [-t|--type=f,v,sb,sf,sm...] [-p|--plugin-package] plugin-name
84 -t: type is as follows (separated by comma):
86 v = Validator (default),
87 sm = Smarty modifier (default)
90 -p: if you want to make plugin package, set this option.
95 // {{{ getDescription()
99 function getDescription()
103 {$this->id} [-b|--basedir=dir] [-t|--type=f,v,sb,sf,sm...] [-p|--plugin-package] plugin-name