3 * Script for code generation
6 * @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
7 * @author Flávio Gomes da Silva Lisboa <flavio.lisboa@serpro.gov.br>
8 * @copyright Copyright (c) 2013 Metaways Infosystems GmbH (http://www.metaways.de)
12 define('APPLICATION','Application');
21 $opts = new Zend_Console_Getopt(array(
22 'create application|a=s'=>'create application option with required string parameter',
23 'help'=>'help option with no required parameter'
27 } catch (Zend_Console_Getopt_Exception $e) {
28 echo $e->getUsageMessage();
32 if ($applicationName = $opts->getOption('a'))
34 create(APPLICATION, array($applicationName));
35 echo "Application $applicationName was created successfully into tine20 folder! \n";
38 echo $e->getUsageMessage();
43 * Sets the include path and loads autoloader classes
45 function prepareEnvironment()
48 realpath(dirname(__FILE__) . '/../tine20'),
49 realpath(dirname(__FILE__) . '/../tine20/library'),
52 set_include_path(implode(PATH_SEPARATOR, $paths));
54 require_once 'Zend/Loader/Autoloader.php';
55 $autoloader = Zend_Loader_Autoloader::getInstance();
56 $autoloader->setFallbackAutoloader(true);
57 Tinebase_Autoloader::initialize($autoloader);
61 * Creates an instance of a class that knows how to build the requested structure
62 * @param string $builder
64 function create($builder, array $args)
66 // last argument is path of Tine 2.0
67 $args[] = realpath(dirname(__FILE__) . '/../tine20');
69 $className = 'Tool_CodeGenerator_' . $builder;
70 $tcg = new $className();