Shell Class Reference

Public Member Functions | |
| _checkArgs ($expectedNum, $command=null) | |
| _checkUnitTest () | |
| _controllerName ($name) | |
| _controllerPath ($name) | |
| _loadDbConfig () | |
| _loadModels () | |
| _modelKey ($name) | |
| _modelName ($name) | |
| _modelNameFromKey ($key) | |
| _pluralHumanName ($name) | |
| _pluralName ($name) | |
| _singularHumanName ($name) | |
| _singularName ($name) | |
| _welcome () | |
| createFile ($path, $contents) | |
| err ($string) | |
| error ($title, $msg) | |
| getAdmin () | |
| help () | |
| hr ($newline=false) | |
| in ($prompt, $options=null, $default=null) | |
| initialize () | |
| loadTasks () | |
| out ($string, $newline=true) | |
| shortPath ($file) | |
| startup () | |
Public Attributes | |
| $args = array() | |
| $className = null | |
| $command = null | |
| $DbConfig = null | |
| $Dispatch = null | |
| $interactive = true | |
| $name = null | |
| $params = array() | |
| $shell = null | |
| $taskNames = array() | |
| $tasks = array() | |
| $uses = array() | |
Detailed Description
Definition at line 35 of file shell.php.
Member Function Documentation
| Shell::_checkArgs | ( | $ | expectedNum, | |
| $ | command = null | |||
| ) |
Will check the number args matches otherwise throw an error
- Parameters:
-
integer $expectedNum Expected number of paramters string $command Command protected
Definition at line 400 of file shell.php.
Referenced by AclShell::create(), and AclShell::delete().
| Shell::_checkUnitTest | ( | ) |
Action to create a Unit Test
- Returns:
- boolean Success protected
Definition at line 461 of file shell.php.
References low().
Referenced by BakeShell::all(), ModelTask::execute(), and ControllerTask::execute().
| Shell::_controllerName | ( | $ | name | ) |
Creates the proper controller plural name for the specified controller class name
- Parameters:
-
string $name Controller class name
- Returns:
- string Controller plural name protected
Definition at line 531 of file shell.php.
References Inflector::camelize(), and Inflector::pluralize().
Referenced by BakeShell::all(), and ControllerTask::listAll().
| Shell::_controllerPath | ( | $ | name | ) |
Creates the proper controller path for the specified controller class name
- Parameters:
-
string $name Controller class name
- Returns:
- string Path to controller protected
Definition at line 521 of file shell.php.
References low(), and Inflector::underscore().
Referenced by ControllerTask::bake(), and ControllerTask::bakeActions().
| Shell::_loadDbConfig | ( | ) |
| Shell::_loadModels | ( | ) |
if var $uses = true Loads AppModel file and constructs AppModel class makes $this->AppModel available to subclasses if var $uses is an array of models will load those models
- Returns:
- bool protected
Definition at line 213 of file shell.php.
References App::import(), ClassRegistry::init(), and uses().
| Shell::_modelKey | ( | $ | name | ) |
Creates the proper singular model key for associations
- Parameters:
-
string $name Controller class name
- Returns:
- string Singular model key protected
Definition at line 551 of file shell.php.
References Inflector::singularize(), and Inflector::underscore().
Referenced by ModelTask::doAssociations().
| Shell::_modelName | ( | $ | name | ) |
Creates the proper controller camelized name (singularized) for the specified name
- Parameters:
-
string $name Name
- Returns:
- string Camelized and singularized controller name protected
Definition at line 541 of file shell.php.
References Inflector::camelize(), and Inflector::singularize().
Referenced by BakeShell::all(), ControllerTask::bake(), ControllerTask::bakeActions(), ModelTask::doAssociations(), and ControllerTask::listAll().
| Shell::_modelNameFromKey | ( | $ | key | ) |
Creates the proper model name from a foreign key
- Parameters:
-
string $key Foreign key
- Returns:
- string Model name protected
Definition at line 561 of file shell.php.
References Inflector::camelize().
Referenced by ModelTask::doAssociations().
| Shell::_pluralHumanName | ( | $ | name | ) |
Creates the plural human name used in views
- Parameters:
-
string $name Controller name
- Returns:
- string Plural human name protected
Definition at line 602 of file shell.php.
References Inflector::humanize(), Inflector::pluralize(), and Inflector::underscore().
| Shell::_pluralName | ( | $ | name | ) |
Creates the plural name for views
- Parameters:
-
string $name Name to use
- Returns:
- string Plural name for views protected
Definition at line 582 of file shell.php.
References Inflector::pluralize(), and Inflector::variable().
Referenced by ControllerTask::bakeActions().
| Shell::_singularHumanName | ( | $ | name | ) |
Creates the singular human name used in views
- Parameters:
-
string $name Controller name
- Returns:
- string Singular human name protected
Definition at line 592 of file shell.php.
References Inflector::humanize(), Inflector::singularize(), and Inflector::underscore().
| Shell::_singularName | ( | $ | name | ) |
creates the singular name for use in views.
- Parameters:
-
string $name
- Returns:
- string $name protected
Definition at line 572 of file shell.php.
References Inflector::singularize(), and Inflector::variable().
Referenced by ControllerTask::bakeActions().
| Shell::_welcome | ( | ) |
Displays a header for the shell
protected
Definition at line 181 of file shell.php.
References params(), and Configure::version().
Referenced by SchemaShell::initialize(), and I18nShell::startup().
| Shell::createFile | ( | $ | path, | |
| $ | contents | |||
| ) |
Creates a file at given path
- Parameters:
-
string $path Where to put the file. string $contents Content to put in the file.
- Returns:
- boolean Success public
Definition at line 416 of file shell.php.
Referenced by ViewTask::bake(), PluginTask::bake(), ModelTask::bake(), DbConfigTask::bake(), ControllerTask::bake(), TestTask::bake(), ControllerTask::bakeTest(), and ProjectTask::createHome().
| Shell::err | ( | $ | string | ) |
Outputs to the stderr filehandle.
- Parameters:
-
string $string Error text to output. public
Definition at line 354 of file shell.php.
Referenced by BakeShell::all(), ViewTask::bake(), ProjectTask::bake(), DbConfigTask::bake(), ControllerTask::bakeActions(), AclShell::create(), SchemaShell::dump(), ProjectTask::execute(), PluginTask::execute(), ExtractTask::execute(), SchemaShell::generate(), ViewTask::getContent(), ControllerTask::listAll(), BakeShell::loadTasks(), TestSuiteShell::main(), ApiShell::main(), SchemaShell::run(), AclShell::startup(), and SchemaShell::view().
| Shell::error | ( | $ | title, | |
| $ | msg | |||
| ) |
Displays a formatted error message and exits the application
- Parameters:
-
string $title Title of the error message string $msg Error message public
Definition at line 386 of file shell.php.
References $out.
Referenced by AclShell::create().
| Shell::getAdmin | ( | ) |
Checks for Configure::read('Routing.admin') and forces user to input it if not enabled
- Returns:
- string Admin route to use public
Definition at line 491 of file shell.php.
References config(), Configure::read(), and Configure::write().
Referenced by ControllerTask::execute().
| Shell::help | ( | ) |
Outputs usage text on the standard output. Implement it in subclasses.
public
Reimplemented in AclShell, ApiShell, BakeShell, ConsoleShell, I18nShell, SchemaShell, ControllerTask, ExtractTask, ModelTask, PluginTask, ProjectTask, ViewTask, and TestSuiteShell.
| Shell::hr | ( | $ | newline = false |
) |
Outputs a series of minus characters to the standard output, acts as a visual separator.
- Parameters:
-
boolean $newline If true, the outputs gets an added newline. public
Definition at line 370 of file shell.php.
Referenced by BakeShell::all(), ProjectTask::bake(), PluginTask::bake(), ModelTask::doAssociations(), PluginTask::execute(), ViewTask::getContent(), ViewTask::help(), ProjectTask::help(), PluginTask::help(), ExtractTask::help(), ControllerTask::help(), SchemaShell::help(), BakeShell::help(), I18nShell::help(), SchemaShell::initialize(), TestSuiteShell::main(), ConsoleShell::main(), BakeShell::main(), ApiShell::main(), and I18nShell::main().
| Shell::in | ( | $ | prompt, | |
| $ | options = null, |
|||
| $ | default = null | |||
| ) |
Prompts the user for input, and returns it.
- Parameters:
-
string $prompt Prompt text. mixed $options Array or string of options. string $default Default input value.
- Returns:
- Either the default value, or the user-provided input. public
Definition at line 307 of file shell.php.
Referenced by ProjectTask::bake(), PluginTask::bake(), TestTask::bake(), ModelTask::doAssociations(), ModelTask::doValidation(), SchemaShell::dump(), ProjectTask::execute(), PluginTask::execute(), ExtractTask::execute(), SchemaShell::generate(), ControllerTask::getName(), ExtractTask::help(), ConsoleShell::main(), BakeShell::main(), ApiShell::main(), and I18nShell::main().
| Shell::initialize | ( | ) |
Initializes the Shell acts as constructor for subclasses allows configuration of tasks prior to shell execution
public
Reimplemented in ApiShell, ConsoleShell, SchemaShell, ControllerTask, DbConfigTask, PluginTask, ViewTask, and TestSuiteShell.
| Shell::loadTasks | ( | ) |
Loads tasks defined in var $tasks
- Returns:
- bool public
Reimplemented in BakeShell.
Definition at line 244 of file shell.php.
References Inflector::camelize(), ClassRegistry::getObject(), ClassRegistry::isKeySet(), ClassRegistry::map(), and Inflector::underscore().
| Shell::out | ( | $ | string, | |
| $ | newline = true | |||
| ) |
Outputs to the stdout filehandle.
- Parameters:
-
string $string String to output. boolean $newline If true, the outputs gets an added newline. public
Definition at line 338 of file shell.php.
Referenced by BakeShell::all(), ProjectTask::bake(), PluginTask::bake(), ModelTask::bake(), TestTask::bake(), ControllerTask::bakeTest(), AclShell::create(), ModelTask::doAssociations(), ModelTask::doValidation(), SchemaShell::dump(), ProjectTask::execute(), PluginTask::execute(), ExtractTask::execute(), ControllerTask::execute(), TestTask::execute(), SchemaShell::generate(), ControllerTask::getName(), TestSuiteShell::help(), ViewTask::help(), ProjectTask::help(), PluginTask::help(), ExtractTask::help(), ControllerTask::help(), SchemaShell::help(), BakeShell::help(), ApiShell::help(), I18nShell::help(), SchemaShell::initialize(), ConsoleShell::initialize(), ControllerTask::listAll(), TestSuiteShell::main(), ConsoleShell::main(), BakeShell::main(), ApiShell::main(), AclShell::main(), I18nShell::main(), SchemaShell::run(), AclShell::startup(), I18nShell::startup(), and SchemaShell::view().
| Shell::shortPath | ( | $ | file | ) |
| Shell::startup | ( | ) |
Member Data Documentation
| Shell::$className = null |
Definition at line 85 of file shell.php.
Referenced by ModelTask::bakeTest(), ControllerTask::bakeTest(), and ModelTask::doAssociations().
| Shell::$command = null |
Definition at line 92 of file shell.php.
Referenced by ConsoleShell::main(), and SchemaShell::run().
| Shell::$interactive = true |
Definition at line 49 of file shell.php.
Referenced by ModelTask::doAssociations(), and ModelTask::doValidation().
| Shell::$name = null |
Definition at line 99 of file shell.php.
Referenced by BakeShell::all(), ModelTask::bake(), TestTask::bake(), ProjectTask::cakeAdmin(), SchemaShell::run(), and SchemaShell::startup().
| Shell::$tasks = array() |
Reimplemented in AclShell, BakeShell, I18nShell, ControllerTask, ModelTask, PluginTask, and ViewTask.
| Shell::$uses = array() |
The documentation for this class was generated from the following file:
- 1.2.x.x/cake/console/libs/shell.php