function run($commands) { $name = array_shift($commands); $path = sprintf('%s/%s/%s_generator.php', dirname(__FILE__), $name, $name); $klass = Trails_Dispatcher::camelize($name) . 'Generator'; if (!file_exists($path)) { printf("\n" . " You must supply a valid generator as the first command.\n\n" . " Available generators are:\n\n" . " %s\n\n", join("\n ", Trails_Generator::get_generators())); return; } require_once $path; $generator =& new $klass($path, $commands); if (!sizeof($commands)) { echo $generator->usage(); return; } $generator->manifest(); printf("%s\n", join("\n", $generator->log)); }
<?php echo '<?php'; ?> class <?php echo Trails_Dispatcher::camelize($controller); ?> Controller extends Trails_Controller { <?php foreach ($actions as $action) { ?> function <?php echo $action; ?> _action() { } <?php } ?> }