/** * Execution method always used for tasks * Handles dispatching to interactive, named, or all processes. * * @return void */ public function execute() { parent::execute(); if (empty($this->args)) { $this->_interactive(); } if (isset($this->args[0])) { $this->interactive = false; if (!isset($this->connection)) { $this->connection = 'default'; } if (strtolower($this->args[0]) === 'all') { return $this->all(); } $model = $this->_modelName($this->args[0]); $this->bake($model); } }
/** * get the option parser. * * @return void */ public function getOptionParser() { $parser = parent::getOptionParser(); return $parser->description(__d('cake_console', 'Bake models.'))->addArgument('name', array('help' => __d('cake_console', 'Name of the model to bake. Can use Plugin.name to bake plugin models.')))->addSubcommand('all', array('help' => __d('cake_console', 'Bake all model files with associations and validation.')))->addOption('plugin', array('short' => 'p', 'help' => __d('cake_console', 'Plugin to bake the model into.')))->addOption('connection', array('short' => 'c', 'help' => __d('cake_console', 'The connection the model table is on.')))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.')); }
/** * Override initialize * * @access public */ function __construct(&$dispatch) { parent::__construct($dispatch); $this->path = $this->params['working'] . DS . 'tests' . DS . 'fixtures' . DS; }
/** * get the option parser for this task * * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); return $parser->description(__d('cake_console', 'Bake views for a controller, using built-in or custom templates.'))->addArgument('controller', array('help' => __d('cake_console', 'Name of the controller views to bake. Can be Plugin.name as a shortcut for plugin baking.')))->addArgument('action', array('help' => __d('cake_console', "Will bake a single action's file. core templates are (index, add, edit, view)")))->addArgument('alias', array('help' => __d('cake_console', 'Will bake the template in <action> but create the filename after <alias>.')))->addOption('plugin', array('short' => 'p', 'help' => __d('cake_console', 'Plugin to bake the view into.')))->addOption('admin', array('help' => __d('cake_console', 'Set to only bake views for a prefix in Routing.prefixes'), 'boolean' => true))->addOption('connection', array('short' => 'c', 'help' => __d('cake_console', 'The connection the connected model is on.')))->addSubcommand('all', array('help' => __d('cake_console', 'Bake all CRUD action views for all controllers. Requires models and controllers to exist.')))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.')); }
/** * Gets the option parser instance and configures it. * * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); $parser->description(__d('cake_console', 'Bake a controller for a model. Using options you can bake public, admin or both.'))->addArgument('name', array('help' => __d('cake_console', 'Name of the controller to bake. Can use Plugin.name to bake controllers into plugins.')))->addOption('public', array('help' => __d('cake_console', 'Bake a controller with basic crud actions (index, view, add, edit, delete).'), 'boolean' => true))->addOption('admin', array('help' => __d('cake_console', 'Bake a controller with crud actions for one of the Routing.prefixes.'), 'boolean' => true))->addOption('plugin', array('short' => 'p', 'help' => __d('cake_console', 'Plugin to bake the controller into.')))->addOption('connection', array('short' => 'c', 'help' => __d('cake_console', 'The connection the controller\'s model is on.')))->addOption('theme', array('short' => 't', 'help' => __d('cake_console', 'Theme to use when baking code.')))->addOption('force', array('short' => 'f', 'help' => __d('cake_console', 'Force overwriting existing files without prompting.')))->addSubcommand('all', array('help' => __d('cake_console', 'Bake all controllers with CRUD methods.')))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.')); return $parser; }
/** * Gets the option parser instance and configures it. * * @return ConsoleOptionParser */ public function getOptionParser() { $parser = parent::getOptionParser(); $parser->description(__d('cake_console', 'Bake test case skeletons for classes.'))->addArgument('type', array('help' => __d('cake_console', 'Type of class to bake, can be any of the following: controller, model, helper, component or behavior.'), 'choices' => array('Controller', 'controller', 'Model', 'model', 'Helper', 'helper', 'Component', 'component', 'Behavior', 'behavior')))->addArgument('name', array('help' => __d('cake_console', 'An existing class to bake tests for.')))->addOption('theme', array('short' => 't', 'help' => __d('cake_console', 'Theme to use when baking code.')))->addOption('plugin', array('short' => 'p', 'help' => __d('cake_console', 'CamelCased name of the plugin to bake tests for.')))->addOption('force', array('short' => 'f', 'help' => __d('cake_console', 'Force overwriting existing files without prompting.')))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.')); return $parser; }
/** * get the option parser. * * @return void */ public function getOptionParser() { $parser = parent::getOptionParser(); return $parser->description(__('Bake test case skeletons for classes.'))->addArgument('type', array('help' => __('Type of class to bake, can be any of the following: controller, model, helper, component or behavior.'), 'choices' => array('controller', 'model', 'helper', 'component', 'behavior')))->addArgument('name', array('help' => __('An existing class to bake tests for.')))->addOption('plugin', array('short' => 'p', 'help' => __('CamelCased name of the plugin to bake tests for.')))->epilog(__('Omitting all arguments and options will enter into an interactive mode.')); }
/** * get the option parser. * * @return void */ public function getOptionParser() { $parser = parent::getOptionParser(); return $parser->addOption('plugin', array('short' => 'l', 'help' => __d('cake_console', 'Plugin.')))->addOption('appTestCase', array('short' => 'z', 'help' => __d('cake_console', 'App test case.')))->addOption('noAppTestCase', array('short' => 'n', 'help' => __d('cake_console', 'App test case.')))->addOption('slug', array('short' => 's', 'boolean' => true, 'help' => __d('cake_console', 'Use slug.')))->addOption('parentSlug', array('short' => 'f', 'boolean' => true, 'help' => __d('cake_console', 'Use slug.')))->addOption('user', array('short' => 'u', 'help' => __d('cake_console', 'Use user model.')))->addOption('parent', array('short' => 'r', 'help' => __d('cake_console', 'Use parent model.')))->addOption('theme', array('short' => 't', 'help' => __d('cake_console', 'theme.')))->addOption('subthemes', array('short' => 'b', 'help' => __d('cake_console', 'subthemes.')))->addOption('property', array('short' => 'y', 'boolean' => true, 'help' => __d('cake_console', 'generate IDE properties hints for model relations'))); }