Example #1
0
 /**
  * Execution method always used for tasks
  * Handles dispatching to interactive, named, or all processes.
  *
  * @param string $name The name of the fixture to bake.
  * @return void
  */
 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->listAll() 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 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('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 #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 . '/composer.phar', 'help' => 'The path to the composer executable.'])->removeOption('plugin');
 }
Example #4
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;
 }
Example #5
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-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 #6
0
 /**
  * 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' => '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('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 . '/composer.phar', 'help' => 'The path to the composer executable.'])->removeOption('plugin');
     return $parser;
 }
Example #8
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']])->addArgument('name', ['help' => 'An existing class to bake tests for.'])->addOption('fixtures', ['help' => 'A comma separated list of fixture names you want to include.']);
     return $parser;
 }