Shell Class Reference

Inheritance diagram for Shell:

Object AclShell ApiShell BakeShell ConsoleShell ControllerTask DbConfigTask ExtractTask I18nShell ModelTask PluginTask ProjectTask SchemaShell TestSuiteShell TestTask ViewTask

List of all members.


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 (  ) 

Loads database file and constructs DATABASE_CONFIG class makes $this->DbConfig available to subclasses

Returns:
bool protected

Definition at line 195 of file shell.php.

References config().

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.

References low(), and uses().

Referenced by ViewTask::bake(), PluginTask::bake(), ModelTask::bake(), DbConfigTask::bake(), ControllerTask::bake(), TestTask::bake(), ControllerTask::bakeTest(), and ProjectTask::createHome().

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.

Definition at line 448 of file shell.php.

Shell::hr ( newline = false  ) 

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.

References low(), and up().

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.

Definition at line 163 of file shell.php.

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::shortPath ( file  ) 

Makes absolute file path easier to read

Parameters:
string $file Absolute file path
Returns:
sting short path public

Definition at line 480 of file shell.php.

References $file, and r().

Shell::startup (  ) 

Starts up the the Shell allows for checking and configuring prior to command or main execution can be overriden in subclasses

public

Reimplemented in AclShell, I18nShell, and SchemaShell.

Definition at line 173 of file shell.php.


Member Data Documentation

Shell::$args = array()

Reimplemented in AclShell.

Definition at line 71 of file shell.php.

Shell::$className = null

Shell::$command = null

Definition at line 92 of file shell.php.

Referenced by ConsoleShell::main(), and SchemaShell::run().

Shell::$DbConfig = null

Definition at line 57 of file shell.php.

Shell::$Dispatch = null

Definition at line 42 of file shell.php.

Shell::$interactive = true

Definition at line 49 of file shell.php.

Referenced by ModelTask::doAssociations(), and ModelTask::doValidation().

Shell::$params = array()

Definition at line 64 of file shell.php.

Shell::$shell = null

Definition at line 78 of file shell.php.

Shell::$taskNames = array()

Definition at line 113 of file shell.php.

Shell::$tasks = array()

Reimplemented in AclShell, BakeShell, I18nShell, ControllerTask, ModelTask, PluginTask, and ViewTask.

Definition at line 106 of file shell.php.

Shell::$uses = array()

Definition at line 120 of file shell.php.

Referenced by ControllerTask::bake().


The documentation for this class was generated from the following file: