mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Updating console to use i18n'ed strings.
This commit is contained in:
parent
3251faf8e9
commit
abbe5aaea2
24 changed files with 153 additions and 166 deletions
|
@ -71,10 +71,8 @@ class AclShell extends Shell {
|
|||
|
||||
if (!in_array(Configure::read('Acl.classname'), array('DbAcl', 'DB_ACL'))) {
|
||||
$out = "--------------------------------------------------\n";
|
||||
$out .= __d('cake_console', 'Error: Your current Cake configuration is set to') . "\n";
|
||||
$out .= __d('cake_console', 'an ACL implementation other than DB. Please change') . "\n";
|
||||
$out .= __d('cake_console', 'your core config to reflect your decision to use') . "\n";
|
||||
$out .= __d('cake_console', 'DbAcl before attempting to use this script') . ".\n";
|
||||
$out .= __d('cake_console', 'Error: Your current Cake configuration is set to an ACL implementation other than DB.') . "\n";
|
||||
$out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n";
|
||||
$out .= "--------------------------------------------------\n";
|
||||
$out .= __d('cake_console', 'Current ACL Classname: %s', Configure::read('Acl.classname')) . "\n";
|
||||
$out .= "--------------------------------------------------\n";
|
||||
|
@ -150,7 +148,7 @@ class AclShell extends Shell {
|
|||
$nodeId = $this->_getNodeId($class, $identifier);
|
||||
|
||||
if (!$this->Acl->{$class}->delete($nodeId)) {
|
||||
$this->error(__d('cake_console', 'Node Not Deleted') . __d('cake_console', 'There was an error deleting the %s. Check that the node exists', $class) . ".\n");
|
||||
$this->error(__d('cake_console', 'Node Not Deleted') . __d('cake_console', 'There was an error deleting the %s. Check that the node exists.', $class) . "\n");
|
||||
}
|
||||
$this->out(__d('cake_console', '<success>%s deleted.</success>', $class), 2);
|
||||
}
|
||||
|
@ -263,7 +261,7 @@ class AclShell extends Shell {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set an ARO to inhermit permission to an ACO.
|
||||
* Set an ARO to inherit permission to an ACO.
|
||||
*
|
||||
*/
|
||||
public function inherit() {
|
||||
|
@ -308,7 +306,7 @@ class AclShell extends Shell {
|
|||
$this->error(__d('cake_console', '%s not found', $this->args[0]), __d('cake_console', 'No tree returned.'));
|
||||
}
|
||||
}
|
||||
$this->out($class . " tree:");
|
||||
$this->out($class . ' tree:');
|
||||
$this->hr();
|
||||
|
||||
$stack = array();
|
||||
|
@ -357,7 +355,7 @@ class AclShell extends Shell {
|
|||
'help' => __d('cake_console', 'Type of node to create.')
|
||||
);
|
||||
|
||||
$parser->description('A console tool for managing the DbAcl')
|
||||
$parser->description(__d('cake_console', 'A console tool for managing the DbAcl'))
|
||||
->addSubcommand('create', array(
|
||||
'help' => __d('cake_console', 'Create a new ACL node'),
|
||||
'parser' => array(
|
||||
|
@ -407,8 +405,7 @@ class AclShell extends Shell {
|
|||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', "Returns the path to the ACL object specified by <node>."),
|
||||
__d('cake_console', "This command is useful in determining the inhertiance of permissions"),
|
||||
__d('cake_console', "for a certain object in the tree.")
|
||||
__d('cake_console', "This command is useful in determining the inheritance of permissions for a certain object in the tree.")
|
||||
),
|
||||
'arguments' => array(
|
||||
'type' => $type,
|
||||
|
@ -422,9 +419,7 @@ class AclShell extends Shell {
|
|||
'help' => __d('cake_console', 'Check the permissions between an ACO and ARO.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', "Use this command to grant ACL permissions. Once executed, the ARO "),
|
||||
__d('cake_console', "specified (and its children, if any) will have ALLOW access to the"),
|
||||
__d('cake_console', "specified ACO action (and the ACO's children, if any).")
|
||||
__d('cake_console', 'Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).')
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to check.'), 'required' => true),
|
||||
|
@ -436,9 +431,7 @@ class AclShell extends Shell {
|
|||
'help' => __d('cake_console', 'Grant an ARO permissions to an ACO.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', "Use this command to grant ACL permissions. Once executed, the ARO"),
|
||||
__d('cake_console', "specified (and its children, if any) will have ALLOW access to the"),
|
||||
__d('cake_console', "specified ACO action (and the ACO's children, if any).")
|
||||
__d('cake_console', 'Use this command to grant ACL permissions. Once executed, the ARO specified (and its children, if any) will have ALLOW access to the specified ACO action (and the ACO\'s children, if any).')
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to grant permission to.'), 'required' => true),
|
||||
|
@ -450,9 +443,7 @@ class AclShell extends Shell {
|
|||
'help' => __d('cake_console', 'Deny an ARO permissions to an ACO.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', "Use this command to deny ACL permissions. Once executed, the ARO"),
|
||||
__d('cake_console', "specified (and its children, if any) will have DENY access to the"),
|
||||
__d('cake_console', "specified ACO action (and the ACO's children, if any).")
|
||||
__d('cake_console', 'Use this command to deny ACL permissions. Once executed, the ARO specified (and its children, if any) will have DENY access to the specified ACO action (and the ACO\'s children, if any).')
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to deny.'), 'required' => true),
|
||||
|
@ -464,11 +455,10 @@ class AclShell extends Shell {
|
|||
'help' => __d('cake_console', 'Inherit an ARO\'s parent permissions.'),
|
||||
'parser' => array(
|
||||
'description' => array(
|
||||
__d('cake_console', "Use this command to force a child ARO object to inherit its"),
|
||||
__d('cake_console', "permissions settings from its parent.")
|
||||
__d('cake_console', "Use this command to force a child ARO object to inherit its permissions settings from its parent.")
|
||||
),
|
||||
'arguments' => array(
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to have permisssions inherit.'), 'required' => true),
|
||||
'aro' => array('help' => __d('cake_console', 'ARO to have permissions inherit.'), 'required' => true),
|
||||
'aco' => array('help' => __d('cake_console', 'ACO to inherit permissions on.'), 'required' => true),
|
||||
'action' => array('help' => __d('cake_console', 'Action to inherit'), 'default' => 'all')
|
||||
)
|
||||
|
@ -526,7 +516,7 @@ class AclShell extends Shell {
|
|||
}
|
||||
|
||||
/**
|
||||
* Parse an identifier into Model.foriegnKey or an alias.
|
||||
* Parse an identifier into Model.foreignKey or an alias.
|
||||
* Takes an identifier determines its type and returns the result as used by other methods.
|
||||
*
|
||||
* @param string $identifier Identifier to parse
|
||||
|
|
|
@ -36,7 +36,7 @@ class ApiShell extends Shell {
|
|||
public $paths = array();
|
||||
|
||||
/**
|
||||
* Override intialize of the Shell
|
||||
* Override initialize of the Shell
|
||||
*
|
||||
*/
|
||||
public function initialize() {
|
||||
|
@ -140,9 +140,9 @@ class ApiShell extends Shell {
|
|||
public function getOptionParser() {
|
||||
$parser = parent::getOptionParser();
|
||||
$parser->addArgument('type', array(
|
||||
'help' => 'Either a full path or type of class (model, behavior, controller, component, view, helper)'
|
||||
'help' => __d('cake_console', 'Either a full path or type of class (model, behavior, controller, component, view, helper)')
|
||||
))->addArgument('className', array(
|
||||
'help' => 'A CakePHP core class name (e.g: Component, HtmlHelper).'
|
||||
'help' => __d('cake_console', 'A CakePHP core class name (e.g: Component, HtmlHelper).')
|
||||
))->addOption('method', array(
|
||||
'short' => 'm',
|
||||
'help' => __d('cake_console', 'The specific method you want help on.')
|
||||
|
@ -181,7 +181,7 @@ class ApiShell extends Shell {
|
|||
} elseif (isset($commands[strtolower($this->args[1])])) {
|
||||
$this->out($commands[strtolower($this->args[1])] . "\n\n");
|
||||
} else {
|
||||
$this->out("Command '" . $this->args[1] . "' not found");
|
||||
$this->out(__d('cake_console', 'Command %s not found', $this->args[1]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,16 +79,16 @@ class BakeShell extends Shell {
|
|||
$this->args = null;
|
||||
return $this->DbConfig->execute();
|
||||
}
|
||||
$this->out('Interactive Bake Shell');
|
||||
$this->out(__d('cake_console', 'Interactive Bake Shell'));
|
||||
$this->hr();
|
||||
$this->out('[D]atabase Configuration');
|
||||
$this->out('[M]odel');
|
||||
$this->out('[V]iew');
|
||||
$this->out('[C]ontroller');
|
||||
$this->out('[P]roject');
|
||||
$this->out('[F]ixture');
|
||||
$this->out('[T]est case');
|
||||
$this->out('[Q]uit');
|
||||
$this->out(__d('cake_console', '[D]atabase Configuration'));
|
||||
$this->out(__d('cake_console', '[M]odel'));
|
||||
$this->out(__d('cake_console', '[V]iew'));
|
||||
$this->out(__d('cake_console', '[C]ontroller'));
|
||||
$this->out(__d('cake_console', '[P]roject'));
|
||||
$this->out(__d('cake_console', '[F]ixture'));
|
||||
$this->out(__d('cake_console', '[T]est case'));
|
||||
$this->out(__d('cake_console', '[Q]uit'));
|
||||
|
||||
$classToBake = strtoupper($this->in(__d('cake_console', 'What would you like to Bake?'), array('D', 'M', 'V', 'C', 'P', 'F', 'T', 'Q')));
|
||||
switch ($classToBake) {
|
||||
|
@ -199,12 +199,11 @@ class BakeShell extends Shell {
|
|||
*/
|
||||
public function getOptionParser() {
|
||||
$parser = parent::getOptionParser();
|
||||
return $parser->description(
|
||||
'The Bake script generates controllers, views and models for your application.' .
|
||||
'If run with no command line arguments, Bake guides the user through the class' .
|
||||
'creation process. You can customize the generation process by telling Bake' .
|
||||
'where different parts of your application are using command line arguments.'
|
||||
)->addSubcommand('all', array(
|
||||
return $parser->description(__d('cake_console',
|
||||
'The Bake script generates controllers, views and models for your application.'
|
||||
. ' If run with no command line arguments, Bake guides the user through the class creation process.' .
|
||||
. ' You can customize the generation process by telling Bake where different parts of your application are using command line arguments.'
|
||||
))->addSubcommand('all', array(
|
||||
'help' => __d('cake_console', 'Bake a complete MVC. optional <name> of a Model'),
|
||||
))->addSubcommand('project', array(
|
||||
'help' => __d('cake_console', 'Bake a new app folder in the path supplied or in current directory if no path is specified'),
|
||||
|
@ -231,7 +230,7 @@ class BakeShell extends Shell {
|
|||
'help' => __d('cake_console', 'Bake a unit test.'),
|
||||
'parser' => $this->Test->getOptionParser()
|
||||
))->addOption('connection', array(
|
||||
'help' => __d('cake_console', 'Database connection to use in conjunction with `bake all`.'),
|
||||
'help' => __d('cake_console', 'Database connection to use in conjunction with `bake all`.'),
|
||||
'short' => 'c',
|
||||
'default' => 'default'
|
||||
));
|
||||
|
|
|
@ -43,18 +43,17 @@ class CommandListShell extends Shell {
|
|||
*/
|
||||
public function main() {
|
||||
if (empty($this->params['xml'])) {
|
||||
$this->out("<info>Current Paths:</info>", 2);
|
||||
$this->out(__d('cake_console', "<info>Current Paths:</info>"), 2);
|
||||
$this->out(" -app: ". APP_DIR);
|
||||
$this->out(" -working: " . rtrim(APP_PATH, DS));
|
||||
$this->out(" -root: " . rtrim(ROOT, DS));
|
||||
$this->out(" -core: " . rtrim(CORE_PATH, DS));
|
||||
$this->out("");
|
||||
$this->out("<info>Changing Paths:</info>", 2);
|
||||
$this->out("Your working path should be the same as your application path");
|
||||
$this->out("to change your path use the '-app' param.");
|
||||
$this->out("Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp", 2);
|
||||
$this->out(__d('cake_console', "<info>Changing Paths:</info>"), 2);
|
||||
$this->out(__d('cake_console', "Your working path should be the same as your application path to change your path use the '-app' param."));
|
||||
$this->out(__d('cake_console', "Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp"), 2);
|
||||
|
||||
$this->out("<info>Available Shells:</info>", 2);
|
||||
$this->out(__d('cake_console', "<info>Available Shells:</info>"), 2);
|
||||
}
|
||||
|
||||
$shellList = $this->_getShellList();
|
||||
|
@ -140,8 +139,8 @@ class CommandListShell extends Shell {
|
|||
$this->out(" " . $row);
|
||||
}
|
||||
$this->out();
|
||||
$this->out("To run a command, type <info>cake shell_name [args]</info>");
|
||||
$this->out("To get help on a specific command, type <info>cake shell_name --help</info>", 2);
|
||||
$this->out(__d('cake_console', "To run a command, type <info>cake shell_name [args]</info>"));
|
||||
$this->out(__d('cake_console', "To get help on a specific command, type <info>cake shell_name --help</info>"), 2);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,7 +211,7 @@ class CommandListShell extends Shell {
|
|||
*/
|
||||
public function getOptionParser() {
|
||||
$parser = parent::getOptionParser();
|
||||
return $parser->description('Get the list of available shells for this CakePHP application.')
|
||||
return $parser->description(__d('cake_console', 'Get the list of available shells for this CakePHP application.'))
|
||||
->addOption('xml', array(
|
||||
'help' => __d('cake_console', 'Get the listing as XML.'),
|
||||
'boolean' => true
|
||||
|
|
|
@ -47,7 +47,7 @@ class ConsoleShell extends Shell {
|
|||
public $models = array();
|
||||
|
||||
/**
|
||||
* Override intialize of the Shell
|
||||
* Override initialize of the Shell
|
||||
*
|
||||
*/
|
||||
public function initialize() {
|
||||
|
@ -61,8 +61,8 @@ class ConsoleShell extends Shell {
|
|||
App::uses($class, 'Model');
|
||||
$this->{$class} = new $class();
|
||||
}
|
||||
$this->out('Model classes:');
|
||||
$this->out('--------------');
|
||||
$this->out(__d('cake_console', 'Model classes:'));
|
||||
$this->hr();
|
||||
|
||||
foreach ($this->models as $model) {
|
||||
$this->out(" - {$model}");
|
||||
|
@ -151,7 +151,7 @@ class ConsoleShell extends Shell {
|
|||
return true;
|
||||
break;
|
||||
case 'models':
|
||||
$this->out('Model classes:');
|
||||
$this->out(__d('cake_console', 'Model classes:'));
|
||||
$this->hr();
|
||||
foreach ($this->models as $model) {
|
||||
$this->out(" - {$model}");
|
||||
|
@ -169,9 +169,10 @@ class ConsoleShell extends Shell {
|
|||
|
||||
if ($this->_isValidModel($modelA) && $this->_isValidModel($modelB) && in_array($association, $this->associations)) {
|
||||
$this->{$modelA}->bindModel(array($association => array($modelB => array('className' => $modelB))), false);
|
||||
$this->out("Created $association association between $modelA and $modelB");
|
||||
$this->out(__d('cake_console', "Created %s association between %s and %s",
|
||||
$association, $modelA, $modelB));
|
||||
} else {
|
||||
$this->out("Please verify you are using valid models and association types");
|
||||
$this->out(__d('cake_console', "Please verify you are using valid models and association types"));
|
||||
}
|
||||
break;
|
||||
case (preg_match("/^(\w+) unbind (\w+) (\w+)/", $command, $tmp) == true):
|
||||
|
@ -196,9 +197,10 @@ class ConsoleShell extends Shell {
|
|||
|
||||
if ($this->_isValidModel($modelA) && $this->_isValidModel($modelB) && in_array($association, $this->associations) && $validCurrentAssociation) {
|
||||
$this->{$modelA}->unbindModel(array($association => array($modelB)));
|
||||
$this->out("Removed $association association between $modelA and $modelB");
|
||||
$this->out(__d('cake_console', "Removed %s association between %s and %s",
|
||||
$association, $modelA, $modelB));
|
||||
} else {
|
||||
$this->out("Please verify you are using valid models, valid current association, and valid association types");
|
||||
$this->out(__d('cake_console', "Please verify you are using valid models, valid current association, and valid association types"));
|
||||
}
|
||||
break;
|
||||
case (strpos($command, "->find") > 0):
|
||||
|
@ -248,10 +250,11 @@ class ConsoleShell extends Shell {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$this->out("\nNo result set found");
|
||||
$this->out();
|
||||
$this->out(__d('cake_console', "No result set found"));
|
||||
}
|
||||
} else {
|
||||
$this->out("$modelToCheck is not a valid model");
|
||||
$this->out(__d('cake_console', "%s is not a valid model", $modelToCheck));
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -267,7 +270,7 @@ class ConsoleShell extends Shell {
|
|||
$data = preg_replace('/^\(*(array)?\(*(.+?)\)*$/i', '\\2', $data);
|
||||
$saveCommand = "\$this->{$modelToSave}->save(array('{$modelToSave}' => array({$data})));";
|
||||
@eval($saveCommand);
|
||||
$this->out('Saved record for ' . $modelToSave);
|
||||
$this->out(__d('cake_console', 'Saved record for %s', $modelToSave));
|
||||
}
|
||||
break;
|
||||
case (preg_match("/^(\w+) columns/", $command, $tmp) == true):
|
||||
|
@ -284,17 +287,16 @@ class ConsoleShell extends Shell {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
$this->out("Please verify that you selected a valid model");
|
||||
$this->out(__d('cake_console', "Please verify that you selected a valid model"));
|
||||
}
|
||||
break;
|
||||
case (preg_match("/^routes\s+reload/i", $command, $tmp) == true):
|
||||
$router = Router::getInstance();
|
||||
if (!$this->_loadRoutes()) {
|
||||
$this->out("There was an error loading the routes config. Please check that the file");
|
||||
$this->out("exists and is free of parse errors.");
|
||||
$this->out(__d('cake_console', "There was an error loading the routes config. Please check that the file exists and is free of parse errors."));
|
||||
break;
|
||||
}
|
||||
$this->out("Routes configuration reloaded, " . count($router->routes) . " routes connected");
|
||||
$this->out(__d('cake_console', "Routes configuration reloaded, %d routes connected", count($router->routes)));
|
||||
break;
|
||||
case (preg_match("/^routes\s+show/i", $command, $tmp) == true):
|
||||
$router = Router::getInstance();
|
||||
|
@ -309,7 +311,8 @@ class ConsoleShell extends Shell {
|
|||
$this->out(var_export(Router::parse($tmp[1]), true));
|
||||
break;
|
||||
default:
|
||||
$this->out("Invalid command\n");
|
||||
$this->out(__d('cake_console', "Invalid command"));
|
||||
$this->out();
|
||||
break;
|
||||
}
|
||||
$command = '';
|
||||
|
|
|
@ -137,7 +137,8 @@ class SchemaShell extends Shell {
|
|||
|
||||
if (!$snapshot && file_exists($this->Schema->path . DS . $this->params['file'])) {
|
||||
$snapshot = true;
|
||||
$result = strtolower($this->in("Schema file exists.\n [O]verwrite\n [S]napshot\n [Q]uit\nWould you like to do?", array('o', 's', 'q'), 's'));
|
||||
$prompt = __d('cake_console', "Schema file exists.\n [O]verwrite\n [S]napshot\n [Q]uit\nWould you like to do?");
|
||||
$result = strtolower($this->in($prompt, array('o', 's', 'q'), 's'));
|
||||
if ($result === 'q') {
|
||||
return $this->_stop();
|
||||
}
|
||||
|
@ -453,7 +454,7 @@ class SchemaShell extends Shell {
|
|||
'help' => __d('cake_console', 'Snapshot number to use/make.')
|
||||
);
|
||||
$dry = array(
|
||||
'help' => 'Perform a dry run on create and update commands. Queries will be output instead of run.',
|
||||
'help' => __d('cake_console', 'Perform a dry run on create and update commands. Queries will be output instead of run.'),
|
||||
'boolean' => true
|
||||
);
|
||||
$force = array(
|
||||
|
@ -467,10 +468,9 @@ class SchemaShell extends Shell {
|
|||
|
||||
$parser = parent::getOptionParser();
|
||||
$parser->description(
|
||||
'The Schema Shell generates a schema object from' .
|
||||
'the database and updates the database from the schema.'
|
||||
__d('cake_console', 'The Schema Shell generates a schema object from the database and updates the database from the schema.')
|
||||
)->addSubcommand('view', array(
|
||||
'help' => 'read and output the contents of a schema file',
|
||||
'help' => __d('cake_console', 'Read and output the contents of a schema file'),
|
||||
'parser' => array(
|
||||
'options' => compact('plugin', 'path', 'file', 'name', 'connection'),
|
||||
'arguments' => compact('name')
|
||||
|
|
|
@ -305,7 +305,7 @@ class ControllerTask extends BakeTask {
|
|||
* @return string Baked controller
|
||||
*/
|
||||
public function bake($controllerName, $actions = '', $helpers = null, $components = null) {
|
||||
$this->out("\nBaking controller class for $controllerName...", 1, Shell::QUIET);
|
||||
$this->out("\n" . __d('cake_console', 'Baking controller class for %s...', $controllerName), 1, Shell::QUIET);
|
||||
|
||||
$isScaffold = ($actions === 'scaffold') ? true : false;
|
||||
|
||||
|
|
|
@ -94,19 +94,19 @@ class DbConfigTask extends Shell {
|
|||
$name = '';
|
||||
|
||||
while ($name == '') {
|
||||
$name = $this->in("Name:", null, 'default');
|
||||
$name = $this->in(__d('cake_console', "Name:"), null, 'default');
|
||||
if (preg_match('/[^a-z0-9_]/i', $name)) {
|
||||
$name = '';
|
||||
$this->out('The name may only contain unaccented latin characters, numbers or underscores');
|
||||
$this->out(__d('cake_console', 'The name may only contain unaccented latin characters, numbers or underscores'));
|
||||
} else if (preg_match('/^[^a-z_]/i', $name)) {
|
||||
$name = '';
|
||||
$this->out('The name must start with an unaccented latin character or an underscore');
|
||||
$this->out(__d('cake_console', 'The name must start with an unaccented latin character or an underscore'));
|
||||
}
|
||||
}
|
||||
|
||||
$driver = $this->in('Driver:', array('mssql', 'mysql', 'oracle', 'postgres', 'sqlite'), 'mysql');
|
||||
$driver = $this->in(__d('cake_console', 'Driver:'), array('mssql', 'mysql', 'oracle', 'postgres', 'sqlite'), 'mysql');
|
||||
|
||||
$persistent = $this->in('Persistent Connection?', array('y', 'n'), 'n');
|
||||
$persistent = $this->in(__d('cake_console', 'Persistent Connection?'), array('y', 'n'), 'n');
|
||||
if (strtolower($persistent) == 'n') {
|
||||
$persistent = 'false';
|
||||
} else {
|
||||
|
@ -115,12 +115,12 @@ class DbConfigTask extends Shell {
|
|||
|
||||
$host = '';
|
||||
while ($host == '') {
|
||||
$host = $this->in('Database Host:', null, 'localhost');
|
||||
$host = $this->in(__d('cake_console', 'Database Host:'), null, 'localhost');
|
||||
}
|
||||
|
||||
$port = '';
|
||||
while ($port == '') {
|
||||
$port = $this->in('Port?', null, 'n');
|
||||
$port = $this->in(__d('cake_console', 'Port?'), null, 'n');
|
||||
}
|
||||
|
||||
if (strtolower($port) == 'n') {
|
||||
|
@ -129,16 +129,16 @@ class DbConfigTask extends Shell {
|
|||
|
||||
$login = '';
|
||||
while ($login == '') {
|
||||
$login = $this->in('User:', null, 'root');
|
||||
$login = $this->in(__d('cake_console', 'User:'), null, 'root');
|
||||
}
|
||||
$password = '';
|
||||
$blankPassword = false;
|
||||
|
||||
while ($password == '' && $blankPassword == false) {
|
||||
$password = $this->in('Password:');
|
||||
$password = $this->in(__d('cake_console', 'Password:'));
|
||||
|
||||
if ($password == '') {
|
||||
$blank = $this->in('The password you supplied was empty. Use an empty password?', array('y', 'n'), 'n');
|
||||
$blank = $this->in(__d('cake_console', 'The password you supplied was empty. Use an empty password?'), array('y', 'n'), 'n');
|
||||
if ($blank == 'y') {
|
||||
$blankPassword = true;
|
||||
}
|
||||
|
@ -147,12 +147,12 @@ class DbConfigTask extends Shell {
|
|||
|
||||
$database = '';
|
||||
while ($database == '') {
|
||||
$database = $this->in('Database Name:', null, 'cake');
|
||||
$database = $this->in(__d('cake_console', 'Database Name:'), null, 'cake');
|
||||
}
|
||||
|
||||
$prefix = '';
|
||||
while ($prefix == '') {
|
||||
$prefix = $this->in('Table Prefix?', null, 'n');
|
||||
$prefix = $this->in(__d('cake_console', 'Table Prefix?'), null, 'n');
|
||||
}
|
||||
if (strtolower($prefix) == 'n') {
|
||||
$prefix = null;
|
||||
|
@ -160,7 +160,7 @@ class DbConfigTask extends Shell {
|
|||
|
||||
$encoding = '';
|
||||
while ($encoding == '') {
|
||||
$encoding = $this->in('Table encoding?', null, 'n');
|
||||
$encoding = $this->in(__d('cake_console', 'Table encoding?'), null, 'n');
|
||||
}
|
||||
if (strtolower($encoding) == 'n') {
|
||||
$encoding = null;
|
||||
|
@ -169,7 +169,7 @@ class DbConfigTask extends Shell {
|
|||
$schema = '';
|
||||
if ($driver == 'postgres') {
|
||||
while ($schema == '') {
|
||||
$schema = $this->in('Table schema?', null, 'n');
|
||||
$schema = $this->in(__d('cake_console', 'Table schema?'), null, 'n');
|
||||
}
|
||||
}
|
||||
if (strtolower($schema) == 'n') {
|
||||
|
@ -183,7 +183,7 @@ class DbConfigTask extends Shell {
|
|||
}
|
||||
|
||||
$dbConfigs[] = $config;
|
||||
$doneYet = $this->in('Do you wish to add another database configuration?', null, 'n');
|
||||
$doneYet = $this->in(__d('cake_console', 'Do you wish to add another database configuration?'), null, 'n');
|
||||
|
||||
if (strtolower($doneYet == 'n')) {
|
||||
$done = true;
|
||||
|
@ -205,35 +205,35 @@ class DbConfigTask extends Shell {
|
|||
extract($config);
|
||||
$this->out();
|
||||
$this->hr();
|
||||
$this->out('The following database configuration will be created:');
|
||||
$this->out(__d('cake_console', 'The following database configuration will be created:'));
|
||||
$this->hr();
|
||||
$this->out("Name: $name");
|
||||
$this->out("Driver: $driver");
|
||||
$this->out("Persistent: $persistent");
|
||||
$this->out("Host: $host");
|
||||
$this->out(__d('cake_console', "Name: %s", $name));
|
||||
$this->out(__d('cake_console', "Driver: %s", $driver));
|
||||
$this->out(__d('cake_console', "Persistent: %s", $persistent));
|
||||
$this->out(__d('cake_console', "Host: %s", $host));
|
||||
|
||||
if ($port) {
|
||||
$this->out("Port: $port");
|
||||
$this->out(__d('cake_console', "Port: %s", $port));
|
||||
}
|
||||
|
||||
$this->out("User: $login");
|
||||
$this->out("Pass: " . str_repeat('*', strlen($password)));
|
||||
$this->out("Database: $database");
|
||||
$this->out(__d('cake_console', "User: %s", $login));
|
||||
$this->out("Pass: %s", str_repeat('*', strlen($password))));
|
||||
$this->out("Database: %s", $database));
|
||||
|
||||
if ($prefix) {
|
||||
$this->out("Table prefix: $prefix");
|
||||
$this->out(__d('cake_console', "Table prefix: %s", $prefix));
|
||||
}
|
||||
|
||||
if ($schema) {
|
||||
$this->out("Schema: $schema");
|
||||
$this->out(__d('cake_console', "Schema: %s", $schema));
|
||||
}
|
||||
|
||||
if ($encoding) {
|
||||
$this->out("Encoding: $encoding");
|
||||
$this->out(__d('cake_console', "Encoding: %s", $encoding));
|
||||
}
|
||||
|
||||
$this->hr();
|
||||
$looksGood = $this->in('Look okay?', array('y', 'n'), 'y');
|
||||
$looksGood = $this->in(__d('cake_console', 'Look okay?'), array('y', 'n'), 'y');
|
||||
|
||||
if (strtolower($looksGood) == 'y') {
|
||||
return $config;
|
||||
|
@ -249,7 +249,7 @@ class DbConfigTask extends Shell {
|
|||
*/
|
||||
public function bake($configs) {
|
||||
if (!is_dir($this->path)) {
|
||||
$this->err($this->path . ' not found');
|
||||
$this->err(__d('cake_console', '%s not found', $this->path));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ class FixtureTask extends BakeTask {
|
|||
'help' => __d('cake_console', 'CamelCased name of the plugin to bake fixtures for.'),
|
||||
'short' => 'p',
|
||||
))->addOption('records', array(
|
||||
'help' => 'Used with --count and <name>/all commands to pull [n] records from the live tables, where [n] is either --count or the default of 10',
|
||||
'help' => __d('cake_console', 'Used with --count and <name>/all commands to pull [n] records from the live tables, where [n] is either --count or the default of 10'),
|
||||
'short' => 'r',
|
||||
'boolean' => true
|
||||
))->epilog(__d('cake_console', 'Omitting all arguments and options will enter into an interactive mode.'));;
|
||||
|
@ -91,7 +91,7 @@ class FixtureTask extends BakeTask {
|
|||
|
||||
/**
|
||||
* Execution method always used for tasks
|
||||
* Handles dispatching to interactive, named, or all processess.
|
||||
* Handles dispatching to interactive, named, or all processeses.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -137,7 +137,7 @@ class FixtureTask extends BakeTask {
|
|||
protected function _interactive() {
|
||||
$this->DbConfig->interactive = $this->Model->interactive = $this->interactive = true;
|
||||
$this->hr();
|
||||
$this->out(sprintf("Bake Fixture\nPath: %s", $this->path));
|
||||
$this->out(__d('cake_console', "Bake Fixture\nPath: %s", $this->path));
|
||||
$this->hr();
|
||||
|
||||
if (!isset($this->connection)) {
|
||||
|
@ -254,7 +254,7 @@ class FixtureTask extends BakeTask {
|
|||
$this->Template->set($vars);
|
||||
$content = $this->Template->generate('classes', 'fixture');
|
||||
|
||||
$this->out("\nBaking test fixture for $model...", 1, Shell::QUIET);
|
||||
$this->out("\n" . __d('cake_console', 'Baking test fixture for %s...', $model), 1, Shell::QUIET);
|
||||
$this->createFile($path . $filename, $content);
|
||||
return $content;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ class ModelTask extends BakeTask {
|
|||
*/
|
||||
protected function _interactive() {
|
||||
$this->hr();
|
||||
$this->out(sprintf("Bake Model\nPath: %s", $this->path));
|
||||
$this->out(__d('cake_console', "Bake Model\nPath: %s", $this->path));
|
||||
$this->hr();
|
||||
$this->interactive = true;
|
||||
|
||||
|
@ -215,7 +215,7 @@ class ModelTask extends BakeTask {
|
|||
$this->hr();
|
||||
$this->out(__d('cake_console', 'The following Model will be created:'));
|
||||
$this->hr();
|
||||
$this->out("Name: " . $currentModelName);
|
||||
$this->out(__d('cake_console', "Name: %s", $currentModelName));
|
||||
|
||||
if ($this->connection !== 'default') {
|
||||
$this->out(__d('cake_console', "DB Config: %s", $this->connection));
|
||||
|
@ -561,7 +561,7 @@ class ModelTask extends BakeTask {
|
|||
* Find the hasAndBelongsToMany relations and add them to associations list
|
||||
*
|
||||
* @param object $model Model instance being generated
|
||||
* @param array $associations Array of inprogress associations
|
||||
* @param array $associations Array of in-progress associations
|
||||
* @return array $associations with hasAndBelongsToMany added in.
|
||||
*/
|
||||
public function findHasAndBelongsToMany($model, $associations) {
|
||||
|
@ -738,7 +738,7 @@ class ModelTask extends BakeTask {
|
|||
|
||||
$path = $this->getPath();
|
||||
$filename = $path . $name . '.php';
|
||||
$this->out("\nBaking model class for $name...", 1, Shell::QUIET);
|
||||
$this->out("\n" . __d('cake_console', 'Baking model class for %s...', $name), 1, Shell::QUIET);
|
||||
$this->createFile($filename, $out);
|
||||
ClassRegistry::flush();
|
||||
return $out;
|
||||
|
|
|
@ -185,10 +185,10 @@ class PluginTask extends Shell {
|
|||
*/
|
||||
public function getOptionParser() {
|
||||
$parser = parent::getOptionParser();
|
||||
return $parser->description(
|
||||
return $parser->description(__d('cake_console',
|
||||
'Create the directory structure, AppModel and AppController classes for a new plugin. ' .
|
||||
'Can create plugins in any of your bootstrapped plugin paths.'
|
||||
)->addArgument('name', array(
|
||||
))->addArgument('name', array(
|
||||
'help' => __d('cake_console', 'CamelCased name of the plugin to create.')
|
||||
));
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ class ProjectTask extends Shell {
|
|||
}
|
||||
if ($this->interactive) {
|
||||
$this->hr();
|
||||
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
|
||||
$this->out(__d('cake_console', 'You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.'));
|
||||
$this->out(__d('cake_console', 'What would you like the prefix route to be?'));
|
||||
$this->out(__d('cake_console', 'Example: www.example.com/admin/controller'));
|
||||
while ($admin == '') {
|
||||
|
@ -365,7 +365,7 @@ class ProjectTask extends Shell {
|
|||
}
|
||||
if ($this->cakeAdmin($admin) !== true) {
|
||||
$this->out(__d('cake_console', '<error>Unable to write to</error> /app/config/core.php.'));
|
||||
$this->out('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
|
||||
$this->out(__d('cake_console', 'You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.'));
|
||||
$this->_stop();
|
||||
}
|
||||
return $admin . '_';
|
||||
|
|
|
@ -142,7 +142,7 @@ class TestTask extends BakeTask {
|
|||
if ($this->plugin) {
|
||||
$plugin = $this->plugin . '.';
|
||||
}
|
||||
$this->out("\nBaking test case for $className $type...", 1, Shell::QUIET);
|
||||
$this->out("\n" . __d('cake_console', 'Baking test case for %s %s ...', $className, $type), 1, Shell::QUIET);
|
||||
|
||||
$this->Template->set('fixtures', $this->_fixtures);
|
||||
$this->Template->set('plugin', $plugin);
|
||||
|
|
|
@ -367,7 +367,7 @@ class ViewTask extends BakeTask {
|
|||
if (empty($content)) {
|
||||
return false;
|
||||
}
|
||||
$this->out("\nBaking `$action` view file...", 1, Shell::QUIET);
|
||||
$this->out("\n" . __d('cake_console', 'Baking `%s` view file...', $action), 1, Shell::QUIET);
|
||||
$path = $this->getPath();
|
||||
$filename = $path . $this->controllerPath . DS . Inflector::underscore($action) . '.ctp';
|
||||
return $this->createFile($filename, $content);
|
||||
|
|
|
@ -41,8 +41,8 @@ class TestsuiteShell extends Shell {
|
|||
public function getOptionParser() {
|
||||
$parser = new ConsoleOptionParser($this->name);
|
||||
$parser->description(array(
|
||||
'The CakePHP Testsuite allows you to run test cases from the command line',
|
||||
'If run with no command line arguments, a list of available core test cases will be shown'
|
||||
__d('cake_console', 'The CakePHP Testsuite allows you to run test cases from the command line'),
|
||||
__d('cake_console', 'If run with no command line arguments, a list of available core test cases will be shown')
|
||||
))->addArgument('category', array(
|
||||
'help' => __d('cake_console', 'app, core or name of a plugin.'),
|
||||
'required' => true
|
||||
|
@ -157,7 +157,7 @@ class TestsuiteShell extends Shell {
|
|||
}
|
||||
|
||||
/**
|
||||
* Initialization method installs Simpletest and loads all plugins
|
||||
* Initialization method installs PHPUnit and loads all plugins
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
@ -57,8 +57,7 @@ class ConsoleErrorHandler extends ErrorHandler {
|
|||
*/
|
||||
public static function handleException(Exception $exception) {
|
||||
$stderr = self::getStderr();
|
||||
$stderr->write(sprintf(
|
||||
__d('cake_console', "<error>Error:</error> %s\n%s"),
|
||||
$stderr->write(__d('cake_console', "<error>Error:</error> %s\n%s",
|
||||
$exception->getMessage(),
|
||||
$exception->getTraceAsString()
|
||||
));
|
||||
|
@ -70,7 +69,7 @@ class ConsoleErrorHandler extends ErrorHandler {
|
|||
* @param int $code Error code
|
||||
* @param string $description Description of the error.
|
||||
* @param string $file The file the error occurred in.
|
||||
* @param int $line The line the error ocurrred on.
|
||||
* @param int $line The line the error occurred on.
|
||||
* @param array $context The backtrace of the error.
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
@ -55,7 +55,7 @@ class ConsoleInputArgument {
|
|||
/**
|
||||
* Make a new Input Argument
|
||||
*
|
||||
* @param mixed $name The long name of the option, or an array with all the properites.
|
||||
* @param mixed $name The long name of the option, or an array with all the properties.
|
||||
* @param string $help The help text for this option
|
||||
* @param boolean $required Whether this argument is required. Missing required args will trigger exceptions
|
||||
* @param array $choices Valid choices for this option.
|
||||
|
@ -139,8 +139,8 @@ class ConsoleInputArgument {
|
|||
return true;
|
||||
}
|
||||
if (!in_array($value, $this->_choices)) {
|
||||
throw new ConsoleException(sprintf(
|
||||
__d('cake_console', '"%s" is not a valid value for %s. Please use one of "%s"'),
|
||||
throw new ConsoleException(
|
||||
__d('cake_console', '"%s" is not a valid value for %s. Please use one of "%s"',
|
||||
$value, $this->_name, implode(', ', $this->_choices)
|
||||
));
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class ConsoleInputOption {
|
|||
/**
|
||||
* Make a new Input Option
|
||||
*
|
||||
* @param mixed $name The long name of the option, or an array with all the properites.
|
||||
* @param mixed $name The long name of the option, or an array with all the properties.
|
||||
* @param string $short The short alias for this option
|
||||
* @param string $help The help text for this option
|
||||
* @param boolean $boolean Whether this option is a boolean option. Boolean options don't consume extra tokens
|
||||
|
@ -179,8 +179,8 @@ class ConsoleInputOption {
|
|||
return true;
|
||||
}
|
||||
if (!in_array($value, $this->_choices)) {
|
||||
throw new ConsoleException(sprintf(
|
||||
__d('cake_console', '"%s" is not a valid value for --%s. Please use one of "%s"'),
|
||||
throw new ConsoleException(
|
||||
__d('cake_console', '"%s" is not a valid value for --%s. Please use one of "%s"',
|
||||
$value, $this->_name, implode(', ', $this->_choices)
|
||||
));
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class ConsoleInputSubcommand {
|
|||
/**
|
||||
* Make a new Subcommand
|
||||
*
|
||||
* @param mixed $name The long name of the subcommand, or an array with all the properites.
|
||||
* @param mixed $name The long name of the subcommand, or an array with all the properties.
|
||||
* @param string $help The help text for this option
|
||||
* @param mixed $parser A parser for this subcommand. Either a ConsoleOptionParser, or an array that can be
|
||||
* used with ConsoleOptionParser::buildFromArray()
|
||||
|
|
|
@ -86,9 +86,9 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* ### Options
|
||||
*
|
||||
* Named arguments come in two forms, long and short. Long arguments are preceeded
|
||||
* Named arguments come in two forms, long and short. Long arguments are preceded
|
||||
* by two - and give a more verbose option name. i.e. `--version`. Short arguments are
|
||||
* preceeded by one - and are only one character long. They usually match with a long option,
|
||||
* preceded by one - and are only one character long. They usually match with a long option,
|
||||
* and provide a more terse alternative.
|
||||
*
|
||||
* ### Using Options
|
||||
|
@ -102,7 +102,7 @@ class ConsoleOptionParser {
|
|||
*
|
||||
* `cake myshell command --connection default --name=something`
|
||||
*
|
||||
* Short options can be defined singally or in groups.
|
||||
* Short options can be defined signally or in groups.
|
||||
*
|
||||
* `cake myshell command -cn`
|
||||
*
|
||||
|
@ -127,7 +127,7 @@ class ConsoleOptionParser {
|
|||
|
||||
$this->addOption('help', array(
|
||||
'short' => 'h',
|
||||
'help' => 'Display this help.',
|
||||
'help' => __d('cake_console', 'Display this help.'),
|
||||
'boolean' => true
|
||||
));
|
||||
|
||||
|
@ -330,7 +330,7 @@ class ConsoleOptionParser {
|
|||
}
|
||||
|
||||
/**
|
||||
* Add multiple arugments at once. Take an array of arugment defintions.
|
||||
* Add multiple arguments at once. Take an array of argument definitions.
|
||||
* The keys are used as the argument names, and the values as params for the argument.
|
||||
*
|
||||
* @param array $args Array of arguments to add.
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
/**
|
||||
* Object wrapper for outputing information from a shell application.
|
||||
* Object wrapper for outputting information from a shell application.
|
||||
* Can be connected to any stream resource that can be used with fopen()
|
||||
*
|
||||
* Can generate colourized output on consoles that support it. There are a few
|
||||
* Can generate colorized output on consoles that support it. There are a few
|
||||
* built in styles
|
||||
*
|
||||
* - `error` Error messages.
|
||||
|
@ -37,7 +37,7 @@
|
|||
*
|
||||
* `$this->out('<warning>Overwrite:</warning> foo.php was overwritten.');`
|
||||
*
|
||||
* This would create orange 'Overwrite:' text, while the rest of the text would remain the normal colour.
|
||||
* This would create orange 'Overwrite:' text, while the rest of the text would remain the normal color.
|
||||
* See ConsoleOutput::styles() to learn more about defining your own styles. Nested styles are not supported
|
||||
* at this time.
|
||||
*
|
||||
|
@ -55,7 +55,7 @@ class ConsoleOutput {
|
|||
const PLAIN = 1;
|
||||
|
||||
/**
|
||||
* Colour output - Convert known tags in to ANSI color escape codes.
|
||||
* Color output - Convert known tags in to ANSI color escape codes.
|
||||
*/
|
||||
const COLOR = 2;
|
||||
|
||||
|
@ -79,7 +79,7 @@ class ConsoleOutput {
|
|||
protected $_outputAs = self::COLOR;
|
||||
|
||||
/**
|
||||
* text colors used in coloured output.
|
||||
* text colors used in colored output.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
@ -95,7 +95,7 @@ class ConsoleOutput {
|
|||
);
|
||||
|
||||
/**
|
||||
* background colours used in coloured output.
|
||||
* background colors used in colored output.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
|
@ -111,7 +111,7 @@ class ConsoleOutput {
|
|||
);
|
||||
|
||||
/**
|
||||
* formatting options for coloured output
|
||||
* formatting options for colored output
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
|
@ -140,7 +140,7 @@ class ConsoleOutput {
|
|||
/**
|
||||
* Construct the output object.
|
||||
*
|
||||
* Checks for a pretty console enviornment. Ansicon allows pretty consoles
|
||||
* Checks for a pretty console environment. Ansicon allows pretty consoles
|
||||
* on windows, and is supported.
|
||||
*
|
||||
* @param string $stream The identifier of the stream to write output to.
|
||||
|
@ -267,7 +267,7 @@ class ConsoleOutput {
|
|||
/**
|
||||
* Get/Set the output type to use. The output type how formatting tags are treated.
|
||||
*
|
||||
* @param int $type The output type to use. Should be one of the class contstants.
|
||||
* @param int $type The output type to use. Should be one of the class constants.
|
||||
* @return mixed Either null or the value if getting.
|
||||
*/
|
||||
public function outputAs($type = null) {
|
||||
|
|
|
@ -23,7 +23,7 @@ App::uses('String', 'Utility');
|
|||
* Generally not directly used. Using $parser->help($command, 'xml'); is usually
|
||||
* how you would access help. Or via the `--help=xml` option on the command line.
|
||||
*
|
||||
* Xml output is useful for intergration with other tools like IDE's or other build tools.
|
||||
* Xml output is useful for integration with other tools like IDE's or other build tools.
|
||||
*
|
||||
* @package cake.console.libs
|
||||
* @since CakePHP(tm) v 2.0
|
||||
|
@ -52,12 +52,12 @@ class HelpFormatter {
|
|||
$out[] = String::wrap($description, $width);
|
||||
$out[] = '';
|
||||
}
|
||||
$out[] = '<info>Usage:</info>';
|
||||
$out[] = __d('cake_console', '<info>Usage:</info>');
|
||||
$out[] = $this->_generateUsage();
|
||||
$out[] = '';
|
||||
$subcommands = $parser->subcommands();
|
||||
if (!empty($subcommands)) {
|
||||
$out[] = '<info>Subcommands:</info>';
|
||||
$out[] = __d('cake_console', '<info>Subcommands:</info>');
|
||||
$out[] = '';
|
||||
$max = $this->_getMaxLength($subcommands) + 2;
|
||||
foreach ($subcommands as $command) {
|
||||
|
@ -68,17 +68,14 @@ class HelpFormatter {
|
|||
));
|
||||
}
|
||||
$out[] = '';
|
||||
$out[] = sprintf(
|
||||
__d('cake_console', 'To see help on a subcommand use <info>`cake %s [subcommand] --help`</info>'),
|
||||
$parser->command()
|
||||
);
|
||||
$out[] = __d('cake_console', 'To see help on a subcommand use <info>`cake %s [subcommand] --help`</info>', $parser->command());
|
||||
$out[] = '';
|
||||
}
|
||||
|
||||
$options = $parser->options();
|
||||
if (!empty($options)) {
|
||||
$max = $this->_getMaxLength($options) + 8;
|
||||
$out[] = '<info>Options:</info>';
|
||||
$out[] = __d('cake_console', '<info>Options:</info>');
|
||||
$out[] = '';
|
||||
foreach ($options as $option) {
|
||||
$out[] = String::wrap($option->help($max), array(
|
||||
|
@ -93,7 +90,7 @@ class HelpFormatter {
|
|||
$arguments = $parser->arguments();
|
||||
if (!empty($arguments)) {
|
||||
$max = $this->_getMaxLength($arguments) + 2;
|
||||
$out[] = '<info>Arguments:</info>';
|
||||
$out[] = __d('cake_console', '<info>Arguments:</info>');
|
||||
$out[] = '';
|
||||
foreach ($arguments as $argument) {
|
||||
$out[] = String::wrap($argument->help($max), array(
|
||||
|
@ -114,7 +111,7 @@ class HelpFormatter {
|
|||
|
||||
/**
|
||||
* Generate the usage for a shell based on its arguments and options.
|
||||
* Usage strings favour short options over the long ones. and optional args will
|
||||
* Usage strings favor short options over the long ones. and optional args will
|
||||
* be indicated with []
|
||||
*
|
||||
* @return string
|
||||
|
@ -156,7 +153,7 @@ class HelpFormatter {
|
|||
public function xml($string = true) {
|
||||
$parser = $this->_parser;
|
||||
$xml = new SimpleXmlElement('<shell></shell>');
|
||||
$xml->addChild('commmand', $parser->command());
|
||||
$xml->addChild('command', $parser->command());
|
||||
$xml->addChild('description', $parser->description());
|
||||
|
||||
$xml->addChild('epilog', $parser->epilog());
|
||||
|
|
|
@ -188,7 +188,7 @@ class Shell extends Object {
|
|||
/**
|
||||
* Starts up the Shell
|
||||
* allows for checking and configuring prior to command or main execution
|
||||
* can be overriden in subclasses
|
||||
* can be overridden in subclasses
|
||||
*
|
||||
*/
|
||||
public function startup() {
|
||||
|
@ -201,10 +201,10 @@ class Shell extends Object {
|
|||
*/
|
||||
protected function _welcome() {
|
||||
$this->out();
|
||||
$this->out('<info>Welcome to CakePHP v' . Configure::version() . ' Console</info>');
|
||||
$this->out(__d('cake_console', '<info>Welcome to CakePHP %s Console</info>', 'v' . Configure::version()));
|
||||
$this->hr();
|
||||
$this->out('App : '. APP_DIR);
|
||||
$this->out('Path: '. APP_PATH);
|
||||
$this->out(__d('cake_console', 'App : %s', APP_DIR));
|
||||
$this->out(__d('cake_console', 'Path: %s', APP_PATH));
|
||||
$this->hr();
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ class Shell extends Object {
|
|||
*
|
||||
* ### Usage:
|
||||
*
|
||||
* With a string commmand:
|
||||
* With a string command:
|
||||
*
|
||||
* `return $this->dispatchShell('schema create DbAcl');`
|
||||
*
|
||||
|
@ -578,7 +578,7 @@ class Shell extends Object {
|
|||
*/
|
||||
public function clear() {
|
||||
if (empty($this->params['noclear'])) {
|
||||
if ( DS === '/') {
|
||||
if (DS === '/') {
|
||||
passthru('clear');
|
||||
} else {
|
||||
passthru('cls');
|
||||
|
@ -600,7 +600,7 @@ class Shell extends Object {
|
|||
|
||||
if (is_file($path) && $this->interactive === true) {
|
||||
$this->out(__d('cake_console', '<warning>File `%s` exists</warning>', $path));
|
||||
$key = $this->in(__d('cake_console', 'Do you want to overwrite?'), array('y', 'n', 'q'), 'n');
|
||||
$key = $this->in(__d('cake_console', 'Do you want to overwrite?'), array('y', 'n', 'q'), 'n');
|
||||
|
||||
if (strtolower($key) == 'q') {
|
||||
$this->out(__d('cake_console', '<error>Quitting</error>.'), 2);
|
||||
|
@ -636,13 +636,13 @@ class Shell extends Object {
|
|||
if (@include 'PHPUnit' . DS . 'Autoload.php') {
|
||||
return true;
|
||||
}
|
||||
$prompt = 'PHPUnit is not installed. Do you want to bake unit test files anyway?';
|
||||
$prompt = __d('cake_console', 'PHPUnit is not installed. Do you want to bake unit test files anyway?');
|
||||
$unitTest = $this->in($prompt, array('y','n'), 'y');
|
||||
$result = strtolower($unitTest) == 'y' || strtolower($unitTest) == 'yes';
|
||||
|
||||
if ($result) {
|
||||
$this->out();
|
||||
$this->out('You can download PHPUnit from http://phpunit.de');
|
||||
$this->out(__d('cake_console', 'You can download PHPUnit from %s', 'http://phpunit.de'));
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -99,13 +99,13 @@ class ShellDispatcher {
|
|||
*/
|
||||
protected function _initEnvironment() {
|
||||
if (!$this->__bootstrap()) {
|
||||
$message = "Unable to load CakePHP core.\nMake sure " . DS . 'cake' . DS . 'libs exists in ' . CAKE_CORE_INCLUDE_PATH;
|
||||
$message = "Unable to load CakePHP core.\nMake sure " . DS . 'lib' . DS . 'Cake exists in ' . CAKE_CORE_INCLUDE_PATH;
|
||||
throw new CakeException($message);
|
||||
}
|
||||
|
||||
if (!isset($this->args[0]) || !isset($this->params['working'])) {
|
||||
$message = "This file has been loaded incorrectly and cannot continue.\n" .
|
||||
"Please make sure that " . DIRECTORY_SEPARATOR . "cake" . DIRECTORY_SEPARATOR . "console is in your system path,\n" .
|
||||
"Please make sure that " . DS . 'lib' . DS . 'Cake' . DS . "Console is in your system path,\n" .
|
||||
"and check the cookbook for the correct usage of this command.\n" .
|
||||
"(http://book.cakephp.org/)";
|
||||
throw new CakeException($message);
|
||||
|
|
Loading…
Reference in a new issue