Exemplo n.º 1
0
<?php

/**
 * Medick generator.
 * $Id: generator.php 332 2006-01-12 08:05:47Z aurelian $
 */
$type = isset($argv[1]) ? $argv[1] : exit("Use one of controller or model for generator.\n");
$name = isset($argv[2]) ? strtolower($argv[2]) : exit($argv[0] . " needs a " . $argv[1] . " name.\n");
switch ($type) {
    case "controller":
        generate_controller($name, "/wwwroot/medick/applications/eltodo");
        break;
    case "model":
        generate_model($name, "/wwwroot/medick/applications/eltodo");
        break;
    default:
        exit("Use one of controller or model for generator.\n");
}
exit("\nMedick (\$v: 0.0.5-svn) [ DONE ].\n");
function generate_controller($name, $app_location)
{
    $controller_class_name = ucfirst(strtolower($name)) . 'Controller';
    echo "Creating controller class {$controller_class_name} from {$name}\n";
    $methods = array_slice($_SERVER['argv'], 3);
    $controller_class_text = "<?php\nclass {$controller_class_name} extends ApplicationController {\n";
    $views = $app_location . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR;
    if (!is_dir($views . $name)) {
        mkdir($views . $name);
        echo "\tcreate " . $views . $name . "\n";
    } else {
        echo "\texists " . $views . $name . "\n";
Exemplo n.º 2
0
/**
 * Medick generator.
 * @todo this will be refactored to use the planned IGenerator classes
 * @package medick.generator
 * $Id: generator.php 398 2006-05-23 19:18:28Z aurelian $
 */
// {{{ main
$type = isset($argv[1]) ? $argv[1] : exit(main_banner($argv[0]));
$name = isset($argv[2]) ? strtolower($argv[2]) : exit($argv[0] . " needs a " . $argv[1] . " name.\n");
switch ($type) {
    case "controller":
        generate_controller($name, '/wwwroot/medick/applications/cookbook');
        break;
    case "model":
        generate_model($name, '/wwwroot/medick/applications/cookbook');
        break;
    default:
        exit(main_banner($argv[0]));
}
exit("\nMedick (\$v: 0.3.0pre1) [ DONE ].\n");
// }}}
// {{{ main_banner
function main_banner($script_name)
{
    $buffer = <<<EOBANNER
Medick Generator 0.3.0pre1 
(c) 2005-2006 Oancea Aurelian, see LICENSE file for copyright details.
 
     Use one of controller or model:
 
Exemplo n.º 3
0
/**
 * Medick generator.
 * @todo this will be refactored to use the planned IGenerator classes
 * @package medick.generator
 * $Id$
 */
// {{{ main
$type = isset($argv[1]) ? $argv[1] : exit(main_banner($argv[0]));
$name = isset($argv[2]) ? strtolower($argv[2]) : exit($argv[0] . " needs a " . $argv[1] . " name.\n");
switch ($type) {
    case "controller":
        generate_controller($name, '/wwwroot/rwd/trunk/medickart');
        break;
    case "model":
        generate_model($name, '/wwwroot/rwd/trunk/medickart');
        break;
    default:
        exit(main_banner($argv[0]));
}
exit("\nMedick (\$v: 0.2.3-svn) [ DONE ].\n");
// }}}
// {{{ main_banner
function main_banner($script_name)
{
    $buffer = <<<EOBANNER
Medick Generator 0.2.3-svn 
(c) 2005-2006 Oancea Aurelian, see LICENSE file for copyright details.
 
     Use one of controller or model:
 
Exemplo n.º 4
0
/**
 * Medick generator.
 * @todo this will be refactored to use the planned IGenerator classes
 * @package medick.generator
 * $Id$
 */
// {{{ main
$type = isset($argv[1]) ? $argv[1] : exit(main_banner($argv[0]));
$name = isset($argv[2]) ? strtolower($argv[2]) : exit($argv[0] . " needs a " . $argv[1] . " name.\n");
switch ($type) {
    case "controller":
        generate_controller($name, '${app.path}');
        break;
    case "model":
        generate_model($name, '${app.path}');
        break;
    default:
        exit(main_banner($argv[0]));
}
exit("\nMedick (\$v: {${medick . version}}) [ DONE ].\n");
// }}}
// {{{ main_banner
function main_banner($script_name)
{
    $buffer = <<<EOBANNER
Medick Generator {${medick . version}} 
(c) 2005-2006 Oancea Aurelian, see LICENSE file for copyright details.
 
     Use one of controller or model:
 
Exemplo n.º 5
0
/**
 * Medick generator.
 * @todo this will be refactored to use the planned IGenerator classes
 * @package medick.generator
 * $Id$
 */
// {{{ main
$type = isset($argv[1]) ? $argv[1] : exit(main_banner($argv[0]));
$name = isset($argv[2]) ? strtolower($argv[2]) : exit($argv[0] . " needs a " . $argv[1] . " name.\n");
switch ($type) {
    case "controller":
        generate_controller($name, '/wwwroot/medick/applications/testor');
        break;
    case "model":
        generate_model($name, '/wwwroot/medick/applications/testor');
        break;
    default:
        exit(main_banner($argv[0]));
}
exit("\nMedick (\$v: 0.2.2-svn) [ DONE ].\n");
// }}}
// {{{ main_banner
function main_banner($script_name)
{
    $buffer = <<<EOBANNER
Medick Generator 0.2.2-svn 
(c) 2005-2006 Oancea Aurelian, see LICENSE file for copyright details.
 
     Use one of controller or model: