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

 __construct (&$dispatch)
 _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

 $alias = null
 $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 33 of file shell.php.


Constructor & Destructor Documentation

Shell::__construct ( &$  dispatch  ) 

Constructs this Shell instance.

Definition at line 130 of file shell.php.

References params().


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 409 of file shell.php.

References error().

Referenced by AclShell::create(), and AclShell::delete().

Shell::_checkUnitTest (  ) 

Action to create a Unit Test

Returns:
boolean Success protected

Definition at line 470 of file shell.php.

References App::import().

Referenced by ModelTask::__interactive(), ControllerTask::__interactive(), 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 540 of file shell.php.

References camelize(), and 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 530 of file shell.php.

References 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 201 of file shell.php.

References config(), and create().

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 219 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 560 of file shell.php.

References singularize(), and 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 550 of file shell.php.

References camelize(), and 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 570 of file shell.php.

References 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 611 of file shell.php.

References humanize(), pluralize(), and 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 591 of file shell.php.

References pluralize(), and 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 601 of file shell.php.

References humanize(), singularize(), and underscore().

Shell::_singularName ( name  ) 

creates the singular name for use in views.

Parameters:
string $name
Returns:
string $name protected

Definition at line 581 of file shell.php.

References singularize(), and variable().

Referenced by ControllerTask::bakeActions().

Shell::_welcome (  ) 

Displays a header for the shell

protected

Definition at line 187 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 425 of file shell.php.

References $path, __(), and uses().

Referenced by ViewTask::bake(), TestTask::bake(), PluginTask::bake(), ModelTask::bake(), DbConfigTask::bake(), ControllerTask::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 363 of file shell.php.

Referenced by TestSuiteShell::__canRun(), TestSuiteShell::__installSimpleTest(), PluginTask::__interactive(), ViewTask::__loadController(), ApiShell::__parseClass(), SchemaShell::__run(), 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 395 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 500 of file shell.php.

References config(), Configure::read(), write(), and Configure::write().

Referenced by ViewTask::__interactive(), ControllerTask::__interactive(), and 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 457 of file shell.php.

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 379 of file shell.php.

Referenced by ExtractTask::__extract(), ViewTask::__interactive(), TestTask::__interactive(), ModelTask::__interactive(), DbConfigTask::__interactive(), ControllerTask::__interactive(), DbConfigTask::__verify(), BakeShell::all(), ProjectTask::bake(), PluginTask::bake(), ModelTask::doAssociations(), PluginTask::execute(), ViewTask::getContent(), ViewTask::help(), ProjectTask::help(), PluginTask::help(), ExtractTask::help(), ControllerTask::help(), SchemaShell::help(), I18nShell::help(), BakeShell::help(), SchemaShell::initialize(), TestSuiteShell::main(), I18nShell::main(), ConsoleShell::main(), BakeShell::main(), and ApiShell::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 316 of file shell.php.

Referenced by SchemaShell::__create(), ExtractTask::__extract(), ViewTask::__interactive(), TestTask::__interactive(), PluginTask::__interactive(), ModelTask::__interactive(), DbConfigTask::__interactive(), ControllerTask::__interactive(), SchemaShell::__update(), DbConfigTask::__verify(), ExtractTask::__writeFiles(), TestTask::bake(), ProjectTask::bake(), PluginTask::bake(), ModelTask::doAssociations(), ModelTask::doValidation(), SchemaShell::dump(), ProjectTask::execute(), PluginTask::execute(), ExtractTask::execute(), SchemaShell::generate(), ControllerTask::getName(), ExtractTask::help(), I18nShell::main(), ConsoleShell::main(), BakeShell::main(), and ApiShell::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 169 of file shell.php.

Shell::loadTasks (  ) 

Loads tasks defined in var $tasks

Returns:
bool public

Reimplemented in BakeShell.

Definition at line 260 of file shell.php.

References $path, camelize(), ClassRegistry::getObject(), ClassRegistry::isKeySet(), and 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 347 of file shell.php.

Referenced by SchemaShell::__create(), ExtractTask::__extract(), ExtractTask::__extractTokens(), ViewTask::__interactive(), TestTask::__interactive(), ModelTask::__interactive(), DbConfigTask::__interactive(), ControllerTask::__interactive(), ExtractTask::__markerError(), TestSuiteShell::__run(), SchemaShell::__run(), SchemaShell::__update(), DbConfigTask::__verify(), ExtractTask::__writeFiles(), BakeShell::all(), TestTask::bake(), ProjectTask::bake(), PluginTask::bake(), ModelTask::bake(), ControllerTask::bakeTest(), AclShell::create(), ModelTask::doAssociations(), ModelTask::doValidation(), SchemaShell::dump(), TestTask::execute(), ProjectTask::execute(), PluginTask::execute(), ExtractTask::execute(), ControllerTask::execute(), SchemaShell::generate(), ControllerTask::getName(), TestSuiteShell::help(), ViewTask::help(), ProjectTask::help(), PluginTask::help(), ExtractTask::help(), ControllerTask::help(), SchemaShell::help(), I18nShell::help(), BakeShell::help(), ApiShell::help(), SchemaShell::initialize(), ConsoleShell::initialize(), ControllerTask::listAll(), TestSuiteShell::main(), I18nShell::main(), ConsoleShell::main(), BakeShell::main(), ApiShell::main(), AclShell::main(), SchemaShell::run(), I18nShell::startup(), AclShell::startup(), and SchemaShell::view().

Shell::shortPath ( file  ) 

Makes absolute file path easier to read

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

Definition at line 489 of file shell.php.

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 179 of file shell.php.


Member Data Documentation

Shell::$alias = null

Definition at line 104 of file shell.php.

Referenced by ModelTask::doAssociations(), and ViewTask::execute().

Shell::$args = array()

Reimplemented in AclShell.

Definition at line 69 of file shell.php.

Shell::$className = null

Definition at line 83 of file shell.php.

Referenced by ModelTask::bakeTest(), ControllerTask::bakeTest(), and ModelTask::doAssociations().

Shell::$command = null

Definition at line 90 of file shell.php.

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

Shell::$DbConfig = null

Definition at line 55 of file shell.php.

Shell::$Dispatch = null

Definition at line 40 of file shell.php.

Shell::$interactive = true

Definition at line 47 of file shell.php.

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

Shell::$name = null

Definition at line 97 of file shell.php.

Referenced by TestTask::__interactive(), ModelTask::__interactive(), DbConfigTask::__interactive(), BakeShell::all(), TestTask::bake(), ModelTask::bake(), ProjectTask::cakeAdmin(), SchemaShell::run(), and SchemaShell::startup().

Shell::$params = array()

Definition at line 62 of file shell.php.

Shell::$shell = null

Definition at line 76 of file shell.php.

Shell::$taskNames = array()

Definition at line 118 of file shell.php.

Shell::$tasks = array()

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

Definition at line 111 of file shell.php.

Shell::$uses = array()

Definition at line 125 of file shell.php.

Referenced by ControllerTask::__interactive(), and ControllerTask::bake().


The documentation for this class was generated from the following file:
Generated on Sun Nov 22 00:30:57 2009 for CakePHP 1.2.x.x (v1.2.4.8284) by doxygen 1.4.7