Example #1
0
 /**
  * Execution method always used for tasks
  * Handles dispatching to interactive, named, or all processes.
  *
  * @param string|null $name The name of the fixture to bake.
  * @return null|bool
  */
 public function main($name = null)
 {
     parent::main();
     $name = $this->_getName($name);
     if (empty($name)) {
         $this->out('Choose a fixture to bake from the following:');
         foreach ($this->Model->listUnskipped() as $table) {
             $this->out('- ' . $this->_camelize($table));
         }
         return true;
     }
     $table = null;
     if (isset($this->params['table'])) {
         $table = $this->params['table'];
     }
     $model = $this->_camelize($name);
     $this->bake($model, $table);
 }
Example #2
0
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description('Bake table and entity classes.')->addArgument('name', ['help' => 'Name of the model to bake. Can use Plugin.name to bake plugin models.'])->addSubcommand('all', ['help' => 'Bake all model files with associations and validation.'])->addOption('table', ['help' => 'The table name to use if you have non-conventional table names.'])->addOption('no-entity', ['boolean' => true, 'help' => 'Disable generating an entity class.'])->addOption('no-table', ['boolean' => true, 'help' => 'Disable generating a table class.'])->addOption('no-validation', ['boolean' => true, 'help' => 'Disable generating validation rules.'])->addOption('no-rules', ['boolean' => true, 'help' => 'Disable generating a rules checker.'])->addOption('no-associations', ['boolean' => true, 'help' => 'Disable generating associations.'])->addOption('no-fields', ['boolean' => true, 'help' => 'Disable generating accessible fields in the entity.'])->addOption('fields', ['help' => 'A comma separated list of fields to make accessible.'])->addOption('no-hidden', ['boolean' => true, 'help' => 'Disable generating hidden fields in the entity.'])->addOption('hidden', ['help' => 'A comma separated list of fields to hide.'])->addOption('primary-key', ['help' => 'The primary key if you would like to manually set one.' . ' Can be a comma separated list if you are using a composite primary key.'])->addOption('display-field', ['help' => 'The displayField if you would like to choose one.'])->addOption('no-test', ['boolean' => true, 'help' => 'Do not generate a test case skeleton.'])->addOption('no-fixture', ['boolean' => true, 'help' => 'Do not generate a test fixture skeleton.'])->epilog('Omitting all arguments and options will list the table names you can generate models for');
     return $parser;
 }
Example #3
0
 /**
  * get the option parser.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     return $parser->description('Generate a new CakePHP project skeleton.')->addArgument('name', ['help' => 'Application directory to make, if it starts with "/" the path is absolute.'])->addOption('empty', ['boolean' => true, 'help' => 'Create empty files in each of the directories. Good if you are using git'])->addOption('template', ['short' => 't', 'help' => 'Template to use when baking code.'])->addOption('composer', ['default' => ROOT . DS . 'composer.phar', 'help' => 'The path to the composer executable.'])->removeOption('plugin');
 }
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description('Create the directory structure, AppController class and testing setup for a new plugin. ' . 'Can create plugins in any of your bootstrapped plugin paths.')->addArgument('name', ['help' => 'CamelCased name of the plugin to create.'])->addOption('composer', ['default' => ROOT . DS . 'composer.phar', 'help' => 'The path to the composer executable.'])->removeOption('plugin');
     return $parser;
 }
Example #5
0
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description('Bake test case skeletons for classes.')->addArgument('type', ['help' => 'Type of class to bake, can be any of the following:' . ' controller, model, helper, component or behavior.', 'choices' => ['Controller', 'controller', 'Table', 'table', 'Entity', 'entity', 'Helper', 'helper', 'Component', 'component', 'Behavior', 'behavior', 'Shell', 'shell', 'Cell', 'cell', 'Form', 'form']])->addArgument('name', ['help' => 'An existing class to bake tests for.'])->addOption('fixtures', ['help' => 'A comma separated list of fixture names you want to include.'])->addOption('all', ['boolean' => true, 'help' => 'Bake all classes of the given type']);
     return $parser;
 }
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description('Bake views for a controller, using built-in or custom templates. ')->addArgument('controller', ['help' => 'Name of the controller views to bake. Can be Plugin.name as a shortcut for plugin baking.'])->addArgument('action', ['help' => "Will bake a single action's file. core templates are (index, add, edit, view)"])->addArgument('alias', ['help' => 'Will bake the template in <action> but create the filename after <alias>.'])->addOption('controller', ['help' => 'The controller name if you have a controller that does not follow conventions.'])->addOption('prefix', ['help' => 'The routing prefix to generate views for.'])->addSubcommand('all', ['help' => '[optional] Bake all CRUD action views for all controllers. Requires models and controllers to exist.']);
     return $parser;
 }
Example #7
0
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description('Bake a controller skeleton.')->addArgument('name', ['help' => 'Name of the controller to bake. Can use Plugin.name to bake controllers into plugins.'])->addOption('components', ['help' => 'The comma separated list of components to use.'])->addOption('helpers', ['help' => 'The comma separated list of helpers to use.'])->addOption('prefix', ['help' => 'The namespace/routing prefix to use.'])->addOption('actions', ['help' => 'The comma separated list of actions to generate. ' . 'You can include custom methods provided by your template set here.'])->addOption('no-test', ['boolean' => true, 'help' => 'Do not generate a test skeleton.'])->addOption('no-actions', ['boolean' => true, 'help' => 'Do not generate basic CRUD action methods.'])->addSubcommand('all', ['help' => 'Bake all controllers with CRUD methods.']);
     return $parser;
 }
Example #8
0
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $name = $this->name();
     $parser->description(sprintf('Bake a %s class file.', $name))->addArgument('name', ['help' => sprintf('Name of the %s to bake. Can use Plugin.name to bake %s files into plugins.', $name, $name)])->addOption('no-test', ['boolean' => true, 'help' => 'Do not generate a test skeleton.']);
     return $parser;
 }
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description('Bake a JS Controller for use in FrontendBridge ')->addArgument('controller', ['help' => 'Controller Name, e.g. Posts', 'required' => true])->addArgument('action', ['help' => 'Action Name, e.g. addPost', 'required' => true]);
     return $parser;
 }
 /**
  * Get the option parser for this task.
  *
  * This base class method sets up some commonly used options.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description(__d('cake_console', 'Task to dump/restore available settings.'))->addSubcommand('import', ['help' => __d('cake_console', 'Import settings from previously dumped files.')]);
     //->addSubcommand('export', [
     //    'help' => __d('cake_console', 'Exporting available settings to dumps.')
     //]);
     return $parser;
 }
Example #11
0
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description('Bake migration class.')->addArgument('name', ['help' => 'Name of the migration to bake. Can use Plugin.name to bake plugin migrations.', 'required' => true])->addOption('connection', ['short' => 'c', 'default' => 'default', 'help' => 'The datasource connection to get data from.'])->addOption('checkModel', ['default' => true, 'help' => 'If model is set to true, check also that the model exists.'])->addOption('theme', ['short' => 't', 'default' => 'Migrations', 'help' => 'The theme to use when baking code.'])->addOption('plugin', ['short' => 'p', 'help' => 'Plugin to bake into.'])->epilog('Omitting all arguments and options will list the options for and arguments for the plugin');
     return $parser;
 }