| [ Index ] |
PHP Cross Reference of Limb3 |
[Summary view] [Print] [Text view]
1 <?php 2 /* 3 * Limb PHP Framework 4 * 5 * @link http://limb-project.com 6 * @copyright Copyright © 2004-2007 BIT(http://bit-creative.com) 7 * @license LGPL http://www.gnu.org/copyleft/lesser.html 8 */ 9 lmb_require('limb/fs/src/lmbFs.class.php'); 10 11 /** 12 * class WebAppCliCmd. 13 * 14 * @package web_app 15 * @version $Id$ 16 */ 17 class WebAppCliCmd extends lmbCliBaseCmd 18 { 19 function execute($argv) 20 { 21 $this->help($argv); 22 } 23 24 function create($argv) 25 { 26 $input = new lmbCliInput(); 27 $input->setMinimumArguments(1); 28 if(!$input->read($argv, false)) 29 { 30 $this->help($argv); 31 return 1; 32 } 33 34 $dst_dir = $input->getArgument(0); 35 if(file_exists($dst_dir)) 36 { 37 echo "Directory or file '$dst_dir' already exists\n"; 38 return 1; 39 } 40 41 echo "Copying skeleton Limb3 WEB_APP application to '$dst_dir'...\n"; 42 43 lmbFs :: cp(dirname(__FILE__) . '/../skel', $dst_dir, '~^\.svn~'); 44 45 echo "Generating code from templates...\n"; 46 47 $this->_resolveTemplate("$dst_dir/setup.override.php.tpl", 48 array('%LIMB_PARENT_DIR%' => realpath(dirname(__FILE__) . '/../../../'))); 49 50 echo "done!"; 51 } 52 53 function help($argv) 54 { 55 $txt = <<<EOD 56 Usage: 57 web_app create <dst_dir> [<app_name>] 58 59 Creates new WEB_APP based skeleton application at specified directory <dst_dir>. 60 61 EOD; 62 echo $txt; 63 } 64 65 protected function _resolveTemplate($template, $vars = array()) 66 { 67 $file = substr($template, 0, strrpos($template, '.')); 68 file_put_contents($file, strtr(file_get_contents($template), $vars)); 69 unlink($template); 70 } 71 } 72 73 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Dec 1 03:56:46 2008 | Cross-referenced by PHPXref 0.7 |