Re: Proposal: A need for simple development helping tools/scripts

From: Date: Thu, 12 Jun 2003 03:08:47 +0000
Subject: Re: Proposal: A need for simple development helping tools/scripts
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-17339@lists.php.net to get a copy of this message
--- "Tomas V.V.Cox" <cox@idecnet.com> wrote: > > ----- Original Message ----- > From: "Jesus M. Castagnetto" <jcastagnetto@yahoo.com> > > > > > > --- "Tomas V.V.Cox" <cox@idecnet.com> wrote: > > > > > > ----- Original Message ----- > > > From: "Jesus M. Castagnetto" <jcastagnetto@yahoo.com> > > > > > > > > > > I remember that Greg mentioned that he built a script to generate a > > > package.xml > > > > file. That would be a boon for PEAR packages with a complex tree. I > saw > > > that > > > > script in the phpDocumentor's CVS tree (scripts/create_package.xml), > and > > > with > > > > some little tinkering it could be adapted to be general. > > > > > > > > Ideas/suggestions/pointers/recommendations? > > > > > > Some pointers: > > > > > > php4/pear/PEAR/Common.php methods: > > > > > > infoFromDescriptionFile(): reads a package.xml file and returns its > > > information as an array. > > > xmlFromInfo(): takes an array (with the format of the infoFrom*() > methods) > > > and builds the package.xml file. > > > > Nope not that type. Something along the lines of generating a package.xml > from > > the directory tree automagically. Not from a manually constructed array > ;-) > > > > Check: > > > > > > http://cvs.joshuaeichorn.com/co.php/phpdoc/scripts/create_package.xml.php?r= > 1.22 > > > > That can be modified to be used in newer programs to jump-start the > package > > writting. > > My pointer was precisely to avoid the huge work of creating the xml by hand. > It's for far easier to map the filesystem to a simple array and then call > xmlFromInfo() to create the xml file, than doing like this script. Btw, if > the format of the xml changes, you'll need to change the script too, while > using the exact method that the pear cmd uses this won't be a problem. Ah!, gotcha. That is simple and quick. > See how easy could that tool look in few lines: > > <?php > include 'PEAR/Common.php'; > include 'System.php'; > $common = new PEAR_Common; > $pkginfo = $common->infoFromFile('sample_skeleton_package.xml'); > $find = System::_dirToStruct(getcwd()); // Sorry for this ;) > $filelist = array(); > foreach($find['files'] as $file) { > $filelist[] = array($file, array('role' => guessRole($file))); > } > $pkginfo['filelist'] = $filelist; > $fp = fopen('package.xml', 'w'); > fputs($fp, $common->xmlFromInfo($pkginfo)); > fclose($fp); > ?> > > > As for putting all the devel tools in a package, I guess it would OK too. > I can > > contribute my ugly (but working) script to generate a skeleton for a unit > test > > class (just to save some typing ;-), it is in > Math_Stats/test/mkUnitTest.php. > > Something for generating API Docs would be nice too. I am playing with the VIM plugins for PHP editing. The 'PHP collection' and the 'taglist.vim' are nice, see the screenshots at: http://www.scripps.edu/~jesusmc/images/index.php There is also a plugin to generate a phpdoc skeleton (PDocS). The plugins are at: PHP Collection: http://www.vim.org/scripts/script.php?script_id=326 PDocS: http://www.vim.org/scripts/script.php?script_id=520 taglist.vim: http://www.vim.org/scripts/script.php?script_id=273 The screenshots showing the manual entry use a modification I made to the PHP collection, which I sent some time ago to the current maintainer of those plugins. You can also open an xterm w/ the manual entry, as seen in: http://talks.php.net/show/sdphp_using_tools/18 BTW, the taglist.vim works w/ PHP based on a patch for exhuberant ctags (ctags.sf.net) I wrote back in 2001, since then the ctags maintainer has done some tweking to that code, and works great. If someone has some time, maybe he/she can add to the PHP parser for ctags, so it groks also variable names and function references. A related interesting tool is 'vtags' which is a vim function plugin, that seems to grok PHP. Had not tested it yet. vtags: http://www.vim.org/scripts/script.php?script_id=337 vtags_def: http://www.vim.org/scripts/script.php?script_id=338 As a post-facto (i.e. one that works on existing code) phpdoc creator, I am not sure I know of one. Only post-facto script I know to mangle/format code is: beautify php: http://www.bierkandt.org/beautify/ I have tested others, but that seems to be OK, altough it gets somewhat confused with the folding markers in my code (already complained to the maintainer, am I a whiner or what? ;-) Cheers. ===== --- Jesus M. Castagnetto (jcastagnetto@yahoo.com) Research: http://metallo.scripps.edu/ Personal: http://www.castagnetto.org/ __________________________________ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com

« previous php.pear.dev (#17339) next »