コード例 #1
0
 /**
  * Execution method always used for tasks
  * Handles dispatching to interactive, named, or all processes.
  *
  * @return void
  */
 public function main($name = null)
 {
     parent::main();
     if (empty($name)) {
         $this->out(__d('cake_console', 'Choose a fixture to bake from the following:'));
         foreach ($this->Model->listAll() as $table) {
             $this->out('- ' . $this->_modelName($table));
         }
         return true;
     }
     $table = null;
     if (isset($this->params['table'])) {
         $table = $this->params['table'];
     }
     $model = $this->_modelName($name);
     $this->bake($model, $table);
 }
コード例 #2
0
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $name = $this->name();
     $parser->description(__d('cake_console', 'Bake a %s class file.', $name))->addArgument('name', ['help' => __d('cake_console', 'Name of the %s to bake. Can use Plugin.name to bake %s files into plugins.', $name, $name)])->addOption('no-test', ['boolean' => true, 'help' => __d('cake_console', 'Do not generate a test skeleton.')]);
     return $parser;
 }
コード例 #3
0
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description(__d('cake_console', 'Bake a controller skeleton.'))->addArgument('name', ['help' => __d('cake_console', 'Name of the controller to bake. Can use Plugin.name to bake controllers into plugins.')])->addOption('components', ['help' => __d('cake_console', 'The comma separated list of components to use.')])->addOption('helpers', ['help' => __d('cake_console', 'The comma separated list of helpers to use.')])->addOption('prefix', ['help' => __d('cake_console', 'The namespace/routing prefix to use.')])->addOption('no-test', ['boolean' => true, 'help' => __d('cake_console', 'Do not generate a test skeleton.')])->addOption('no-actions', ['boolean' => true, 'help' => __d('cake_console', 'Do not generate basic CRUD action methods.')])->addSubcommand('all', ['help' => __d('cake_console', 'Bake all controllers with CRUD methods.')]);
     return $parser;
 }
コード例 #4
0
 /**
  * get the option parser.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     return $parser->description(__d('cake_console', 'Generate a new CakePHP project skeleton.'))->addArgument('name', ['help' => __d('cake_console', 'Application directory to make, if it starts with "/" the path is absolute.')])->addOption('empty', ['boolean' => true, 'help' => __d('cake_console', 'Create empty files in each of the directories. Good if you are using git')])->addOption('theme', ['short' => 't', 'help' => __d('cake_console', 'Theme to use when baking code.')])->addOption('composer', ['default' => ROOT . '/composer.phar', 'help' => __d('cake_console', 'The path to the composer executable.')])->removeOption('plugin');
 }
コード例 #5
0
ファイル: ViewTask.php プロジェクト: ripzappa0924/carte0.0.1
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description(__d('cake_console', 'Bake views for a controller, using built-in or custom templates. '))->addArgument('controller', ['help' => __d('cake_console', 'Name of the controller views to bake. Can be Plugin.name as a shortcut for plugin baking.')])->addArgument('action', ['help' => __d('cake_console', "Will bake a single action's file. core templates are (index, add, edit, view)")])->addArgument('alias', ['help' => __d('cake_console', 'Will bake the template in <action> but create the filename after <alias>.')])->addOption('controller', ['help' => __d('cake_console', 'The controller name if you have a controller that does not follow conventions.')])->addOption('prefix', ['help' => __d('cake_console', 'The routing prefix to generate views for.')])->addSubcommand('all', ['help' => __d('cake_console', 'Bake all CRUD action views for all controllers. Requires models and controllers to exist.')]);
     return $parser;
 }
コード例 #6
0
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description(__d('cake_console', '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' => __d('cake_console', 'CamelCased name of the plugin to create.')])->removeOption('plugin');
     return $parser;
 }
コード例 #7
0
ファイル: TestTask.php プロジェクト: ripzappa0924/carte0.0.1
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description(__d('cake_console', 'Bake test case skeletons for classes.'))->addArgument('type', ['help' => __d('cake_console', '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']])->addArgument('name', ['help' => __d('cake_console', 'An existing class to bake tests for.')])->addOption('fixtures', ['help' => __d('cake_console', 'A comma separated list of fixture names you want to include.')]);
     return $parser;
 }
コード例 #8
0
ファイル: ModelTask.php プロジェクト: ripzappa0924/carte0.0.1
 /**
  * Gets the option parser instance and configures it.
  *
  * @return \Cake\Console\ConsoleOptionParser
  */
 public function getOptionParser()
 {
     $parser = parent::getOptionParser();
     $parser->description(__d('cake_console', 'Bake table and entity classes.'))->addArgument('name', ['help' => __d('cake_console', 'Name of the model to bake. Can use Plugin.name to bake plugin models.')])->addSubcommand('all', ['help' => __d('cake_console', 'Bake all model files with associations and validation.')])->addOption('table', ['help' => __d('cake_console', 'The table name to use if you have non-conventional table names.')])->addOption('no-entity', ['boolean' => true, 'help' => __d('cake_console', 'Disable generating an entity class.')])->addOption('no-table', ['boolean' => true, 'help' => __d('cake_console', 'Disable generating a table class.')])->addOption('no-validation', ['boolean' => true, 'help' => __d('cake_console', 'Disable generating validation rules.')])->addOption('no-associations', ['boolean' => true, 'help' => __d('cake_console', 'Disable generating associations.')])->addOption('no-fields', ['boolean' => true, 'help' => __d('cake_console', 'Disable generating accessible fields in the entity.')])->addOption('fields', ['help' => __d('cake_console', 'A comma separated list of fields to make accessible.')])->addOption('no-hidden', ['boolean' => true, 'help' => __d('cake_console', 'Disable generating hidden fields in the entity.')])->addOption('hidden', ['help' => __d('cake_console', 'A comma separated list of fields to hide.')])->addOption('primary-key', ['help' => __d('cake_console', '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' => __d('cake_console', 'The displayField if you would like to choose one.')])->addOption('no-test', ['boolean' => true, 'help' => __d('cake_console', 'Do not generate a test case skeleton.')])->addOption('no-fixture', ['boolean' => true, 'help' => __d('cake_console', 'Do not generate a test fixture skeleton.')])->epilog(__d('cake_console', 'Omitting all arguments and options will list ' . 'the table names you can generate models for'));
     return $parser;
 }