mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
translations for the console dir
This commit is contained in:
parent
5ae97871da
commit
8f0c923cf6
23 changed files with 442 additions and 442 deletions
|
@ -71,12 +71,12 @@ class AclShell extends Shell {
|
||||||
|
|
||||||
if (!in_array(Configure::read('Acl.classname'), array('DbAcl', 'DB_ACL'))) {
|
if (!in_array(Configure::read('Acl.classname'), array('DbAcl', 'DB_ACL'))) {
|
||||||
$out = "--------------------------------------------------\n";
|
$out = "--------------------------------------------------\n";
|
||||||
$out .= __('Error: Your current Cake configuration is set to') . "\n";
|
$out .= __d('cake', 'Error: Your current Cake configuration is set to') . "\n";
|
||||||
$out .= __('an ACL implementation other than DB. Please change') . "\n";
|
$out .= __d('cake', 'an ACL implementation other than DB. Please change') . "\n";
|
||||||
$out .= __('your core config to reflect your decision to use') . "\n";
|
$out .= __d('cake', 'your core config to reflect your decision to use') . "\n";
|
||||||
$out .= __('DbAcl before attempting to use this script') . ".\n";
|
$out .= __d('cake', 'DbAcl before attempting to use this script') . ".\n";
|
||||||
$out .= "--------------------------------------------------\n";
|
$out .= "--------------------------------------------------\n";
|
||||||
$out .= __('Current ACL Classname: %s', Configure::read('Acl.classname')) . "\n";
|
$out .= __d('cake', 'Current ACL Classname: %s', Configure::read('Acl.classname')) . "\n";
|
||||||
$out .= "--------------------------------------------------\n";
|
$out .= "--------------------------------------------------\n";
|
||||||
$this->err($out);
|
$this->err($out);
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
|
@ -84,7 +84,7 @@ class AclShell extends Shell {
|
||||||
|
|
||||||
if ($this->command) {
|
if ($this->command) {
|
||||||
if (!config('database')) {
|
if (!config('database')) {
|
||||||
$this->out(__('Your database configuration was not found. Take a moment to create one.'), true);
|
$this->out(__d('cake', 'Your database configuration was not found. Take a moment to create one.'), true);
|
||||||
$this->args = null;
|
$this->args = null;
|
||||||
return $this->DbConfig->execute();
|
return $this->DbConfig->execute();
|
||||||
}
|
}
|
||||||
|
@ -127,15 +127,15 @@ class AclShell extends Shell {
|
||||||
if (is_string($data) && $data != '/') {
|
if (is_string($data) && $data != '/') {
|
||||||
$data = array('alias' => $data);
|
$data = array('alias' => $data);
|
||||||
} elseif (is_string($data)) {
|
} elseif (is_string($data)) {
|
||||||
$this->error(__('/ can not be used as an alias!') . __(" / is the root, please supply a sub alias"));
|
$this->error(__d('cake', '/ can not be used as an alias!') . __d('cake', " / is the root, please supply a sub alias"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['parent_id'] = $parent;
|
$data['parent_id'] = $parent;
|
||||||
$this->Acl->{$class}->create();
|
$this->Acl->{$class}->create();
|
||||||
if ($this->Acl->{$class}->save($data)) {
|
if ($this->Acl->{$class}->save($data)) {
|
||||||
$this->out(__("<success>New %s</success> '%s' created.", $class, $this->args[2]), 2);
|
$this->out(__d('cake', "<success>New %s</success> '%s' created.", $class, $this->args[2]), 2);
|
||||||
} else {
|
} else {
|
||||||
$this->err(__("There was a problem creating a new %s '%s'.", $class, $this->args[2]));
|
$this->err(__d('cake', "There was a problem creating a new %s '%s'.", $class, $this->args[2]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,9 +150,9 @@ class AclShell extends Shell {
|
||||||
$nodeId = $this->_getNodeId($class, $identifier);
|
$nodeId = $this->_getNodeId($class, $identifier);
|
||||||
|
|
||||||
if (!$this->Acl->{$class}->delete($nodeId)) {
|
if (!$this->Acl->{$class}->delete($nodeId)) {
|
||||||
$this->error(__('Node Not Deleted') . __('There was an error deleting the %s. Check that the node exists', $class) . ".\n");
|
$this->error(__d('cake', 'Node Not Deleted') . __d('cake', 'There was an error deleting the %s. Check that the node exists', $class) . ".\n");
|
||||||
}
|
}
|
||||||
$this->out(__('<success>%s deleted.</success>', $class), 2);
|
$this->out(__d('cake', '<success>%s deleted.</success>', $class), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -172,9 +172,9 @@ class AclShell extends Shell {
|
||||||
);
|
);
|
||||||
$this->Acl->{$class}->create();
|
$this->Acl->{$class}->create();
|
||||||
if (!$this->Acl->{$class}->save($data)) {
|
if (!$this->Acl->{$class}->save($data)) {
|
||||||
$this->out(__('Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.'), true);
|
$this->out(__d('cake', 'Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.'), true);
|
||||||
} else {
|
} else {
|
||||||
$this->out(__('Node parent set to %s', $this->args[2]) . "\n", true);
|
$this->out(__d('cake', 'Node parent set to %s', $this->args[2]) . "\n", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,11 +191,11 @@ class AclShell extends Shell {
|
||||||
|
|
||||||
if (empty($nodes)) {
|
if (empty($nodes)) {
|
||||||
$this->error(
|
$this->error(
|
||||||
__("Supplied Node '%s' not found", $this->args[1]),
|
__d('cake', "Supplied Node '%s' not found", $this->args[1]),
|
||||||
__('No tree returned.')
|
__d('cake', 'No tree returned.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$this->out(__('Path:'));
|
$this->out(__d('cake', 'Path:'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
for ($i = 0; $i < count($nodes); $i++) {
|
for ($i = 0; $i < count($nodes); $i++) {
|
||||||
$this->_outputNode($class, $nodes[$i], $i);
|
$this->_outputNode($class, $nodes[$i], $i);
|
||||||
|
@ -228,9 +228,9 @@ class AclShell extends Shell {
|
||||||
extract($this->__getParams());
|
extract($this->__getParams());
|
||||||
|
|
||||||
if ($this->Acl->check($aro, $aco, $action)) {
|
if ($this->Acl->check($aro, $aco, $action)) {
|
||||||
$this->out(__('%s is <success>allowed</success>.', $aroName), true);
|
$this->out(__d('cake', '%s is <success>allowed</success>.', $aroName), true);
|
||||||
} else {
|
} else {
|
||||||
$this->out(__('%s is <error>not allowed</error>.', $aroName), true);
|
$this->out(__d('cake', '%s is <error>not allowed</error>.', $aroName), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,9 +242,9 @@ class AclShell extends Shell {
|
||||||
extract($this->__getParams());
|
extract($this->__getParams());
|
||||||
|
|
||||||
if ($this->Acl->allow($aro, $aco, $action)) {
|
if ($this->Acl->allow($aro, $aco, $action)) {
|
||||||
$this->out(__('Permission <success>granted</success>.'), true);
|
$this->out(__d('cake', 'Permission <success>granted</success>.'), true);
|
||||||
} else {
|
} else {
|
||||||
$this->out(__('Permission was <error>not granted</error>.'), true);
|
$this->out(__d('cake', 'Permission was <error>not granted</error>.'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,9 +256,9 @@ class AclShell extends Shell {
|
||||||
extract($this->__getParams());
|
extract($this->__getParams());
|
||||||
|
|
||||||
if ($this->Acl->deny($aro, $aco, $action)) {
|
if ($this->Acl->deny($aro, $aco, $action)) {
|
||||||
$this->out(__('Permission denied.'), true);
|
$this->out(__d('cake', 'Permission denied.'), true);
|
||||||
} else {
|
} else {
|
||||||
$this->out(__('Permission was not denied.'), true);
|
$this->out(__d('cake', 'Permission was not denied.'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,9 +270,9 @@ class AclShell extends Shell {
|
||||||
extract($this->__getParams());
|
extract($this->__getParams());
|
||||||
|
|
||||||
if ($this->Acl->inherit($aro, $aco, $action)) {
|
if ($this->Acl->inherit($aro, $aco, $action)) {
|
||||||
$this->out(__('Permission inherited.'), true);
|
$this->out(__d('cake', 'Permission inherited.'), true);
|
||||||
} else {
|
} else {
|
||||||
$this->out(__('Permission was not inherited.'), true);
|
$this->out(__d('cake', 'Permission was not inherited.'), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,9 +303,9 @@ class AclShell extends Shell {
|
||||||
|
|
||||||
if (empty($nodes)) {
|
if (empty($nodes)) {
|
||||||
if (isset($this->args[1])) {
|
if (isset($this->args[1])) {
|
||||||
$this->error(__('%s not found', $this->args[1]), __('No tree returned.'));
|
$this->error(__d('cake', '%s not found', $this->args[1]), __d('cake', 'No tree returned.'));
|
||||||
} elseif (isset($this->args[0])) {
|
} elseif (isset($this->args[0])) {
|
||||||
$this->error(__('%s not found', $this->args[0]), __('No tree returned.'));
|
$this->error(__d('cake', '%s not found', $this->args[0]), __d('cake', 'No tree returned.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->out($class . " tree:");
|
$this->out($class . " tree:");
|
||||||
|
@ -354,140 +354,140 @@ class AclShell extends Shell {
|
||||||
$type = array(
|
$type = array(
|
||||||
'choices' => array('aro', 'aco'),
|
'choices' => array('aro', 'aco'),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'help' => __('Type of node to create.')
|
'help' => __d('cake', 'Type of node to create.')
|
||||||
);
|
);
|
||||||
|
|
||||||
$parser->description('A console tool for managing the DbAcl')
|
$parser->description('A console tool for managing the DbAcl')
|
||||||
->addSubcommand('create', array(
|
->addSubcommand('create', array(
|
||||||
'help' => __('Create a new ACL node'),
|
'help' => __d('cake', 'Create a new ACL node'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'description' => __('Creates a new ACL object <node> under the parent'),
|
'description' => __d('cake', 'Creates a new ACL object <node> under the parent'),
|
||||||
'arguments' => array(
|
'arguments' => array(
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'parent' => array(
|
'parent' => array(
|
||||||
'help' => __('The node selector for the parent.'),
|
'help' => __d('cake', 'The node selector for the parent.'),
|
||||||
'required' => true
|
'required' => true
|
||||||
),
|
),
|
||||||
'alias' => array(
|
'alias' => array(
|
||||||
'help' => __('The alias to use for the newly created node.'),
|
'help' => __d('cake', 'The alias to use for the newly created node.'),
|
||||||
'required' => true
|
'required' => true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))->addSubcommand('delete', array(
|
))->addSubcommand('delete', array(
|
||||||
'help' => __('Deletes the ACL object with the given <node> reference'),
|
'help' => __d('cake', 'Deletes the ACL object with the given <node> reference'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'description' => __('Delete an ACL node.'),
|
'description' => __d('cake', 'Delete an ACL node.'),
|
||||||
'arguments' => array(
|
'arguments' => array(
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'node' => array(
|
'node' => array(
|
||||||
'help' => __('The node identifier to delete.'),
|
'help' => __d('cake', 'The node identifier to delete.'),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))->addSubcommand('setparent', array(
|
))->addSubcommand('setparent', array(
|
||||||
'help' => __('Moves the ACL node under a new parent.'),
|
'help' => __d('cake', 'Moves the ACL node under a new parent.'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'description' => __('Moves the ACL object specified by <node> beneath <parent>'),
|
'description' => __d('cake', 'Moves the ACL object specified by <node> beneath <parent>'),
|
||||||
'arguments' => array(
|
'arguments' => array(
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'node' => array(
|
'node' => array(
|
||||||
'help' => __('The node to move'),
|
'help' => __d('cake', 'The node to move'),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
),
|
),
|
||||||
'parent' => array(
|
'parent' => array(
|
||||||
'help' => __('The new parent for <node>.'),
|
'help' => __d('cake', 'The new parent for <node>.'),
|
||||||
'required' => true
|
'required' => true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))->addSubcommand('getpath', array(
|
))->addSubcommand('getpath', array(
|
||||||
'help' => __('Print out the path to an ACL node.'),
|
'help' => __d('cake', 'Print out the path to an ACL node.'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'description' => array(
|
'description' => array(
|
||||||
__("Returns the path to the ACL object specified by <node>."),
|
__d('cake', "Returns the path to the ACL object specified by <node>."),
|
||||||
__("This command is useful in determining the inhertiance of permissions"),
|
__d('cake', "This command is useful in determining the inhertiance of permissions"),
|
||||||
__("for a certain object in the tree.")
|
__d('cake', "for a certain object in the tree.")
|
||||||
),
|
),
|
||||||
'arguments' => array(
|
'arguments' => array(
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'node' => array(
|
'node' => array(
|
||||||
'help' => __('The node to get the path of'),
|
'help' => __d('cake', 'The node to get the path of'),
|
||||||
'required' => true,
|
'required' => true,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))->addSubcommand('check', array(
|
))->addSubcommand('check', array(
|
||||||
'help' => __('Check the permissions between an ACO and ARO.'),
|
'help' => __d('cake', 'Check the permissions between an ACO and ARO.'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'description' => array(
|
'description' => array(
|
||||||
__("Use this command to grant ACL permissions. Once executed, the ARO "),
|
__d('cake', "Use this command to grant ACL permissions. Once executed, the ARO "),
|
||||||
__("specified (and its children, if any) will have ALLOW access to the"),
|
__d('cake', "specified (and its children, if any) will have ALLOW access to the"),
|
||||||
__("specified ACO action (and the ACO's children, if any).")
|
__d('cake', "specified ACO action (and the ACO's children, if any).")
|
||||||
),
|
),
|
||||||
'arguments' => array(
|
'arguments' => array(
|
||||||
'aro' => array('help' => __('ARO to check.'), 'required' => true),
|
'aro' => array('help' => __d('cake', 'ARO to check.'), 'required' => true),
|
||||||
'aco' => array('help' => __('ACO to check.'), 'required' => true),
|
'aco' => array('help' => __d('cake', 'ACO to check.'), 'required' => true),
|
||||||
'action' => array('help' => __('Action to check'), 'default' => 'all')
|
'action' => array('help' => __d('cake', 'Action to check'), 'default' => 'all')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))->addSubcommand('grant', array(
|
))->addSubcommand('grant', array(
|
||||||
'help' => __('Grant an ARO permissions to an ACO.'),
|
'help' => __d('cake', 'Grant an ARO permissions to an ACO.'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'description' => array(
|
'description' => array(
|
||||||
__("Use this command to grant ACL permissions. Once executed, the ARO"),
|
__d('cake', "Use this command to grant ACL permissions. Once executed, the ARO"),
|
||||||
__("specified (and its children, if any) will have ALLOW access to the"),
|
__d('cake', "specified (and its children, if any) will have ALLOW access to the"),
|
||||||
__("specified ACO action (and the ACO's children, if any).")
|
__d('cake', "specified ACO action (and the ACO's children, if any).")
|
||||||
),
|
),
|
||||||
'arguments' => array(
|
'arguments' => array(
|
||||||
'aro' => array('help' => __('ARO to grant permission to.'), 'required' => true),
|
'aro' => array('help' => __d('cake', 'ARO to grant permission to.'), 'required' => true),
|
||||||
'aco' => array('help' => __('ACO to grant access to.'), 'required' => true),
|
'aco' => array('help' => __d('cake', 'ACO to grant access to.'), 'required' => true),
|
||||||
'action' => array('help' => __('Action to grant'), 'default' => 'all')
|
'action' => array('help' => __d('cake', 'Action to grant'), 'default' => 'all')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))->addSubcommand('deny', array(
|
))->addSubcommand('deny', array(
|
||||||
'help' => __('Deny an ARO permissions to an ACO.'),
|
'help' => __d('cake', 'Deny an ARO permissions to an ACO.'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'description' => array(
|
'description' => array(
|
||||||
__("Use this command to deny ACL permissions. Once executed, the ARO"),
|
__d('cake', "Use this command to deny ACL permissions. Once executed, the ARO"),
|
||||||
__("specified (and its children, if any) will have DENY access to the"),
|
__d('cake', "specified (and its children, if any) will have DENY access to the"),
|
||||||
__("specified ACO action (and the ACO's children, if any).")
|
__d('cake', "specified ACO action (and the ACO's children, if any).")
|
||||||
),
|
),
|
||||||
'arguments' => array(
|
'arguments' => array(
|
||||||
'aro' => array('help' => __('ARO to deny.'), 'required' => true),
|
'aro' => array('help' => __d('cake', 'ARO to deny.'), 'required' => true),
|
||||||
'aco' => array('help' => __('ACO to deny.'), 'required' => true),
|
'aco' => array('help' => __d('cake', 'ACO to deny.'), 'required' => true),
|
||||||
'action' => array('help' => __('Action to deny'), 'default' => 'all')
|
'action' => array('help' => __d('cake', 'Action to deny'), 'default' => 'all')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))->addSubcommand('inherit', array(
|
))->addSubcommand('inherit', array(
|
||||||
'help' => __('Inherit an ARO\'s parent permissions.'),
|
'help' => __d('cake', 'Inherit an ARO\'s parent permissions.'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'description' => array(
|
'description' => array(
|
||||||
__("Use this command to force a child ARO object to inherit its"),
|
__d('cake', "Use this command to force a child ARO object to inherit its"),
|
||||||
__("permissions settings from its parent.")
|
__d('cake', "permissions settings from its parent.")
|
||||||
),
|
),
|
||||||
'arguments' => array(
|
'arguments' => array(
|
||||||
'aro' => array('help' => __('ARO to have permisssions inherit.'), 'required' => true),
|
'aro' => array('help' => __d('cake', 'ARO to have permisssions inherit.'), 'required' => true),
|
||||||
'aco' => array('help' => __('ACO to inherit permissions on.'), 'required' => true),
|
'aco' => array('help' => __d('cake', 'ACO to inherit permissions on.'), 'required' => true),
|
||||||
'action' => array('help' => __('Action to inherit'), 'default' => 'all')
|
'action' => array('help' => __d('cake', 'Action to inherit'), 'default' => 'all')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))->addSubcommand('view', array(
|
))->addSubcommand('view', array(
|
||||||
'help' => __('View a tree or a single node\'s subtree.'),
|
'help' => __d('cake', 'View a tree or a single node\'s subtree.'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'description' => array(
|
'description' => array(
|
||||||
__("The view command will return the ARO or ACO tree."),
|
__d('cake', "The view command will return the ARO or ACO tree."),
|
||||||
__("The optional node parameter allows you to return"),
|
__d('cake', "The optional node parameter allows you to return"),
|
||||||
__("only a portion of the requested tree.")
|
__d('cake', "only a portion of the requested tree.")
|
||||||
),
|
),
|
||||||
'arguments' => array(
|
'arguments' => array(
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'node' => array('help' => __('The optional node to view the subtree of.'))
|
'node' => array('help' => __d('cake', 'The optional node to view the subtree of.'))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))->addSubcommand('initdb', array(
|
))->addSubcommand('initdb', array(
|
||||||
'help' => __('Initialize the DbAcl tables. Uses this command : cake schema run create DbAcl')
|
'help' => __d('cake', 'Initialize the DbAcl tables. Uses this command : cake schema run create DbAcl')
|
||||||
))->epilog(
|
))->epilog(
|
||||||
array(
|
array(
|
||||||
'Node and parent arguments can be in one of the following formats:',
|
'Node and parent arguments can be in one of the following formats:',
|
||||||
|
@ -520,7 +520,7 @@ class AclShell extends Shell {
|
||||||
$conditions = array($class . '.' . $key => $this->args[1]);
|
$conditions = array($class . '.' . $key => $this->args[1]);
|
||||||
$possibility = $this->Acl->{$class}->find('all', compact('conditions'));
|
$possibility = $this->Acl->{$class}->find('all', compact('conditions'));
|
||||||
if (empty($possibility)) {
|
if (empty($possibility)) {
|
||||||
$this->error(__('%s not found', $this->args[1]), __('No tree returned.'));
|
$this->error(__d('cake', '%s not found', $this->args[1]), __d('cake', 'No tree returned.'));
|
||||||
}
|
}
|
||||||
return $possibility;
|
return $possibility;
|
||||||
}
|
}
|
||||||
|
@ -556,7 +556,7 @@ class AclShell extends Shell {
|
||||||
if (is_array($identifier)) {
|
if (is_array($identifier)) {
|
||||||
$identifier = var_export($identifier, true);
|
$identifier = var_export($identifier, true);
|
||||||
}
|
}
|
||||||
$this->error(__('Could not find node using reference "%s"', $identifier));
|
$this->error(__d('cake', 'Could not find node using reference "%s"', $identifier));
|
||||||
}
|
}
|
||||||
return Set::extract($node, "0.{$class}.id");
|
return Set::extract($node, "0.{$class}.id");
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ class ApiShell extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->error(__('%s not found', $class));
|
$this->error(__d('cake', '%s not found', $class));
|
||||||
}
|
}
|
||||||
|
|
||||||
$parsed = $this->__parseClass($path . $class .'.php', $class);
|
$parsed = $this->__parseClass($path . $class .'.php', $class);
|
||||||
|
@ -93,7 +93,7 @@ class ApiShell extends Shell {
|
||||||
if (!empty($parsed)) {
|
if (!empty($parsed)) {
|
||||||
if (isset($this->params['method'])) {
|
if (isset($this->params['method'])) {
|
||||||
if (!isset($parsed[$this->params['method']])) {
|
if (!isset($parsed[$this->params['method']])) {
|
||||||
$this->err(__('%s::%s() could not be found', $class, $this->params['method']));
|
$this->err(__d('cake', '%s::%s() could not be found', $class, $this->params['method']));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
$method = $parsed[$this->params['method']];
|
$method = $parsed[$this->params['method']];
|
||||||
|
@ -110,9 +110,9 @@ class ApiShell extends Shell {
|
||||||
$this->out($list);
|
$this->out($list);
|
||||||
|
|
||||||
$methods = array_keys($parsed);
|
$methods = array_keys($parsed);
|
||||||
while ($number = strtolower($this->in(__('Select a number to see the more information about a specific method. q to quit. l to list.'), null, 'q'))) {
|
while ($number = strtolower($this->in(__d('cake', 'Select a number to see the more information about a specific method. q to quit. l to list.'), null, 'q'))) {
|
||||||
if ($number === 'q') {
|
if ($number === 'q') {
|
||||||
$this->out(__('Done'));
|
$this->out(__d('cake', 'Done'));
|
||||||
return $this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,8 +145,8 @@ class ApiShell extends Shell {
|
||||||
'help' => 'A CakePHP core class name (e.g: Component, HtmlHelper).'
|
'help' => 'A CakePHP core class name (e.g: Component, HtmlHelper).'
|
||||||
))->addOption('method', array(
|
))->addOption('method', array(
|
||||||
'short' => 'm',
|
'short' => 'm',
|
||||||
'help' => __('The specific method you want help on.')
|
'help' => __d('cake', 'The specific method you want help on.')
|
||||||
))->description(__('Lookup doc block comments for classes in CakePHP.'));
|
))->description(__d('cake', 'Lookup doc block comments for classes in CakePHP.'));
|
||||||
return $parser;
|
return $parser;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -199,7 +199,7 @@ class ApiShell extends Shell {
|
||||||
|
|
||||||
if (!class_exists($class)) {
|
if (!class_exists($class)) {
|
||||||
if (!include_once($path)) {
|
if (!include_once($path)) {
|
||||||
$this->err(__('%s could not be found', $path));
|
$this->err(__d('cake', '%s could not be found', $path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ class BakeShell extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config('database')) {
|
if (!config('database')) {
|
||||||
$this->out(__('Your database configuration was not found. Take a moment to create one.'));
|
$this->out(__d('cake', 'Your database configuration was not found. Take a moment to create one.'));
|
||||||
$this->args = null;
|
$this->args = null;
|
||||||
return $this->DbConfig->execute();
|
return $this->DbConfig->execute();
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ class BakeShell extends Shell {
|
||||||
$this->out('[T]est case');
|
$this->out('[T]est case');
|
||||||
$this->out('[Q]uit');
|
$this->out('[Q]uit');
|
||||||
|
|
||||||
$classToBake = strtoupper($this->in(__('What would you like to Bake?'), array('D', 'M', 'V', 'C', 'P', 'F', 'T', 'Q')));
|
$classToBake = strtoupper($this->in(__d('cake', 'What would you like to Bake?'), array('D', 'M', 'V', 'C', 'P', 'F', 'T', 'Q')));
|
||||||
switch ($classToBake) {
|
switch ($classToBake) {
|
||||||
case 'D':
|
case 'D':
|
||||||
$this->DbConfig->execute();
|
$this->DbConfig->execute();
|
||||||
|
@ -117,7 +117,7 @@ class BakeShell extends Shell {
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->out(__('You have made an invalid selection. Please choose a type of class to Bake by entering D, M, V, F, T, or C.'));
|
$this->out(__d('cake', 'You have made an invalid selection. Please choose a type of class to Bake by entering D, M, V, F, T, or C.'));
|
||||||
}
|
}
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->main();
|
$this->main();
|
||||||
|
@ -182,10 +182,10 @@ class BakeShell extends Shell {
|
||||||
$this->View->execute();
|
$this->View->execute();
|
||||||
}
|
}
|
||||||
$this->out('', 1, Shell::QUIET);
|
$this->out('', 1, Shell::QUIET);
|
||||||
$this->out(__('<success>Bake All complete</success>'), 1, Shell::QUIET);
|
$this->out(__d('cake', '<success>Bake All complete</success>'), 1, Shell::QUIET);
|
||||||
array_shift($this->args);
|
array_shift($this->args);
|
||||||
} else {
|
} else {
|
||||||
$this->error(__('Bake All could not continue without a valid model'));
|
$this->error(__d('cake', 'Bake All could not continue without a valid model'));
|
||||||
}
|
}
|
||||||
return $this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
|
@ -203,33 +203,33 @@ class BakeShell extends Shell {
|
||||||
'creation process. You can customize the generation process by telling Bake' .
|
'creation process. You can customize the generation process by telling Bake' .
|
||||||
'where different parts of your application are using command line arguments.'
|
'where different parts of your application are using command line arguments.'
|
||||||
)->addSubcommand('all', array(
|
)->addSubcommand('all', array(
|
||||||
'help' => __('Bake a complete MVC. optional <name> of a Model'),
|
'help' => __d('cake', 'Bake a complete MVC. optional <name> of a Model'),
|
||||||
))->addSubcommand('project', array(
|
))->addSubcommand('project', array(
|
||||||
'help' => __('Bake a new app folder in the path supplied or in current directory if no path is specified'),
|
'help' => __d('cake', 'Bake a new app folder in the path supplied or in current directory if no path is specified'),
|
||||||
'parser' => $this->Project->getOptionParser()
|
'parser' => $this->Project->getOptionParser()
|
||||||
))->addSubcommand('plugin', array(
|
))->addSubcommand('plugin', array(
|
||||||
'help' => __('Bake a new plugin folder in the path supplied or in current directory if no path is specified.'),
|
'help' => __d('cake', 'Bake a new plugin folder in the path supplied or in current directory if no path is specified.'),
|
||||||
'parser' => $this->Plugin->getOptionParser()
|
'parser' => $this->Plugin->getOptionParser()
|
||||||
))->addSubcommand('db_config', array(
|
))->addSubcommand('db_config', array(
|
||||||
'help' => __('Bake a database.php file in config directory.'),
|
'help' => __d('cake', 'Bake a database.php file in config directory.'),
|
||||||
'parser' => $this->DbConfig->getOptionParser()
|
'parser' => $this->DbConfig->getOptionParser()
|
||||||
))->addSubcommand('model', array(
|
))->addSubcommand('model', array(
|
||||||
'help' => __('Bake a model.'),
|
'help' => __d('cake', 'Bake a model.'),
|
||||||
'parser' => $this->Model->getOptionParser()
|
'parser' => $this->Model->getOptionParser()
|
||||||
))->addSubcommand('view', array(
|
))->addSubcommand('view', array(
|
||||||
'help' => __('Bake views for controllers.'),
|
'help' => __d('cake', 'Bake views for controllers.'),
|
||||||
'parser' => $this->View->getOptionParser()
|
'parser' => $this->View->getOptionParser()
|
||||||
))->addSubcommand('controller', array(
|
))->addSubcommand('controller', array(
|
||||||
'help' => __('Bake a controller.'),
|
'help' => __d('cake', 'Bake a controller.'),
|
||||||
'parser' => $this->Controller->getOptionParser()
|
'parser' => $this->Controller->getOptionParser()
|
||||||
))->addSubcommand('fixture', array(
|
))->addSubcommand('fixture', array(
|
||||||
'help' => __('Bake a fixture.'),
|
'help' => __d('cake', 'Bake a fixture.'),
|
||||||
'parser' => $this->Fixture->getOptionParser()
|
'parser' => $this->Fixture->getOptionParser()
|
||||||
))->addSubcommand('test', array(
|
))->addSubcommand('test', array(
|
||||||
'help' => __('Bake a unit test.'),
|
'help' => __d('cake', 'Bake a unit test.'),
|
||||||
'parser' => $this->Test->getOptionParser()
|
'parser' => $this->Test->getOptionParser()
|
||||||
))->addOption('connection', array(
|
))->addOption('connection', array(
|
||||||
'help' => __('Database connection to use in conjunction with `bake all`.'),
|
'help' => __d('cake', 'Database connection to use in conjunction with `bake all`.'),
|
||||||
'short' => 'c',
|
'short' => 'c',
|
||||||
'default' => 'default'
|
'default' => 'default'
|
||||||
));
|
));
|
||||||
|
|
|
@ -214,10 +214,10 @@ class CommandListShell extends Shell {
|
||||||
$parser = parent::getOptionParser();
|
$parser = parent::getOptionParser();
|
||||||
return $parser->description('Get the list of available shells for this CakePHP application.')
|
return $parser->description('Get the list of available shells for this CakePHP application.')
|
||||||
->addOption('xml', array(
|
->addOption('xml', array(
|
||||||
'help' => __('Get the listing as XML.'),
|
'help' => __d('cake', 'Get the listing as XML.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('sort', array(
|
))->addOption('sort', array(
|
||||||
'help' => __('Sorts the commands by where they are located.'),
|
'help' => __d('cake', 'Sorts the commands by where they are located.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ class I18nShell extends Shell {
|
||||||
|
|
||||||
if ($this->command && !in_array($this->command, array('help'))) {
|
if ($this->command && !in_array($this->command, array('help'))) {
|
||||||
if (!config('database')) {
|
if (!config('database')) {
|
||||||
$this->out(__('Your database configuration was not found. Take a moment to create one.'), true);
|
$this->out(__d('cake', 'Your database configuration was not found. Take a moment to create one.'), true);
|
||||||
return $this->DbConfig->execute();
|
return $this->DbConfig->execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,14 +63,14 @@ class I18nShell extends Shell {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function main() {
|
public function main() {
|
||||||
$this->out(__('<info>I18n Shell</info>'));
|
$this->out(__d('cake', '<info>I18n Shell</info>'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('[E]xtract POT file from sources'));
|
$this->out(__d('cake', '[E]xtract POT file from sources'));
|
||||||
$this->out(__('[I]nitialize i18n database table'));
|
$this->out(__d('cake', '[I]nitialize i18n database table'));
|
||||||
$this->out(__('[H]elp'));
|
$this->out(__d('cake', '[H]elp'));
|
||||||
$this->out(__('[Q]uit'));
|
$this->out(__d('cake', '[Q]uit'));
|
||||||
|
|
||||||
$choice = strtolower($this->in(__('What would you like to do?'), array('E', 'I', 'H', 'Q')));
|
$choice = strtolower($this->in(__d('cake', 'What would you like to do?'), array('E', 'I', 'H', 'Q')));
|
||||||
switch ($choice) {
|
switch ($choice) {
|
||||||
case 'e':
|
case 'e':
|
||||||
$this->Extract->execute();
|
$this->Extract->execute();
|
||||||
|
@ -85,7 +85,7 @@ class I18nShell extends Shell {
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->out(__('You have made an invalid selection. Please choose a command to execute by entering E, I, H, or Q.'));
|
$this->out(__d('cake', 'You have made an invalid selection. Please choose a command to execute by entering E, I, H, or Q.'));
|
||||||
}
|
}
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->main();
|
$this->main();
|
||||||
|
@ -107,11 +107,11 @@ class I18nShell extends Shell {
|
||||||
public function getOptionParser() {
|
public function getOptionParser() {
|
||||||
$parser = parent::getOptionParser();
|
$parser = parent::getOptionParser();
|
||||||
return $parser->description(
|
return $parser->description(
|
||||||
__('I18n Shell initializes i18n database table for your application and generates .pot files(s) with translations.')
|
__d('cake', 'I18n Shell initializes i18n database table for your application and generates .pot files(s) with translations.')
|
||||||
)->addSubcommand('initdb', array(
|
)->addSubcommand('initdb', array(
|
||||||
'help' => __('Initialize the i18n table.')
|
'help' => __d('cake', 'Initialize the i18n table.')
|
||||||
))->addSubcommand('extract', array(
|
))->addSubcommand('extract', array(
|
||||||
'help' => __('Extract the po translations from your application'),
|
'help' => __d('cake', 'Extract the po translations from your application'),
|
||||||
'parser' => $this->Extract->getOptionParser()
|
'parser' => $this->Extract->getOptionParser()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ class SchemaShell extends Shell {
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
} else {
|
} else {
|
||||||
$file = $this->Schema->path . DS . $this->params['file'];
|
$file = $this->Schema->path . DS . $this->params['file'];
|
||||||
$this->err(__('Schema file (%s) could not be found.', $file));
|
$this->err(__d('cake', 'Schema file (%s) could not be found.', $file));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class SchemaShell extends Shell {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function generate() {
|
public function generate() {
|
||||||
$this->out(__('Generating Schema...'));
|
$this->out(__d('cake', 'Generating Schema...'));
|
||||||
$options = array();
|
$options = array();
|
||||||
if (isset($this->params['force'])) {
|
if (isset($this->params['force'])) {
|
||||||
$options = array('models' => false);
|
$options = array('models' => false);
|
||||||
|
@ -182,10 +182,10 @@ class SchemaShell extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->Schema->write($content)) {
|
if ($this->Schema->write($content)) {
|
||||||
$this->out(__('Schema file: %s generated', $content['file']));
|
$this->out(__d('cake', 'Schema file: %s generated', $content['file']));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('Schema file: %s generated'));
|
$this->err(__d('cake', 'Schema file: %s generated'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ class SchemaShell extends Shell {
|
||||||
$write = false;
|
$write = false;
|
||||||
$Schema = $this->Schema->load();
|
$Schema = $this->Schema->load();
|
||||||
if (!$Schema) {
|
if (!$Schema) {
|
||||||
$this->err(__('Schema could not be loaded'));
|
$this->err(__d('cake', 'Schema could not be loaded'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
if (!empty($this->params['write'])) {
|
if (!empty($this->params['write'])) {
|
||||||
|
@ -227,10 +227,10 @@ class SchemaShell extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($File->write($contents)) {
|
if ($File->write($contents)) {
|
||||||
$this->out(__('SQL dump file created in %s', $File->pwd()));
|
$this->out(__d('cake', 'SQL dump file created in %s', $File->pwd()));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('SQL dump could not be created'));
|
$this->err(__d('cake', 'SQL dump could not be created'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ class SchemaShell extends Shell {
|
||||||
|
|
||||||
if (!empty($this->params['dry'])) {
|
if (!empty($this->params['dry'])) {
|
||||||
$this->__dry = true;
|
$this->__dry = true;
|
||||||
$this->out(__('Performing a dry run.'));
|
$this->out(__d('cake', 'Performing a dry run.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$options = array('name' => $name, 'plugin' => $plugin);
|
$options = array('name' => $name, 'plugin' => $plugin);
|
||||||
|
@ -286,7 +286,7 @@ class SchemaShell extends Shell {
|
||||||
$Schema = $this->Schema->load($options);
|
$Schema = $this->Schema->load($options);
|
||||||
|
|
||||||
if (!$Schema) {
|
if (!$Schema) {
|
||||||
$this->err(__('%s could not be loaded', $this->Schema->path . DS . $this->Schema->file));
|
$this->err(__d('cake', '%s could not be loaded', $this->Schema->path . DS . $this->Schema->file));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
$table = null;
|
$table = null;
|
||||||
|
@ -317,26 +317,26 @@ class SchemaShell extends Shell {
|
||||||
$create[$table] = $db->createSchema($Schema, $table);
|
$create[$table] = $db->createSchema($Schema, $table);
|
||||||
}
|
}
|
||||||
if (empty($drop) || empty($create)) {
|
if (empty($drop) || empty($create)) {
|
||||||
$this->out(__('Schema is up to date.'));
|
$this->out(__d('cake', 'Schema is up to date.'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out("\n" . __('The following table(s) will be dropped.'));
|
$this->out("\n" . __d('cake', 'The following table(s) will be dropped.'));
|
||||||
$this->out(array_keys($drop));
|
$this->out(array_keys($drop));
|
||||||
|
|
||||||
if ('y' == $this->in(__('Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n')) {
|
if ('y' == $this->in(__d('cake', 'Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n')) {
|
||||||
$this->out(__('Dropping table(s).'));
|
$this->out(__d('cake', 'Dropping table(s).'));
|
||||||
$this->__run($drop, 'drop', $Schema);
|
$this->__run($drop, 'drop', $Schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out("\n" . __('The following table(s) will be created.'));
|
$this->out("\n" . __d('cake', 'The following table(s) will be created.'));
|
||||||
$this->out(array_keys($create));
|
$this->out(array_keys($create));
|
||||||
|
|
||||||
if ('y' == $this->in(__('Are you sure you want to create the table(s)?'), array('y', 'n'), 'y')) {
|
if ('y' == $this->in(__d('cake', 'Are you sure you want to create the table(s)?'), array('y', 'n'), 'y')) {
|
||||||
$this->out(__('Creating table(s).'));
|
$this->out(__d('cake', 'Creating table(s).'));
|
||||||
$this->__run($create, 'create', $Schema);
|
$this->__run($create, 'create', $Schema);
|
||||||
}
|
}
|
||||||
$this->out(__('End create.'));
|
$this->out(__d('cake', 'End create.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -348,7 +348,7 @@ class SchemaShell extends Shell {
|
||||||
function __update(&$Schema, $table = null) {
|
function __update(&$Schema, $table = null) {
|
||||||
$db = ConnectionManager::getDataSource($this->Schema->connection);
|
$db = ConnectionManager::getDataSource($this->Schema->connection);
|
||||||
|
|
||||||
$this->out(__('Comparing Database to Schema...'));
|
$this->out(__d('cake', 'Comparing Database to Schema...'));
|
||||||
$options = array();
|
$options = array();
|
||||||
if (isset($this->params['force'])) {
|
if (isset($this->params['force'])) {
|
||||||
$options['models'] = false;
|
$options['models'] = false;
|
||||||
|
@ -367,19 +367,19 @@ class SchemaShell extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($contents)) {
|
if (empty($contents)) {
|
||||||
$this->out(__('Schema is up to date.'));
|
$this->out(__d('cake', 'Schema is up to date.'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out("\n" . __('The following statements will run.'));
|
$this->out("\n" . __d('cake', 'The following statements will run.'));
|
||||||
$this->out(array_map('trim', $contents));
|
$this->out(array_map('trim', $contents));
|
||||||
if ('y' == $this->in(__('Are you sure you want to alter the tables?'), array('y', 'n'), 'n')) {
|
if ('y' == $this->in(__d('cake', 'Are you sure you want to alter the tables?'), array('y', 'n'), 'n')) {
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out(__('Updating Database...'));
|
$this->out(__d('cake', 'Updating Database...'));
|
||||||
$this->__run($contents, 'update', $Schema);
|
$this->__run($contents, 'update', $Schema);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out(__('End update.'));
|
$this->out(__d('cake', 'End update.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -389,7 +389,7 @@ class SchemaShell extends Shell {
|
||||||
*/
|
*/
|
||||||
function __run($contents, $event, &$Schema) {
|
function __run($contents, $event, &$Schema) {
|
||||||
if (empty($contents)) {
|
if (empty($contents)) {
|
||||||
$this->err(__('Sql could not be run'));
|
$this->err(__d('cake', 'Sql could not be run'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Configure::write('debug', 2);
|
Configure::write('debug', 2);
|
||||||
|
@ -397,10 +397,10 @@ class SchemaShell extends Shell {
|
||||||
|
|
||||||
foreach ($contents as $table => $sql) {
|
foreach ($contents as $table => $sql) {
|
||||||
if (empty($sql)) {
|
if (empty($sql)) {
|
||||||
$this->out(__('%s is up to date.', $table));
|
$this->out(__d('cake', '%s is up to date.', $table));
|
||||||
} else {
|
} else {
|
||||||
if ($this->__dry === true) {
|
if ($this->__dry === true) {
|
||||||
$this->out(__('Dry run for %s :', $table));
|
$this->out(__d('cake', 'Dry run for %s :', $table));
|
||||||
$this->out($sql);
|
$this->out($sql);
|
||||||
} else {
|
} else {
|
||||||
if (!$Schema->before(array($event => $table))) {
|
if (!$Schema->before(array($event => $table))) {
|
||||||
|
@ -416,7 +416,7 @@ class SchemaShell extends Shell {
|
||||||
if (!empty($error)) {
|
if (!empty($error)) {
|
||||||
$this->out($error);
|
$this->out($error);
|
||||||
} else {
|
} else {
|
||||||
$this->out(__('%s updated.', $table));
|
$this->out(__d('cake', '%s updated.', $table));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -430,26 +430,26 @@ class SchemaShell extends Shell {
|
||||||
*/
|
*/
|
||||||
public function getOptionParser() {
|
public function getOptionParser() {
|
||||||
$plugin = array(
|
$plugin = array(
|
||||||
'help' => __('The plugin to use.'),
|
'help' => __d('cake', 'The plugin to use.'),
|
||||||
);
|
);
|
||||||
$connection = array(
|
$connection = array(
|
||||||
'help' => __('Set the db config to use.'),
|
'help' => __d('cake', 'Set the db config to use.'),
|
||||||
'default' => 'default'
|
'default' => 'default'
|
||||||
);
|
);
|
||||||
$path = array(
|
$path = array(
|
||||||
'help' => __('Path to read and write schema.php'),
|
'help' => __d('cake', 'Path to read and write schema.php'),
|
||||||
'default' => CONFIGS . 'schema'
|
'default' => CONFIGS . 'schema'
|
||||||
);
|
);
|
||||||
$file = array(
|
$file = array(
|
||||||
'help' => __('File name to read and write.'),
|
'help' => __d('cake', 'File name to read and write.'),
|
||||||
'default' => 'schema.php'
|
'default' => 'schema.php'
|
||||||
);
|
);
|
||||||
$name = array(
|
$name = array(
|
||||||
'help' => __('Classname to use. If its Plugin.class, both name and plugin options will be set.')
|
'help' => __d('cake', 'Classname to use. If its Plugin.class, both name and plugin options will be set.')
|
||||||
);
|
);
|
||||||
$snapshot = array(
|
$snapshot = array(
|
||||||
'short' => 's',
|
'short' => 's',
|
||||||
'help' => __('Snapshot number to use/make.')
|
'help' => __d('cake', 'Snapshot number to use/make.')
|
||||||
);
|
);
|
||||||
$dry = array(
|
$dry = array(
|
||||||
'help' => 'Perform a dry run on create and update commands. Queries will be output instead of run.',
|
'help' => 'Perform a dry run on create and update commands. Queries will be output instead of run.',
|
||||||
|
@ -457,11 +457,11 @@ class SchemaShell extends Shell {
|
||||||
);
|
);
|
||||||
$force = array(
|
$force = array(
|
||||||
'short' => 'f',
|
'short' => 'f',
|
||||||
'help' => __('Force "generate" to create a new schema'),
|
'help' => __d('cake', 'Force "generate" to create a new schema'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
);
|
);
|
||||||
$write = array(
|
$write = array(
|
||||||
'help' => __('Write the dumped SQL to a file.')
|
'help' => __d('cake', 'Write the dumped SQL to a file.')
|
||||||
);
|
);
|
||||||
|
|
||||||
$parser = parent::getOptionParser();
|
$parser = parent::getOptionParser();
|
||||||
|
@ -475,42 +475,42 @@ class SchemaShell extends Shell {
|
||||||
'arguments' => compact('name')
|
'arguments' => compact('name')
|
||||||
)
|
)
|
||||||
))->addSubcommand('generate', array(
|
))->addSubcommand('generate', array(
|
||||||
'help' => __('Reads from --connection and writes to --path. Generate snapshots with -s'),
|
'help' => __d('cake', 'Reads from --connection and writes to --path. Generate snapshots with -s'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'options' => compact('plugin', 'path', 'file', 'name', 'connection', 'snapshot', 'force'),
|
'options' => compact('plugin', 'path', 'file', 'name', 'connection', 'snapshot', 'force'),
|
||||||
'arguments' => array(
|
'arguments' => array(
|
||||||
'snapshot' => array('help' => __('Generate a snapshot.'))
|
'snapshot' => array('help' => __d('cake', 'Generate a snapshot.'))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))->addSubcommand('dump', array(
|
))->addSubcommand('dump', array(
|
||||||
'help' => __('Dump database SQL based on a schema file to stdout.'),
|
'help' => __d('cake', 'Dump database SQL based on a schema file to stdout.'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'options' => compact('plugin', 'path', 'file', 'name', 'connection'),
|
'options' => compact('plugin', 'path', 'file', 'name', 'connection'),
|
||||||
'arguments' => compact('name')
|
'arguments' => compact('name')
|
||||||
)
|
)
|
||||||
))->addSubcommand('create', array(
|
))->addSubcommand('create', array(
|
||||||
'help' => __('Drop and create tables based on the schema file.'),
|
'help' => __d('cake', 'Drop and create tables based on the schema file.'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'options' => compact('plugin', 'path', 'file', 'name', 'connection', 'dry', 'snapshot'),
|
'options' => compact('plugin', 'path', 'file', 'name', 'connection', 'dry', 'snapshot'),
|
||||||
'args' => array(
|
'args' => array(
|
||||||
'name' => array(
|
'name' => array(
|
||||||
'help' => __('Name of schema to use.')
|
'help' => __d('cake', 'Name of schema to use.')
|
||||||
),
|
),
|
||||||
'table' => array(
|
'table' => array(
|
||||||
'help' => __('Only create the specified table.')
|
'help' => __d('cake', 'Only create the specified table.')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
))->addSubcommand('update', array(
|
))->addSubcommand('update', array(
|
||||||
'help' => __('Alter the tables based on the schema file.'),
|
'help' => __d('cake', 'Alter the tables based on the schema file.'),
|
||||||
'parser' => array(
|
'parser' => array(
|
||||||
'options' => compact('plugin', 'path', 'file', 'name', 'connection', 'dry', 'snapshot'),
|
'options' => compact('plugin', 'path', 'file', 'name', 'connection', 'dry', 'snapshot'),
|
||||||
'args' => array(
|
'args' => array(
|
||||||
'name' => array(
|
'name' => array(
|
||||||
'help' => __('Name of schema to use.')
|
'help' => __d('cake', 'Name of schema to use.')
|
||||||
),
|
),
|
||||||
'table' => array(
|
'table' => array(
|
||||||
'help' => __('Only create the specified table.')
|
'help' => __d('cake', 'Only create the specified table.')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -71,13 +71,13 @@ class ControllerTask extends BakeTask {
|
||||||
$actions = '';
|
$actions = '';
|
||||||
|
|
||||||
if (!empty($this->params['public'])) {
|
if (!empty($this->params['public'])) {
|
||||||
$this->out(__('Baking basic crud methods for ') . $controller);
|
$this->out(__d('cake', 'Baking basic crud methods for ') . $controller);
|
||||||
$actions .= $this->bakeActions($controller);
|
$actions .= $this->bakeActions($controller);
|
||||||
}
|
}
|
||||||
if (!empty($this->params['admin'])) {
|
if (!empty($this->params['admin'])) {
|
||||||
$admin = $this->Project->getPrefix();
|
$admin = $this->Project->getPrefix();
|
||||||
if ($admin) {
|
if ($admin) {
|
||||||
$this->out(__('Adding %s methods', $admin));
|
$this->out(__d('cake', 'Adding %s methods', $admin));
|
||||||
$actions .= "\n" . $this->bakeActions($controller, $admin);
|
$actions .= "\n" . $this->bakeActions($controller, $admin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ class ControllerTask extends BakeTask {
|
||||||
protected function _interactive() {
|
protected function _interactive() {
|
||||||
$this->interactive = true;
|
$this->interactive = true;
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__("Bake Controller\nPath: %s", $this->path));
|
$this->out(__d('cake', "Bake Controller\nPath: %s", $this->path));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
|
|
||||||
if (empty($this->connection)) {
|
if (empty($this->connection)) {
|
||||||
|
@ -133,7 +133,7 @@ class ControllerTask extends BakeTask {
|
||||||
|
|
||||||
$controllerName = $this->getName();
|
$controllerName = $this->getName();
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('Baking %sController', $controllerName));
|
$this->out(__d('cake', 'Baking %sController', $controllerName));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
|
|
||||||
$helpers = $components = array();
|
$helpers = $components = array();
|
||||||
|
@ -145,16 +145,16 @@ class ControllerTask extends BakeTask {
|
||||||
|
|
||||||
$controllerFile = strtolower(Inflector::underscore($controllerName));
|
$controllerFile = strtolower(Inflector::underscore($controllerName));
|
||||||
|
|
||||||
$question[] = __("Would you like to build your controller interactively?");
|
$question[] = __d('cake', "Would you like to build your controller interactively?");
|
||||||
if (file_exists($this->path . $controllerFile .'_controller.php')) {
|
if (file_exists($this->path . $controllerFile .'_controller.php')) {
|
||||||
$question[] = __("Warning: Choosing no will overwrite the %sController.", $controllerName);
|
$question[] = __d('cake', "Warning: Choosing no will overwrite the %sController.", $controllerName);
|
||||||
}
|
}
|
||||||
$doItInteractive = $this->in(implode("\n", $question), array('y','n'), 'y');
|
$doItInteractive = $this->in(implode("\n", $question), array('y','n'), 'y');
|
||||||
|
|
||||||
if (strtolower($doItInteractive) == 'y') {
|
if (strtolower($doItInteractive) == 'y') {
|
||||||
$this->interactive = true;
|
$this->interactive = true;
|
||||||
$useDynamicScaffold = $this->in(
|
$useDynamicScaffold = $this->in(
|
||||||
__("Would you like to use dynamic scaffolding?"), array('y','n'), 'n'
|
__d('cake', "Would you like to use dynamic scaffolding?"), array('y','n'), 'n'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (strtolower($useDynamicScaffold) == 'y') {
|
if (strtolower($useDynamicScaffold) == 'y') {
|
||||||
|
@ -167,7 +167,7 @@ class ControllerTask extends BakeTask {
|
||||||
$components = $this->doComponents();
|
$components = $this->doComponents();
|
||||||
|
|
||||||
$wannaUseSession = $this->in(
|
$wannaUseSession = $this->in(
|
||||||
__("Would you like to use Session flash messages?"), array('y','n'), 'y'
|
__d('cake', "Would you like to use Session flash messages?"), array('y','n'), 'y'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -185,7 +185,7 @@ class ControllerTask extends BakeTask {
|
||||||
$baked = false;
|
$baked = false;
|
||||||
if ($this->interactive === true) {
|
if ($this->interactive === true) {
|
||||||
$this->confirmController($controllerName, $useDynamicScaffold, $helpers, $components);
|
$this->confirmController($controllerName, $useDynamicScaffold, $helpers, $components);
|
||||||
$looksGood = $this->in(__('Look okay?'), array('y','n'), 'y');
|
$looksGood = $this->in(__d('cake', 'Look okay?'), array('y','n'), 'y');
|
||||||
|
|
||||||
if (strtolower($looksGood) == 'y') {
|
if (strtolower($looksGood) == 'y') {
|
||||||
$baked = $this->bake($controllerName, $actions, $helpers, $components);
|
$baked = $this->bake($controllerName, $actions, $helpers, $components);
|
||||||
|
@ -210,17 +210,17 @@ class ControllerTask extends BakeTask {
|
||||||
public function confirmController($controllerName, $useDynamicScaffold, $helpers, $components) {
|
public function confirmController($controllerName, $useDynamicScaffold, $helpers, $components) {
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('The following controller will be created:'));
|
$this->out(__d('cake', 'The following controller will be created:'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__("Controller Name:\n\t%s", $controllerName));
|
$this->out(__d('cake', "Controller Name:\n\t%s", $controllerName));
|
||||||
|
|
||||||
if (strtolower($useDynamicScaffold) == 'y') {
|
if (strtolower($useDynamicScaffold) == 'y') {
|
||||||
$this->out("var \$scaffold;");
|
$this->out("var \$scaffold;");
|
||||||
}
|
}
|
||||||
|
|
||||||
$properties = array(
|
$properties = array(
|
||||||
'helpers' => __('Helpers:'),
|
'helpers' => __d('cake', 'Helpers:'),
|
||||||
'components' => __('Components:'),
|
'components' => __d('cake', 'Components:'),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($properties as $var => $title) {
|
foreach ($properties as $var => $title) {
|
||||||
|
@ -247,11 +247,11 @@ class ControllerTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
protected function _askAboutMethods() {
|
protected function _askAboutMethods() {
|
||||||
$wannaBakeCrud = $this->in(
|
$wannaBakeCrud = $this->in(
|
||||||
__("Would you like to create some basic class methods \n(index(), add(), view(), edit())?"),
|
__d('cake', "Would you like to create some basic class methods \n(index(), add(), view(), edit())?"),
|
||||||
array('y','n'), 'n'
|
array('y','n'), 'n'
|
||||||
);
|
);
|
||||||
$wannaBakeAdminCrud = $this->in(
|
$wannaBakeAdminCrud = $this->in(
|
||||||
__("Would you like to create the basic class methods for admin routing?"),
|
__d('cake', "Would you like to create the basic class methods for admin routing?"),
|
||||||
array('y','n'), 'n'
|
array('y','n'), 'n'
|
||||||
);
|
);
|
||||||
return array($wannaBakeCrud, $wannaBakeAdminCrud);
|
return array($wannaBakeCrud, $wannaBakeAdminCrud);
|
||||||
|
@ -274,7 +274,7 @@ class ControllerTask extends BakeTask {
|
||||||
}
|
}
|
||||||
App::uses($modelImport, $plugin . 'Model');
|
App::uses($modelImport, $plugin . 'Model');
|
||||||
if (!class_exists($modelImport)) {
|
if (!class_exists($modelImport)) {
|
||||||
$this->err(__('You must have a model for this class to build basic methods. Please try again.'));
|
$this->err(__d('cake', 'You must have a model for this class to build basic methods. Please try again.'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,8 +342,8 @@ class ControllerTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
public function doHelpers() {
|
public function doHelpers() {
|
||||||
return $this->_doPropertyChoices(
|
return $this->_doPropertyChoices(
|
||||||
__("Would you like this controller to use other helpers\nbesides HtmlHelper and FormHelper?"),
|
__d('cake', "Would you like this controller to use other helpers\nbesides HtmlHelper and FormHelper?"),
|
||||||
__("Please provide a comma separated list of the other\nhelper names you'd like to use.\nExample: 'Ajax, Javascript, Time'")
|
__d('cake', "Please provide a comma separated list of the other\nhelper names you'd like to use.\nExample: 'Ajax, Javascript, Time'")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,8 +354,8 @@ class ControllerTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
public function doComponents() {
|
public function doComponents() {
|
||||||
return $this->_doPropertyChoices(
|
return $this->_doPropertyChoices(
|
||||||
__("Would you like this controller to use any components?"),
|
__d('cake', "Would you like this controller to use any components?"),
|
||||||
__("Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'")
|
__d('cake', "Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ class ControllerTask extends BakeTask {
|
||||||
$this->__tables = $this->Model->getAllTables($useDbConfig);
|
$this->__tables = $this->Model->getAllTables($useDbConfig);
|
||||||
|
|
||||||
if ($this->interactive == true) {
|
if ($this->interactive == true) {
|
||||||
$this->out(__('Possible Controllers based on your current database:'));
|
$this->out(__d('cake', 'Possible Controllers based on your current database:'));
|
||||||
$this->_controllerNames = array();
|
$this->_controllerNames = array();
|
||||||
$count = count($this->__tables);
|
$count = count($this->__tables);
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
@ -414,14 +414,14 @@ class ControllerTask extends BakeTask {
|
||||||
$enteredController = '';
|
$enteredController = '';
|
||||||
|
|
||||||
while ($enteredController == '') {
|
while ($enteredController == '') {
|
||||||
$enteredController = $this->in(__("Enter a number from the list above,\ntype in the name of another controller, or 'q' to exit"), null, 'q');
|
$enteredController = $this->in(__d('cake', "Enter a number from the list above,\ntype in the name of another controller, or 'q' to exit"), null, 'q');
|
||||||
if ($enteredController === 'q') {
|
if ($enteredController === 'q') {
|
||||||
$this->out(__('Exit'));
|
$this->out(__d('cake', 'Exit'));
|
||||||
return $this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($enteredController == '' || intval($enteredController) > count($controllers)) {
|
if ($enteredController == '' || intval($enteredController) > count($controllers)) {
|
||||||
$this->err(__("The Controller name you supplied was empty,\nor the number you selected was not an option. Please try again."));
|
$this->err(__d('cake', "The Controller name you supplied was empty,\nor the number you selected was not an option. Please try again."));
|
||||||
$enteredController = '';
|
$enteredController = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,24 +442,24 @@ class ControllerTask extends BakeTask {
|
||||||
public function getOptionParser() {
|
public function getOptionParser() {
|
||||||
$parser = parent::getOptionParser();
|
$parser = parent::getOptionParser();
|
||||||
return $parser->description(
|
return $parser->description(
|
||||||
__('Bake a controller for a model. Using options you can bake public, admin or both.')
|
__d('cake', 'Bake a controller for a model. Using options you can bake public, admin or both.')
|
||||||
)->addArgument('name', array(
|
)->addArgument('name', array(
|
||||||
'help' => __('Name of the controller to bake. Can use Plugin.name to bake controllers into plugins.')
|
'help' => __d('cake', 'Name of the controller to bake. Can use Plugin.name to bake controllers into plugins.')
|
||||||
))->addOption('public', array(
|
))->addOption('public', array(
|
||||||
'help' => __('Bake a controller with basic crud actions (index, view, add, edit, delete).'),
|
'help' => __d('cake', 'Bake a controller with basic crud actions (index, view, add, edit, delete).'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('admin', array(
|
))->addOption('admin', array(
|
||||||
'help' => __('Bake a controller with crud actions for one of the Routing.prefixes.'),
|
'help' => __d('cake', 'Bake a controller with crud actions for one of the Routing.prefixes.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('plugin', array(
|
))->addOption('plugin', array(
|
||||||
'short' => 'p',
|
'short' => 'p',
|
||||||
'help' => __('Plugin to bake the controller into.')
|
'help' => __d('cake', 'Plugin to bake the controller into.')
|
||||||
))->addOption('connection', array(
|
))->addOption('connection', array(
|
||||||
'short' => 'c',
|
'short' => 'c',
|
||||||
'help' => __('The connection the controller\'s model is on.')
|
'help' => __d('cake', 'The connection the controller\'s model is on.')
|
||||||
))->addSubcommand('all', array(
|
))->addSubcommand('all', array(
|
||||||
'help' => __('Bake all controllers with CRUD methods.')
|
'help' => __d('cake', 'Bake all controllers with CRUD methods.')
|
||||||
))->epilog(__('Omitting all arguments and options will enter into an interactive mode.'));
|
))->epilog(__d('cake', 'Omitting all arguments and options will enter into an interactive mode.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -361,7 +361,7 @@ class DbConfigTask extends Shell {
|
||||||
|
|
||||||
$connections = array_keys($configs);
|
$connections = array_keys($configs);
|
||||||
if (count($connections) > 1) {
|
if (count($connections) > 1) {
|
||||||
$useDbConfig = $this->in(__('Use Database Config') .':', $connections, 'default');
|
$useDbConfig = $this->in(__d('cake', 'Use Database Config') .':', $connections, 'default');
|
||||||
}
|
}
|
||||||
return $useDbConfig;
|
return $useDbConfig;
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ class DbConfigTask extends Shell {
|
||||||
public function getOptionParser() {
|
public function getOptionParser() {
|
||||||
$parser = parent::getOptionParser();
|
$parser = parent::getOptionParser();
|
||||||
return $parser->description(
|
return $parser->description(
|
||||||
__('Bake new database configuration settings.')
|
__d('cake', 'Bake new database configuration settings.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,11 +112,11 @@ class ExtractTask extends Shell {
|
||||||
$this->__paths = explode(',', $this->params['paths']);
|
$this->__paths = explode(',', $this->params['paths']);
|
||||||
} else {
|
} else {
|
||||||
$defaultPath = APP_PATH;
|
$defaultPath = APP_PATH;
|
||||||
$message = __("What is the full path you would like to extract?\nExample: %s\n[Q]uit [D]one", $defaultPath);
|
$message = __d('cake', "What is the full path you would like to extract?\nExample: %s\n[Q]uit [D]one", $defaultPath);
|
||||||
while (true) {
|
while (true) {
|
||||||
$response = $this->in($message, null, $defaultPath);
|
$response = $this->in($message, null, $defaultPath);
|
||||||
if (strtoupper($response) === 'Q') {
|
if (strtoupper($response) === 'Q') {
|
||||||
$this->out(__('Extract Aborted'));
|
$this->out(__d('cake', 'Extract Aborted'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
} elseif (strtoupper($response) === 'D') {
|
} elseif (strtoupper($response) === 'D') {
|
||||||
$this->out();
|
$this->out();
|
||||||
|
@ -125,7 +125,7 @@ class ExtractTask extends Shell {
|
||||||
$this->__paths[] = $response;
|
$this->__paths[] = $response;
|
||||||
$defaultPath = 'D';
|
$defaultPath = 'D';
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('The directory path you supplied was not found. Please try again.'));
|
$this->err(__d('cake', 'The directory path you supplied was not found. Please try again.'));
|
||||||
}
|
}
|
||||||
$this->out();
|
$this->out();
|
||||||
}
|
}
|
||||||
|
@ -134,17 +134,17 @@ class ExtractTask extends Shell {
|
||||||
if (isset($this->params['output'])) {
|
if (isset($this->params['output'])) {
|
||||||
$this->__output = $this->params['output'];
|
$this->__output = $this->params['output'];
|
||||||
} else {
|
} else {
|
||||||
$message = __("What is the full path you would like to output?\nExample: %s\n[Q]uit", $this->__paths[0] . DS . 'locale');
|
$message = __d('cake', "What is the full path you would like to output?\nExample: %s\n[Q]uit", $this->__paths[0] . DS . 'locale');
|
||||||
while (true) {
|
while (true) {
|
||||||
$response = $this->in($message, null, $this->__paths[0] . DS . 'locale');
|
$response = $this->in($message, null, $this->__paths[0] . DS . 'locale');
|
||||||
if (strtoupper($response) === 'Q') {
|
if (strtoupper($response) === 'Q') {
|
||||||
$this->out(__('Extract Aborted'));
|
$this->out(__d('cake', 'Extract Aborted'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
} elseif (is_dir($response)) {
|
} elseif (is_dir($response)) {
|
||||||
$this->__output = $response . DS;
|
$this->__output = $response . DS;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('The directory path you supplied was not found. Please try again.'));
|
$this->err(__d('cake', 'The directory path you supplied was not found. Please try again.'));
|
||||||
}
|
}
|
||||||
$this->out();
|
$this->out();
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ class ExtractTask extends Shell {
|
||||||
$this->__merge = !(strtolower($this->params['merge']) === 'no');
|
$this->__merge = !(strtolower($this->params['merge']) === 'no');
|
||||||
} else {
|
} else {
|
||||||
$this->out();
|
$this->out();
|
||||||
$response = $this->in(__('Would you like to merge all domains strings into the default.pot file?'), array('y', 'n'), 'n');
|
$response = $this->in(__d('cake', 'Would you like to merge all domains strings into the default.pot file?'), array('y', 'n'), 'n');
|
||||||
$this->__merge = strtolower($response) === 'y';
|
$this->__merge = strtolower($response) === 'y';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,13 +173,13 @@ class ExtractTask extends Shell {
|
||||||
function __extract() {
|
function __extract() {
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out(__('Extracting...'));
|
$this->out(__d('cake', 'Extracting...'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('Paths:'));
|
$this->out(__d('cake', 'Paths:'));
|
||||||
foreach ($this->__paths as $path) {
|
foreach ($this->__paths as $path) {
|
||||||
$this->out(' ' . $path);
|
$this->out(' ' . $path);
|
||||||
}
|
}
|
||||||
$this->out(__('Output Directory: ') . $this->__output);
|
$this->out(__d('cake', 'Output Directory: ') . $this->__output);
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->__extractTokens();
|
$this->__extractTokens();
|
||||||
$this->__buildFiles();
|
$this->__buildFiles();
|
||||||
|
@ -187,7 +187,7 @@ class ExtractTask extends Shell {
|
||||||
$this->__paths = $this->__files = $this->__storage = array();
|
$this->__paths = $this->__files = $this->__storage = array();
|
||||||
$this->__strings = $this->__tokens = array();
|
$this->__strings = $this->__tokens = array();
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out(__('Done.'));
|
$this->out(__d('cake', 'Done.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,17 +197,17 @@ class ExtractTask extends Shell {
|
||||||
*/
|
*/
|
||||||
public function getOptionParser() {
|
public function getOptionParser() {
|
||||||
$parser = parent::getOptionParser();
|
$parser = parent::getOptionParser();
|
||||||
return $parser->description(__('CakePHP Language String Extraction:'))
|
return $parser->description(__d('cake', 'CakePHP Language String Extraction:'))
|
||||||
->addOption('app', array('help' => __('Directory where your application is located.')))
|
->addOption('app', array('help' => __d('cake', 'Directory where your application is located.')))
|
||||||
->addOption('paths', array('help' => __('Comma separted list of paths, full paths are needed.')))
|
->addOption('paths', array('help' => __d('cake', 'Comma separted list of paths, full paths are needed.')))
|
||||||
->addOption('merge', array(
|
->addOption('merge', array(
|
||||||
'help' => __('Merge all domain strings into the default.po file.'),
|
'help' => __d('cake', 'Merge all domain strings into the default.po file.'),
|
||||||
'choices' => array('yes', 'no')
|
'choices' => array('yes', 'no')
|
||||||
))
|
))
|
||||||
->addOption('output', array('help' => __('Full path to output directory.')))
|
->addOption('output', array('help' => __d('cake', 'Full path to output directory.')))
|
||||||
->addOption('files', array('help' => __('Comma separated list of files, full paths are needed.')))
|
->addOption('files', array('help' => __d('cake', 'Comma separated list of files, full paths are needed.')))
|
||||||
->addOption('exclude', array(
|
->addOption('exclude', array(
|
||||||
'help' => __('Comma separated list of directories to exclude. Any path containing a path segment with the provided values will be skipped. E.g. test,vendors')
|
'help' => __d('cake', 'Comma separated list of directories to exclude. Any path containing a path segment with the provided values will be skipped. E.g. test,vendors')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,25 +217,25 @@ class ExtractTask extends Shell {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function help() {
|
public function help() {
|
||||||
$this->out(__('CakePHP Language String Extraction:'));
|
$this->out(__d('cake', 'CakePHP Language String Extraction:'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('The Extract script generates .pot file(s) with translations'));
|
$this->out(__d('cake', 'The Extract script generates .pot file(s) with translations'));
|
||||||
$this->out(__('By default the .pot file(s) will be place in the locale directory of -app'));
|
$this->out(__d('cake', 'By default the .pot file(s) will be place in the locale directory of -app'));
|
||||||
$this->out(__('By default -app is ROOT/app'));
|
$this->out(__d('cake', 'By default -app is ROOT/app'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('Usage: cake i18n extract <command> <param1> <param2>...'));
|
$this->out(__d('cake', 'Usage: cake i18n extract <command> <param1> <param2>...'));
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out(__('Params:'));
|
$this->out(__d('cake', 'Params:'));
|
||||||
$this->out(__(' -app [path...]: directory where your application is located'));
|
$this->out(__d('cake', ' -app [path...]: directory where your application is located'));
|
||||||
$this->out(__(' -root [path...]: path to install'));
|
$this->out(__d('cake', ' -root [path...]: path to install'));
|
||||||
$this->out(__(' -core [path...]: path to cake directory'));
|
$this->out(__d('cake', ' -core [path...]: path to cake directory'));
|
||||||
$this->out(__(' -paths [comma separated list of paths, full path is needed]'));
|
$this->out(__d('cake', ' -paths [comma separated list of paths, full path is needed]'));
|
||||||
$this->out(__(' -merge [yes|no]: Merge all domains strings into the default.pot file'));
|
$this->out(__d('cake', ' -merge [yes|no]: Merge all domains strings into the default.pot file'));
|
||||||
$this->out(__(' -output [path...]: Full path to output directory'));
|
$this->out(__d('cake', ' -output [path...]: Full path to output directory'));
|
||||||
$this->out(__(' -files: [comma separated list of files, full path to file is needed]'));
|
$this->out(__d('cake', ' -files: [comma separated list of files, full path to file is needed]'));
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out(__('Commands:'));
|
$this->out(__d('cake', 'Commands:'));
|
||||||
$this->out(__(' cake i18n extract help: Shows this help message.'));
|
$this->out(__d('cake', ' cake i18n extract help: Shows this help message.'));
|
||||||
$this->out();
|
$this->out();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ class ExtractTask extends Shell {
|
||||||
function __extractTokens() {
|
function __extractTokens() {
|
||||||
foreach ($this->__files as $file) {
|
foreach ($this->__files as $file) {
|
||||||
$this->__file = $file;
|
$this->__file = $file;
|
||||||
$this->out(__('Processing %s...', $file));
|
$this->out(__d('cake', 'Processing %s...', $file));
|
||||||
|
|
||||||
$code = file_get_contents($file);
|
$code = file_get_contents($file);
|
||||||
$allTokens = token_get_all($code);
|
$allTokens = token_get_all($code);
|
||||||
|
@ -411,11 +411,11 @@ class ExtractTask extends Shell {
|
||||||
$response = '';
|
$response = '';
|
||||||
while ($overwriteAll === false && $File->exists() && strtoupper($response) !== 'Y') {
|
while ($overwriteAll === false && $File->exists() && strtoupper($response) !== 'Y') {
|
||||||
$this->out();
|
$this->out();
|
||||||
$response = $this->in(__('Error: %s already exists in this location. Overwrite? [Y]es, [N]o, [A]ll', $filename), array('y', 'n', 'a'), 'y');
|
$response = $this->in(__d('cake', 'Error: %s already exists in this location. Overwrite? [Y]es, [N]o, [A]ll', $filename), array('y', 'n', 'a'), 'y');
|
||||||
if (strtoupper($response) === 'N') {
|
if (strtoupper($response) === 'N') {
|
||||||
$response = '';
|
$response = '';
|
||||||
while ($response == '') {
|
while ($response == '') {
|
||||||
$response = $this->in(__("What would you like to name this file?\nExample: %s", 'new_' . $filename), null, 'new_' . $filename);
|
$response = $this->in(__d('cake', "What would you like to name this file?\nExample: %s", 'new_' . $filename), null, 'new_' . $filename);
|
||||||
$File = new File($this->__output . $response);
|
$File = new File($this->__output . $response);
|
||||||
$filename = $response;
|
$filename = $response;
|
||||||
}
|
}
|
||||||
|
@ -483,7 +483,7 @@ class ExtractTask extends Shell {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function __markerError($file, $line, $marker, $count) {
|
function __markerError($file, $line, $marker, $count) {
|
||||||
$this->out(__("Invalid marker content in %s:%s\n* %s(", $file, $line, $marker), true);
|
$this->out(__d('cake', "Invalid marker content in %s:%s\n* %s(", $file, $line, $marker), true);
|
||||||
$count += 2;
|
$count += 2;
|
||||||
$tokenCount = count($this->__tokens);
|
$tokenCount = count($this->__tokens);
|
||||||
$parenthesis = 1;
|
$parenthesis = 1;
|
||||||
|
|
|
@ -68,25 +68,25 @@ class FixtureTask extends BakeTask {
|
||||||
public function getOptionParser() {
|
public function getOptionParser() {
|
||||||
$parser = parent::getOptionParser();
|
$parser = parent::getOptionParser();
|
||||||
return $parser->description(
|
return $parser->description(
|
||||||
__('Generate fixtures for use with the test suite. You can use `bake fixture all` to bake all fixtures.')
|
__d('cake', 'Generate fixtures for use with the test suite. You can use `bake fixture all` to bake all fixtures.')
|
||||||
)->addArgument('name', array(
|
)->addArgument('name', array(
|
||||||
'help' => __('Name of the fixture to bake. Can use Plugin.name to bake plugin fixtures.')
|
'help' => __d('cake', 'Name of the fixture to bake. Can use Plugin.name to bake plugin fixtures.')
|
||||||
))->addOption('count', array(
|
))->addOption('count', array(
|
||||||
'help' => __('When using generated data, the number of records to include in the fixture(s).'),
|
'help' => __d('cake', 'When using generated data, the number of records to include in the fixture(s).'),
|
||||||
'short' => 'n',
|
'short' => 'n',
|
||||||
'default' => 10
|
'default' => 10
|
||||||
))->addOption('connection', array(
|
))->addOption('connection', array(
|
||||||
'help' => __('Which database configuration to use for baking.'),
|
'help' => __d('cake', 'Which database configuration to use for baking.'),
|
||||||
'short' => 'c',
|
'short' => 'c',
|
||||||
'default' => 'default'
|
'default' => 'default'
|
||||||
))->addOption('plugin', array(
|
))->addOption('plugin', array(
|
||||||
'help' => __('CamelCased name of the plugin to bake fixtures for.'),
|
'help' => __d('cake', 'CamelCased name of the plugin to bake fixtures for.'),
|
||||||
'short' => 'p',
|
'short' => 'p',
|
||||||
))->addOption('records', array(
|
))->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' => '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',
|
'short' => 'r',
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->epilog(__('Omitting all arguments and options will enter into an interactive mode.'));;
|
))->epilog(__d('cake', 'Omitting all arguments and options will enter into an interactive mode.'));;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -158,16 +158,16 @@ class FixtureTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
public function importOptions($modelName) {
|
public function importOptions($modelName) {
|
||||||
$options = array();
|
$options = array();
|
||||||
$doSchema = $this->in(__('Would you like to import schema for this fixture?'), array('y', 'n'), 'n');
|
$doSchema = $this->in(__d('cake', 'Would you like to import schema for this fixture?'), array('y', 'n'), 'n');
|
||||||
if ($doSchema == 'y') {
|
if ($doSchema == 'y') {
|
||||||
$options['schema'] = $modelName;
|
$options['schema'] = $modelName;
|
||||||
}
|
}
|
||||||
$doRecords = $this->in(__('Would you like to use record importing for this fixture?'), array('y', 'n'), 'n');
|
$doRecords = $this->in(__d('cake', 'Would you like to use record importing for this fixture?'), array('y', 'n'), 'n');
|
||||||
if ($doRecords == 'y') {
|
if ($doRecords == 'y') {
|
||||||
$options['records'] = true;
|
$options['records'] = true;
|
||||||
}
|
}
|
||||||
if ($doRecords == 'n') {
|
if ($doRecords == 'n') {
|
||||||
$prompt = __("Would you like to build this fixture with data from %s's table?", $modelName);
|
$prompt = __d('cake', "Would you like to build this fixture with data from %s's table?", $modelName);
|
||||||
$fromTable = $this->in($prompt, array('y', 'n'), 'n');
|
$fromTable = $this->in($prompt, array('y', 'n'), 'n');
|
||||||
if (strtolower($fromTable) == 'y') {
|
if (strtolower($fromTable) == 'y') {
|
||||||
$options['fromTable'] = true;
|
$options['fromTable'] = true;
|
||||||
|
@ -387,7 +387,7 @@ class FixtureTask extends BakeTask {
|
||||||
protected function _getRecordsFromTable($modelName, $useTable = null) {
|
protected function _getRecordsFromTable($modelName, $useTable = null) {
|
||||||
if ($this->interactive) {
|
if ($this->interactive) {
|
||||||
$condition = null;
|
$condition = null;
|
||||||
$prompt = __("Please provide a SQL fragment to use as conditions\nExample: WHERE 1=1 LIMIT 10");
|
$prompt = __d('cake', "Please provide a SQL fragment to use as conditions\nExample: WHERE 1=1 LIMIT 10");
|
||||||
while (!$condition) {
|
while (!$condition) {
|
||||||
$condition = $this->in($prompt, null, 'WHERE 1=1 LIMIT 10');
|
$condition = $this->in($prompt, null, 'WHERE 1=1 LIMIT 10');
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ class ModelTask extends BakeTask {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$modelClass = Inflector::classify($table);
|
$modelClass = Inflector::classify($table);
|
||||||
$this->out(__('Baking %s', $modelClass));
|
$this->out(__d('cake', 'Baking %s', $modelClass));
|
||||||
$object = $this->_getModelObject($modelClass);
|
$object = $this->_getModelObject($modelClass);
|
||||||
if ($this->bake($object, false) && $unitTestExists) {
|
if ($this->bake($object, false) && $unitTestExists) {
|
||||||
$this->bakeFixture($modelClass);
|
$this->bakeFixture($modelClass);
|
||||||
|
@ -151,7 +151,7 @@ class ModelTask extends BakeTask {
|
||||||
$this->out($i + 1 .'. ' . $option);
|
$this->out($i + 1 .'. ' . $option);
|
||||||
}
|
}
|
||||||
if (empty($prompt)) {
|
if (empty($prompt)) {
|
||||||
$prompt = __('Make a selection from the choices above');
|
$prompt = __d('cake', 'Make a selection from the choices above');
|
||||||
}
|
}
|
||||||
$choice = $this->in($prompt, null, $default);
|
$choice = $this->in($prompt, null, $default);
|
||||||
if (intval($choice) > 0 && intval($choice) <= $max) {
|
if (intval($choice) > 0 && intval($choice) <= $max) {
|
||||||
|
@ -190,7 +190,7 @@ class ModelTask extends BakeTask {
|
||||||
$primaryKey = $this->findPrimaryKey($fields);
|
$primaryKey = $this->findPrimaryKey($fields);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('Table %s does not exist, cannot bake a model without a table.', $useTable));
|
$this->err(__d('cake', 'Table %s does not exist, cannot bake a model without a table.', $useTable));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -199,13 +199,13 @@ class ModelTask extends BakeTask {
|
||||||
$displayField = $this->findDisplayField($tempModel->schema());
|
$displayField = $this->findDisplayField($tempModel->schema());
|
||||||
}
|
}
|
||||||
|
|
||||||
$prompt = __("Would you like to supply validation criteria \nfor the fields in your model?");
|
$prompt = __d('cake', "Would you like to supply validation criteria \nfor the fields in your model?");
|
||||||
$wannaDoValidation = $this->in($prompt, array('y','n'), 'y');
|
$wannaDoValidation = $this->in($prompt, array('y','n'), 'y');
|
||||||
if (array_search($useTable, $this->_tables) !== false && strtolower($wannaDoValidation) == 'y') {
|
if (array_search($useTable, $this->_tables) !== false && strtolower($wannaDoValidation) == 'y') {
|
||||||
$validate = $this->doValidation($tempModel);
|
$validate = $this->doValidation($tempModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
$prompt = __("Would you like to define model associations\n(hasMany, hasOne, belongsTo, etc.)?");
|
$prompt = __d('cake', "Would you like to define model associations\n(hasMany, hasOne, belongsTo, etc.)?");
|
||||||
$wannaDoAssoc = $this->in($prompt, array('y','n'), 'y');
|
$wannaDoAssoc = $this->in($prompt, array('y','n'), 'y');
|
||||||
if (strtolower($wannaDoAssoc) == 'y') {
|
if (strtolower($wannaDoAssoc) == 'y') {
|
||||||
$associations = $this->doAssociations($tempModel);
|
$associations = $this->doAssociations($tempModel);
|
||||||
|
@ -213,24 +213,24 @@ class ModelTask extends BakeTask {
|
||||||
|
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('The following Model will be created:'));
|
$this->out(__d('cake', 'The following Model will be created:'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out("Name: " . $currentModelName);
|
$this->out("Name: " . $currentModelName);
|
||||||
|
|
||||||
if ($this->connection !== 'default') {
|
if ($this->connection !== 'default') {
|
||||||
$this->out(__("DB Config: %s", $this->connection));
|
$this->out(__d('cake', "DB Config: %s", $this->connection));
|
||||||
}
|
}
|
||||||
if ($fullTableName !== Inflector::tableize($currentModelName)) {
|
if ($fullTableName !== Inflector::tableize($currentModelName)) {
|
||||||
$this->out(__('DB Table: %s', $fullTableName));
|
$this->out(__d('cake', 'DB Table: %s', $fullTableName));
|
||||||
}
|
}
|
||||||
if ($primaryKey != 'id') {
|
if ($primaryKey != 'id') {
|
||||||
$this->out(__('Primary Key: %s', $primaryKey));
|
$this->out(__d('cake', 'Primary Key: %s', $primaryKey));
|
||||||
}
|
}
|
||||||
if (!empty($validate)) {
|
if (!empty($validate)) {
|
||||||
$this->out(__('Validation: %s', print_r($validate, true)));
|
$this->out(__d('cake', 'Validation: %s', print_r($validate, true)));
|
||||||
}
|
}
|
||||||
if (!empty($associations)) {
|
if (!empty($associations)) {
|
||||||
$this->out(__('Associations:'));
|
$this->out(__d('cake', 'Associations:'));
|
||||||
$assocKeys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
$assocKeys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||||
foreach ($assocKeys as $assocKey) {
|
foreach ($assocKeys as $assocKey) {
|
||||||
$this->_printAssociation($currentModelName, $assocKey, $associations);
|
$this->_printAssociation($currentModelName, $assocKey, $associations);
|
||||||
|
@ -238,7 +238,7 @@ class ModelTask extends BakeTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$looksGood = $this->in(__('Look okay?'), array('y','n'), 'y');
|
$looksGood = $this->in(__d('cake', 'Look okay?'), array('y','n'), 'y');
|
||||||
|
|
||||||
if (strtolower($looksGood) == 'y') {
|
if (strtolower($looksGood) == 'y') {
|
||||||
$vars = compact('associations', 'validate', 'primaryKey', 'useTable', 'displayField');
|
$vars = compact('associations', 'validate', 'primaryKey', 'useTable', 'displayField');
|
||||||
|
@ -283,7 +283,7 @@ class ModelTask extends BakeTask {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $this->in(__('What is the primaryKey?'), null, $name);
|
return $this->in(__d('cake', 'What is the primaryKey?'), null, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -294,12 +294,12 @@ class ModelTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
public function findDisplayField($fields) {
|
public function findDisplayField($fields) {
|
||||||
$fieldNames = array_keys($fields);
|
$fieldNames = array_keys($fields);
|
||||||
$prompt = __("A displayField could not be automatically detected\nwould you like to choose one?");
|
$prompt = __d('cake', "A displayField could not be automatically detected\nwould you like to choose one?");
|
||||||
$continue = $this->in($prompt, array('y', 'n'));
|
$continue = $this->in($prompt, array('y', 'n'));
|
||||||
if (strtolower($continue) == 'n') {
|
if (strtolower($continue) == 'n') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$prompt = __('Choose a field from the options above:');
|
$prompt = __d('cake', 'Choose a field from the options above:');
|
||||||
$choice = $this->inOptions($fieldNames, $prompt);
|
$choice = $this->inOptions($fieldNames, $prompt);
|
||||||
return $fieldNames[$choice];
|
return $fieldNames[$choice];
|
||||||
}
|
}
|
||||||
|
@ -367,10 +367,10 @@ class ModelTask extends BakeTask {
|
||||||
while ($anotherValidator == 'y') {
|
while ($anotherValidator == 'y') {
|
||||||
if ($this->interactive) {
|
if ($this->interactive) {
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out(__('Field: %s', $fieldName));
|
$this->out(__d('cake', 'Field: %s', $fieldName));
|
||||||
$this->out(__('Type: %s', $metaData['type']));
|
$this->out(__d('cake', 'Type: %s', $metaData['type']));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('Please select one of the following validation options:'));
|
$this->out(__d('cake', 'Please select one of the following validation options:'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,8 +378,8 @@ class ModelTask extends BakeTask {
|
||||||
for ($i = 1; $i < $defaultChoice; $i++) {
|
for ($i = 1; $i < $defaultChoice; $i++) {
|
||||||
$prompt .= $i . ' - ' . $this->_validations[$i] . "\n";
|
$prompt .= $i . ' - ' . $this->_validations[$i] . "\n";
|
||||||
}
|
}
|
||||||
$prompt .= __("%s - Do not do any validation on this field.\n", $defaultChoice);
|
$prompt .= __d('cake', "%s - Do not do any validation on this field.\n", $defaultChoice);
|
||||||
$prompt .= __("... or enter in a valid regex validation string.\n");
|
$prompt .= __d('cake', "... or enter in a valid regex validation string.\n");
|
||||||
|
|
||||||
$methods = array_flip($this->_validations);
|
$methods = array_flip($this->_validations);
|
||||||
$guess = $defaultChoice;
|
$guess = $defaultChoice;
|
||||||
|
@ -402,11 +402,11 @@ class ModelTask extends BakeTask {
|
||||||
if ($this->interactive === true) {
|
if ($this->interactive === true) {
|
||||||
$choice = $this->in($prompt, null, $guess);
|
$choice = $this->in($prompt, null, $guess);
|
||||||
if (in_array($choice, $alreadyChosen)) {
|
if (in_array($choice, $alreadyChosen)) {
|
||||||
$this->out(__("You have already chosen that validation rule,\nplease choose again"));
|
$this->out(__d('cake', "You have already chosen that validation rule,\nplease choose again"));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!isset($this->_validations[$choice]) && is_numeric($choice)) {
|
if (!isset($this->_validations[$choice]) && is_numeric($choice)) {
|
||||||
$this->out(__('Please make a valid selection.'));
|
$this->out(__d('cake', 'Please make a valid selection.'));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$alreadyChosen[] = $choice;
|
$alreadyChosen[] = $choice;
|
||||||
|
@ -428,7 +428,7 @@ class ModelTask extends BakeTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->interactive == true && $choice != $defaultChoice) {
|
if ($this->interactive == true && $choice != $defaultChoice) {
|
||||||
$anotherValidator = $this->in(__('Would you like to add another validation rule?'), array('y', 'n'), 'n');
|
$anotherValidator = $this->in(__d('cake', 'Would you like to add another validation rule?'), array('y', 'n'), 'n');
|
||||||
} else {
|
} else {
|
||||||
$anotherValidator = 'n';
|
$anotherValidator = 'n';
|
||||||
}
|
}
|
||||||
|
@ -447,7 +447,7 @@ class ModelTask extends BakeTask {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ($this->interactive === true) {
|
if ($this->interactive === true) {
|
||||||
$this->out(__('One moment while the associations are detected.'));
|
$this->out(__d('cake', 'One moment while the associations are detected.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields = $model->schema(true);
|
$fields = $model->schema(true);
|
||||||
|
@ -475,9 +475,9 @@ class ModelTask extends BakeTask {
|
||||||
if ($this->interactive === true) {
|
if ($this->interactive === true) {
|
||||||
$this->hr();
|
$this->hr();
|
||||||
if (empty($associations)) {
|
if (empty($associations)) {
|
||||||
$this->out(__('None found.'));
|
$this->out(__d('cake', 'None found.'));
|
||||||
} else {
|
} else {
|
||||||
$this->out(__('Please confirm the following associations:'));
|
$this->out(__d('cake', 'Please confirm the following associations:'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$associations = $this->confirmAssociations($model, $associations);
|
$associations = $this->confirmAssociations($model, $associations);
|
||||||
}
|
}
|
||||||
|
@ -634,19 +634,19 @@ class ModelTask extends BakeTask {
|
||||||
* @return array Array of associations.
|
* @return array Array of associations.
|
||||||
*/
|
*/
|
||||||
public function doMoreAssociations($model, $associations) {
|
public function doMoreAssociations($model, $associations) {
|
||||||
$prompt = __('Would you like to define some additional model associations?');
|
$prompt = __d('cake', 'Would you like to define some additional model associations?');
|
||||||
$wannaDoMoreAssoc = $this->in($prompt, array('y','n'), 'n');
|
$wannaDoMoreAssoc = $this->in($prompt, array('y','n'), 'n');
|
||||||
$possibleKeys = $this->_generatePossibleKeys();
|
$possibleKeys = $this->_generatePossibleKeys();
|
||||||
while (strtolower($wannaDoMoreAssoc) == 'y') {
|
while (strtolower($wannaDoMoreAssoc) == 'y') {
|
||||||
$assocs = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
$assocs = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');
|
||||||
$this->out(__('What is the association type?'));
|
$this->out(__d('cake', 'What is the association type?'));
|
||||||
$assocType = intval($this->inOptions($assocs, __('Enter a number')));
|
$assocType = intval($this->inOptions($assocs, __d('cake', 'Enter a number')));
|
||||||
|
|
||||||
$this->out(__("For the following options be very careful to match your setup exactly.\nAny spelling mistakes will cause errors."));
|
$this->out(__d('cake', "For the following options be very careful to match your setup exactly.\nAny spelling mistakes will cause errors."));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
|
|
||||||
$alias = $this->in(__('What is the alias for this association?'));
|
$alias = $this->in(__d('cake', 'What is the alias for this association?'));
|
||||||
$className = $this->in(__('What className will %s use?', $alias), null, $alias );
|
$className = $this->in(__d('cake', 'What className will %s use?', $alias), null, $alias );
|
||||||
$suggestedForeignKey = null;
|
$suggestedForeignKey = null;
|
||||||
|
|
||||||
if ($assocType == 0) {
|
if ($assocType == 0) {
|
||||||
|
@ -661,22 +661,22 @@ class ModelTask extends BakeTask {
|
||||||
$showKeys = null;
|
$showKeys = null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$otherTable = $this->in(__('What is the table for this model?'));
|
$otherTable = $this->in(__d('cake', 'What is the table for this model?'));
|
||||||
$showKeys = $possibleKeys[$otherTable];
|
$showKeys = $possibleKeys[$otherTable];
|
||||||
}
|
}
|
||||||
$suggestedForeignKey = $this->_modelKey($model->name);
|
$suggestedForeignKey = $this->_modelKey($model->name);
|
||||||
}
|
}
|
||||||
if (!empty($showKeys)) {
|
if (!empty($showKeys)) {
|
||||||
$this->out(__('A helpful List of possible keys'));
|
$this->out(__d('cake', 'A helpful List of possible keys'));
|
||||||
$foreignKey = $this->inOptions($showKeys, __('What is the foreignKey?'));
|
$foreignKey = $this->inOptions($showKeys, __d('cake', 'What is the foreignKey?'));
|
||||||
$foreignKey = $showKeys[intval($foreignKey)];
|
$foreignKey = $showKeys[intval($foreignKey)];
|
||||||
}
|
}
|
||||||
if (!isset($foreignKey)) {
|
if (!isset($foreignKey)) {
|
||||||
$foreignKey = $this->in(__('What is the foreignKey? Specify your own.'), null, $suggestedForeignKey);
|
$foreignKey = $this->in(__d('cake', 'What is the foreignKey? Specify your own.'), null, $suggestedForeignKey);
|
||||||
}
|
}
|
||||||
if ($assocType == 3) {
|
if ($assocType == 3) {
|
||||||
$associationForeignKey = $this->in(__('What is the associationForeignKey?'), null, $this->_modelKey($model->name));
|
$associationForeignKey = $this->in(__d('cake', 'What is the associationForeignKey?'), null, $this->_modelKey($model->name));
|
||||||
$joinTable = $this->in(__('What is the joinTable?'));
|
$joinTable = $this->in(__d('cake', 'What is the joinTable?'));
|
||||||
}
|
}
|
||||||
$associations[$assocs[$assocType]] = array_values((array)$associations[$assocs[$assocType]]);
|
$associations[$assocs[$assocType]] = array_values((array)$associations[$assocs[$assocType]]);
|
||||||
$count = count($associations[$assocs[$assocType]]);
|
$count = count($associations[$assocs[$assocType]]);
|
||||||
|
@ -688,7 +688,7 @@ class ModelTask extends BakeTask {
|
||||||
$associations[$assocs[$assocType]][$i]['associationForeignKey'] = $associationForeignKey;
|
$associations[$assocs[$assocType]][$i]['associationForeignKey'] = $associationForeignKey;
|
||||||
$associations[$assocs[$assocType]][$i]['joinTable'] = $joinTable;
|
$associations[$assocs[$assocType]][$i]['joinTable'] = $joinTable;
|
||||||
}
|
}
|
||||||
$wannaDoMoreAssoc = $this->in(__('Define another association?'), array('y','n'), 'y');
|
$wannaDoMoreAssoc = $this->in(__d('cake', 'Define another association?'), array('y','n'), 'y');
|
||||||
}
|
}
|
||||||
return $associations;
|
return $associations;
|
||||||
}
|
}
|
||||||
|
@ -769,7 +769,7 @@ class ModelTask extends BakeTask {
|
||||||
$this->_tables = $this->getAllTables($useDbConfig);
|
$this->_tables = $this->getAllTables($useDbConfig);
|
||||||
|
|
||||||
if ($this->interactive === true) {
|
if ($this->interactive === true) {
|
||||||
$this->out(__('Possible Models based on your current database:'));
|
$this->out(__d('cake', 'Possible Models based on your current database:'));
|
||||||
$this->_modelNames = array();
|
$this->_modelNames = array();
|
||||||
$count = count($this->_tables);
|
$count = count($this->_tables);
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
@ -799,11 +799,11 @@ class ModelTask extends BakeTask {
|
||||||
|
|
||||||
if (array_search($useTable, $this->_tables) === false) {
|
if (array_search($useTable, $this->_tables) === false) {
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out(__("Given your model named '%s',\nCake would expect a database table named '%s'", $modelName, $fullTableName));
|
$this->out(__d('cake', "Given your model named '%s',\nCake would expect a database table named '%s'", $modelName, $fullTableName));
|
||||||
$tableIsGood = $this->in(__('Do you want to use this table?'), array('y','n'), 'y');
|
$tableIsGood = $this->in(__d('cake', 'Do you want to use this table?'), array('y','n'), 'y');
|
||||||
}
|
}
|
||||||
if (strtolower($tableIsGood) == 'n') {
|
if (strtolower($tableIsGood) == 'n') {
|
||||||
$useTable = $this->in(__('What is the name of the table?'));
|
$useTable = $this->in(__d('cake', 'What is the name of the table?'));
|
||||||
}
|
}
|
||||||
return $useTable;
|
return $useTable;
|
||||||
}
|
}
|
||||||
|
@ -834,7 +834,7 @@ class ModelTask extends BakeTask {
|
||||||
$tables = $db->listSources();
|
$tables = $db->listSources();
|
||||||
}
|
}
|
||||||
if (empty($tables)) {
|
if (empty($tables)) {
|
||||||
$this->err(__('Your database does not have any tables.'));
|
$this->err(__d('cake', 'Your database does not have any tables.'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
return $tables;
|
return $tables;
|
||||||
|
@ -851,15 +851,15 @@ class ModelTask extends BakeTask {
|
||||||
$enteredModel = '';
|
$enteredModel = '';
|
||||||
|
|
||||||
while ($enteredModel == '') {
|
while ($enteredModel == '') {
|
||||||
$enteredModel = $this->in(__("Enter a number from the list above,\ntype in the name of another model, or 'q' to exit"), null, 'q');
|
$enteredModel = $this->in(__d('cake', "Enter a number from the list above,\ntype in the name of another model, or 'q' to exit"), null, 'q');
|
||||||
|
|
||||||
if ($enteredModel === 'q') {
|
if ($enteredModel === 'q') {
|
||||||
$this->out(__('Exit'));
|
$this->out(__d('cake', 'Exit'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($enteredModel == '' || intval($enteredModel) > count($this->_modelNames)) {
|
if ($enteredModel == '' || intval($enteredModel) > count($this->_modelNames)) {
|
||||||
$this->err(__("The model name you supplied was empty,\nor the number you selected was not an option. Please try again."));
|
$this->err(__d('cake', "The model name you supplied was empty,\nor the number you selected was not an option. Please try again."));
|
||||||
$enteredModel = '';
|
$enteredModel = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -879,18 +879,18 @@ class ModelTask extends BakeTask {
|
||||||
public function getOptionParser() {
|
public function getOptionParser() {
|
||||||
$parser = parent::getOptionParser();
|
$parser = parent::getOptionParser();
|
||||||
return $parser->description(
|
return $parser->description(
|
||||||
__('Bake models.')
|
__d('cake', 'Bake models.')
|
||||||
)->addArgument('name', array(
|
)->addArgument('name', array(
|
||||||
'help' => __('Name of the model to bake. Can use Plugin.name to bake plugin models.')
|
'help' => __d('cake', 'Name of the model to bake. Can use Plugin.name to bake plugin models.')
|
||||||
))->addSubcommand('all', array(
|
))->addSubcommand('all', array(
|
||||||
'help' => __('Bake all model files with associations and validation.')
|
'help' => __d('cake', 'Bake all model files with associations and validation.')
|
||||||
))->addOption('plugin', array(
|
))->addOption('plugin', array(
|
||||||
'short' => 'p',
|
'short' => 'p',
|
||||||
'help' => __('Plugin to bake the model into.')
|
'help' => __d('cake', 'Plugin to bake the model into.')
|
||||||
))->addOption('connection', array(
|
))->addOption('connection', array(
|
||||||
'short' => 'c',
|
'short' => 'c',
|
||||||
'help' => __('The connection the model table is on.')
|
'help' => __d('cake', 'The connection the model table is on.')
|
||||||
))->epilog(__('Omitting all arguments and options will enter into an interactive mode.'));
|
))->epilog(__d('cake', 'Omitting all arguments and options will enter into an interactive mode.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -56,8 +56,8 @@ class PluginTask extends Shell {
|
||||||
$plugin = Inflector::camelize($this->args[0]);
|
$plugin = Inflector::camelize($this->args[0]);
|
||||||
$pluginPath = $this->_pluginPath($plugin);
|
$pluginPath = $this->_pluginPath($plugin);
|
||||||
if (is_dir($pluginPath)) {
|
if (is_dir($pluginPath)) {
|
||||||
$this->out(__('Plugin: %s', $plugin));
|
$this->out(__d('cake', 'Plugin: %s', $plugin));
|
||||||
$this->out(__('Path: %s', $pluginPath));
|
$this->out(__d('cake', 'Path: %s', $pluginPath));
|
||||||
} else {
|
} else {
|
||||||
$this->_interactive($plugin);
|
$this->_interactive($plugin);
|
||||||
}
|
}
|
||||||
|
@ -74,11 +74,11 @@ class PluginTask extends Shell {
|
||||||
*/
|
*/
|
||||||
protected function _interactive($plugin = null) {
|
protected function _interactive($plugin = null) {
|
||||||
while ($plugin === null) {
|
while ($plugin === null) {
|
||||||
$plugin = $this->in(__('Enter the name of the plugin in CamelCase format'));
|
$plugin = $this->in(__d('cake', 'Enter the name of the plugin in CamelCase format'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->bake($plugin)) {
|
if (!$this->bake($plugin)) {
|
||||||
$this->error(__("An error occured trying to bake: %s in %s", $plugin, $this->path . Inflector::underscore($pluginPath)));
|
$this->error(__d('cake', "An error occured trying to bake: %s in %s", $plugin, $this->path . Inflector::underscore($pluginPath)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,11 +97,11 @@ class PluginTask extends Shell {
|
||||||
$this->findPath($pathOptions);
|
$this->findPath($pathOptions);
|
||||||
}
|
}
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__("<info>Plugin Name:</info> %s", $plugin));
|
$this->out(__d('cake', "<info>Plugin Name:</info> %s", $plugin));
|
||||||
$this->out(__("<info>Plugin Directory:</info> %s", $this->path . $pluginPath));
|
$this->out(__d('cake', "<info>Plugin Directory:</info> %s", $this->path . $pluginPath));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
|
|
||||||
$looksGood = $this->in(__('Look okay?'), array('y', 'n', 'q'), 'y');
|
$looksGood = $this->in(__d('cake', 'Look okay?'), array('y', 'n', 'q'), 'y');
|
||||||
|
|
||||||
if (strtolower($looksGood) == 'y') {
|
if (strtolower($looksGood) == 'y') {
|
||||||
$Folder = new Folder($this->path . $pluginPath);
|
$Folder = new Folder($this->path . $pluginPath);
|
||||||
|
@ -156,7 +156,7 @@ class PluginTask extends Shell {
|
||||||
$this->createFile($this->path . $pluginPath . DS . $modelFileName, $out);
|
$this->createFile($this->path . $pluginPath . DS . $modelFileName, $out);
|
||||||
|
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('<success>Created:</success> %s in %s', $plugin, $this->path . $pluginPath), 2);
|
$this->out(__d('cake', '<success>Created:</success> %s in %s', $plugin, $this->path . $pluginPath), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -174,7 +174,7 @@ class PluginTask extends Shell {
|
||||||
foreach ($pathOptions as $i => $option) {
|
foreach ($pathOptions as $i => $option) {
|
||||||
$this->out($i + 1 .'. ' . $option);
|
$this->out($i + 1 .'. ' . $option);
|
||||||
}
|
}
|
||||||
$prompt = __('Choose a plugin path from the paths above.');
|
$prompt = __d('cake', 'Choose a plugin path from the paths above.');
|
||||||
$choice = $this->in($prompt);
|
$choice = $this->in($prompt);
|
||||||
if (intval($choice) > 0 && intval($choice) <= $max) {
|
if (intval($choice) > 0 && intval($choice) <= $max) {
|
||||||
$valid = true;
|
$valid = true;
|
||||||
|
@ -194,7 +194,7 @@ class PluginTask extends Shell {
|
||||||
'Create the directory structure, AppModel and AppController classes for a new plugin. ' .
|
'Create the directory structure, AppModel and AppController classes for a new plugin. ' .
|
||||||
'Can create plugins in any of your bootstrapped plugin paths.'
|
'Can create plugins in any of your bootstrapped plugin paths.'
|
||||||
)->addArgument('name', array(
|
)->addArgument('name', array(
|
||||||
'help' => __('CamelCased name of the plugin to create.')
|
'help' => __d('cake', 'CamelCased name of the plugin to create.')
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ class ProjectTask extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (!$project) {
|
while (!$project) {
|
||||||
$prompt = __("What is the full path for this app including the app directory name?\n Example:");
|
$prompt = __d('cake', "What is the full path for this app including the app directory name?\n Example:");
|
||||||
$default = APP_PATH . 'myapp';
|
$default = APP_PATH . 'myapp';
|
||||||
$project = $this->in($prompt . $default, null, $default);
|
$project = $this->in($prompt . $default, null, $default);
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class ProjectTask extends Shell {
|
||||||
if ($project) {
|
if ($project) {
|
||||||
$response = false;
|
$response = false;
|
||||||
while ($response == false && is_dir($project) === true && file_exists($project . 'config' . 'core.php')) {
|
while ($response == false && is_dir($project) === true && file_exists($project . 'config' . 'core.php')) {
|
||||||
$prompt = __('<warning>A project already exists in this location:</warning> %s Overwrite?', $project);
|
$prompt = __d('cake', '<warning>A project already exists in this location:</warning> %s Overwrite?', $project);
|
||||||
$response = $this->in($prompt, array('y','n'), 'n');
|
$response = $this->in($prompt, array('y','n'), 'n');
|
||||||
if (strtolower($response) === 'n') {
|
if (strtolower($response) === 'n') {
|
||||||
$response = $project = false;
|
$response = $project = false;
|
||||||
|
@ -81,51 +81,51 @@ class ProjectTask extends Shell {
|
||||||
if ($this->bake($project)) {
|
if ($this->bake($project)) {
|
||||||
$path = Folder::slashTerm($project);
|
$path = Folder::slashTerm($project);
|
||||||
if ($this->createHome($path)) {
|
if ($this->createHome($path)) {
|
||||||
$this->out(__(' * Welcome page created'));
|
$this->out(__d('cake', ' * Welcome page created'));
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('The Welcome page was <error>NOT</error> created'));
|
$this->err(__d('cake', 'The Welcome page was <error>NOT</error> created'));
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->securitySalt($path) === true) {
|
if ($this->securitySalt($path) === true) {
|
||||||
$this->out(__(' * Random hash key created for \'Security.salt\''));
|
$this->out(__d('cake', ' * Random hash key created for \'Security.salt\''));
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('Unable to generate random hash for \'Security.salt\', you should change it in %s', CONFIGS . 'core.php'));
|
$this->err(__d('cake', 'Unable to generate random hash for \'Security.salt\', you should change it in %s', CONFIGS . 'core.php'));
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->securityCipherSeed($path) === true) {
|
if ($this->securityCipherSeed($path) === true) {
|
||||||
$this->out(__(' * Random seed created for \'Security.cipherSeed\''));
|
$this->out(__d('cake', ' * Random seed created for \'Security.cipherSeed\''));
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('Unable to generate random seed for \'Security.cipherSeed\', you should change it in %s', CONFIGS . 'core.php'));
|
$this->err(__d('cake', 'Unable to generate random seed for \'Security.cipherSeed\', you should change it in %s', CONFIGS . 'core.php'));
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->corePath($path) === true) {
|
if ($this->corePath($path) === true) {
|
||||||
$this->out(__(' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/index.php', CAKE_CORE_INCLUDE_PATH));
|
$this->out(__d('cake', ' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/index.php', CAKE_CORE_INCLUDE_PATH));
|
||||||
$this->out(__(' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/test.php', CAKE_CORE_INCLUDE_PATH));
|
$this->out(__d('cake', ' * CAKE_CORE_INCLUDE_PATH set to %s in webroot/test.php', CAKE_CORE_INCLUDE_PATH));
|
||||||
$this->out(__(' * <warning>Remember to check these value after moving to production server</warning>'));
|
$this->out(__d('cake', ' * <warning>Remember to check these value after moving to production server</warning>'));
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', $path . 'webroot' .DS .'index.php'));
|
$this->err(__d('cake', 'Unable to set CAKE_CORE_INCLUDE_PATH, you should change it in %s', $path . 'webroot' .DS .'index.php'));
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
if ($this->consolePath($path) === true) {
|
if ($this->consolePath($path) === true) {
|
||||||
$this->out(__(' * app/console/cake.php path set.'));
|
$this->out(__d('cake', ' * app/console/cake.php path set.'));
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('Unable to set console path for app/console.'));
|
$this->err(__d('cake', 'Unable to set console path for app/console.'));
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$Folder = new Folder($path);
|
$Folder = new Folder($path);
|
||||||
if (!$Folder->chmod($path . 'tmp', 0777)) {
|
if (!$Folder->chmod($path . 'tmp', 0777)) {
|
||||||
$this->err(__('Could not set permissions on %s', $path . DS .'tmp'));
|
$this->err(__d('cake', 'Could not set permissions on %s', $path . DS .'tmp'));
|
||||||
$this->out(__('chmod -R 0777 %s', $path . DS .'tmp'));
|
$this->out(__d('cake', 'chmod -R 0777 %s', $path . DS .'tmp'));
|
||||||
$success = false;
|
$success = false;
|
||||||
}
|
}
|
||||||
if ($success) {
|
if ($success) {
|
||||||
$this->out(__('<success>Project baked successfully!</success>'));
|
$this->out(__d('cake', '<success>Project baked successfully!</success>'));
|
||||||
} else {
|
} else {
|
||||||
$this->out(__('Project baked but with <warning>some issues.</warning>.'));
|
$this->out(__d('cake', 'Project baked but with <warning>some issues.</warning>.'));
|
||||||
}
|
}
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
|
@ -147,23 +147,23 @@ class ProjectTask extends Shell {
|
||||||
$skel = $this->params['skel'];
|
$skel = $this->params['skel'];
|
||||||
}
|
}
|
||||||
while (!$skel) {
|
while (!$skel) {
|
||||||
$skel = $this->in(__("What is the path to the directory layout you wish to copy?\nExample: %s", APP, null, ROOT . DS . 'myapp' . DS));
|
$skel = $this->in(__d('cake', "What is the path to the directory layout you wish to copy?\nExample: %s", APP, null, ROOT . DS . 'myapp' . DS));
|
||||||
if ($skel == '') {
|
if ($skel == '') {
|
||||||
$this->err(__('The directory path you supplied was empty. Please try again.'));
|
$this->err(__d('cake', 'The directory path you supplied was empty. Please try again.'));
|
||||||
} else {
|
} else {
|
||||||
while (is_dir($skel) === false) {
|
while (is_dir($skel) === false) {
|
||||||
$skel = $this->in(__('Directory path does not exist please choose another:'));
|
$skel = $this->in(__d('cake', 'Directory path does not exist please choose another:'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$app = basename($path);
|
$app = basename($path);
|
||||||
|
|
||||||
$this->out(__('<info>Skel Directory</info>: ') . $skel);
|
$this->out(__d('cake', '<info>Skel Directory</info>: ') . $skel);
|
||||||
$this->out(__('<info>Will be copied to</info>: ') . $path);
|
$this->out(__d('cake', '<info>Will be copied to</info>: ') . $path);
|
||||||
$this->hr();
|
$this->hr();
|
||||||
|
|
||||||
$looksGood = $this->in(__('Look okay?'), array('y', 'n', 'q'), 'y');
|
$looksGood = $this->in(__d('cake', 'Look okay?'), array('y', 'n', 'q'), 'y');
|
||||||
|
|
||||||
if (strtolower($looksGood) == 'y') {
|
if (strtolower($looksGood) == 'y') {
|
||||||
$Folder = new Folder($skel);
|
$Folder = new Folder($skel);
|
||||||
|
@ -173,10 +173,10 @@ class ProjectTask extends Shell {
|
||||||
|
|
||||||
if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
|
if ($Folder->copy(array('to' => $path, 'skip' => $skip))) {
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('<success>Created:</success> %s in %s', $app, $path));
|
$this->out(__d('cake', '<success>Created:</success> %s in %s', $app, $path));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
} else {
|
} else {
|
||||||
$this->err(__("<error>Could not create</error> '%s' properly.", $app));
|
$this->err(__d('cake', "<error>Could not create</error> '%s' properly.", $app));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ class ProjectTask extends Shell {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} elseif (strtolower($looksGood) == 'q') {
|
} elseif (strtolower($looksGood) == 'q') {
|
||||||
$this->out(__('Bake Aborted.'));
|
$this->out(__d('cake', 'Bake Aborted.'));
|
||||||
} else {
|
} else {
|
||||||
$this->execute(false);
|
$this->execute(false);
|
||||||
return false;
|
return false;
|
||||||
|
@ -343,7 +343,7 @@ class ProjectTask extends Shell {
|
||||||
}
|
}
|
||||||
if ($this->interactive) {
|
if ($this->interactive) {
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out(__('You have more than one routing prefix configured'));
|
$this->out(__d('cake', 'You have more than one routing prefix configured'));
|
||||||
}
|
}
|
||||||
$options = array();
|
$options = array();
|
||||||
foreach ($prefixes as $i => $prefix) {
|
foreach ($prefixes as $i => $prefix) {
|
||||||
|
@ -352,19 +352,19 @@ class ProjectTask extends Shell {
|
||||||
$this->out($i + 1 . '. ' . $prefix);
|
$this->out($i + 1 . '. ' . $prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$selection = $this->in(__('Please choose a prefix to bake with.'), $options, 1);
|
$selection = $this->in(__d('cake', 'Please choose a prefix to bake with.'), $options, 1);
|
||||||
return $prefixes[$selection - 1] . '_';
|
return $prefixes[$selection - 1] . '_';
|
||||||
}
|
}
|
||||||
if ($this->interactive) {
|
if ($this->interactive) {
|
||||||
$this->hr();
|
$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('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
|
||||||
$this->out(__('What would you like the prefix route to be?'));
|
$this->out(__d('cake', 'What would you like the prefix route to be?'));
|
||||||
$this->out(__('Example: www.example.com/admin/controller'));
|
$this->out(__d('cake', 'Example: www.example.com/admin/controller'));
|
||||||
while ($admin == '') {
|
while ($admin == '') {
|
||||||
$admin = $this->in(__('Enter a routing prefix:'), null, 'admin');
|
$admin = $this->in(__d('cake', 'Enter a routing prefix:'), null, 'admin');
|
||||||
}
|
}
|
||||||
if ($this->cakeAdmin($admin) !== true) {
|
if ($this->cakeAdmin($admin) !== true) {
|
||||||
$this->out(__('<error>Unable to write to</error> /app/config/core.php.'));
|
$this->out(__d('cake', '<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('You need to enable Configure::write(\'Routing.prefixes\',array(\'admin\')) in /app/config/core.php to use prefix routing.');
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
|
@ -381,13 +381,13 @@ class ProjectTask extends Shell {
|
||||||
public function getOptionParser() {
|
public function getOptionParser() {
|
||||||
$parser = parent::getOptionParser();
|
$parser = parent::getOptionParser();
|
||||||
return $parser->description(
|
return $parser->description(
|
||||||
__('Generate a new CakePHP project skeleton.')
|
__d('cake', 'Generate a new CakePHP project skeleton.')
|
||||||
)->addArgument('name', array(
|
)->addArgument('name', array(
|
||||||
'help' => __('Application directory to make, if it starts with "/" the path is absolute.')
|
'help' => __d('cake', 'Application directory to make, if it starts with "/" the path is absolute.')
|
||||||
))->addOption('empty', array(
|
))->addOption('empty', array(
|
||||||
'help' => __('Create empty files in each of the directories. Good if you are using git')
|
'help' => __d('cake', 'Create empty files in each of the directories. Good if you are using git')
|
||||||
))->addOption('skel', array(
|
))->addOption('skel', array(
|
||||||
'help' => __('The directory layout to use for the new application skeleton. Defaults to cake/console/templates/skel of CakePHP used to create the project.')
|
'help' => __d('cake', 'The directory layout to use for the new application skeleton. Defaults to cake/console/templates/skel of CakePHP used to create the project.')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,8 +170,8 @@ class TemplateTask extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('You have more than one set of templates installed.'));
|
$this->out(__d('cake', 'You have more than one set of templates installed.'));
|
||||||
$this->out(__('Please choose the template set you wish to use:'));
|
$this->out(__d('cake', 'Please choose the template set you wish to use:'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
|
@ -181,7 +181,7 @@ class TemplateTask extends Shell {
|
||||||
$indexedPaths[$i] = $path;
|
$indexedPaths[$i] = $path;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$index = $this->in(__('Which bake theme would you like to use?'), range(1, $i - 1), 1);
|
$index = $this->in(__d('cake', 'Which bake theme would you like to use?'), range(1, $i - 1), 1);
|
||||||
$themeNames = array_keys($this->templatePaths);
|
$themeNames = array_keys($this->templatePaths);
|
||||||
$this->params['theme'] = $themeNames[$index - 1];
|
$this->params['theme'] = $themeNames[$index - 1];
|
||||||
return $indexedPaths[$index];
|
return $indexedPaths[$index];
|
||||||
|
@ -208,7 +208,7 @@ class TemplateTask extends Shell {
|
||||||
return $templatePath;
|
return $templatePath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->err(__('Could not find template for %s', $filename));
|
$this->err(__d('cake', 'Could not find template for %s', $filename));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,14 +89,14 @@ class TestTask extends BakeTask {
|
||||||
protected function _interactive($type = null) {
|
protected function _interactive($type = null) {
|
||||||
$this->interactive = true;
|
$this->interactive = true;
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('Bake Tests'));
|
$this->out(__d('cake', 'Bake Tests'));
|
||||||
$this->out(__('Path: %s', $this->path));
|
$this->out(__d('cake', 'Path: %s', $this->path));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
|
|
||||||
if ($type) {
|
if ($type) {
|
||||||
$type = Inflector::camelize($type);
|
$type = Inflector::camelize($type);
|
||||||
if (!in_array($type, $this->classTypes)) {
|
if (!in_array($type, $this->classTypes)) {
|
||||||
$this->error(__('Incorrect type provided. Please choose one of %s', implode(', ', $this->classTypes)));
|
$this->error(__d('cake', 'Incorrect type provided. Please choose one of %s', implode(', ', $this->classTypes)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$type = $this->getObjectType();
|
$type = $this->getObjectType();
|
||||||
|
@ -113,7 +113,7 @@ class TestTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
public function bake($type, $className) {
|
public function bake($type, $className) {
|
||||||
if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) {
|
if ($this->typeCanDetectFixtures($type) && $this->isLoadableClass($type, $className)) {
|
||||||
$this->out(__('Bake is detecting possible fixtures...'));
|
$this->out(__d('cake', 'Bake is detecting possible fixtures...'));
|
||||||
$testSubject = $this->buildTestSubject($type, $className);
|
$testSubject = $this->buildTestSubject($type, $className);
|
||||||
$this->generateFixtureList($testSubject);
|
$this->generateFixtureList($testSubject);
|
||||||
} elseif ($this->interactive) {
|
} elseif ($this->interactive) {
|
||||||
|
@ -154,7 +154,7 @@ class TestTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
public function getObjectType() {
|
public function getObjectType() {
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('Select an object type:'));
|
$this->out(__d('cake', 'Select an object type:'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
|
|
||||||
$keys = array();
|
$keys = array();
|
||||||
|
@ -163,7 +163,7 @@ class TestTask extends BakeTask {
|
||||||
$keys[] = $key;
|
$keys[] = $key;
|
||||||
}
|
}
|
||||||
$keys[] = 'q';
|
$keys[] = 'q';
|
||||||
$selection = $this->in(__('Enter the type of object to bake a test for or (q)uit'), $keys, 'q');
|
$selection = $this->in(__d('cake', 'Enter the type of object to bake a test for or (q)uit'), $keys, 'q');
|
||||||
if ($selection == 'q') {
|
if ($selection == 'q') {
|
||||||
return $this->_stop();
|
return $this->_stop();
|
||||||
}
|
}
|
||||||
|
@ -191,13 +191,13 @@ class TestTask extends BakeTask {
|
||||||
} else {
|
} else {
|
||||||
$options = App::objects($type);
|
$options = App::objects($type);
|
||||||
}
|
}
|
||||||
$this->out(__('Choose a %s class', $objectType));
|
$this->out(__d('cake', 'Choose a %s class', $objectType));
|
||||||
$keys = array();
|
$keys = array();
|
||||||
foreach ($options as $key => $option) {
|
foreach ($options as $key => $option) {
|
||||||
$this->out(++$key . '. ' . $option);
|
$this->out(++$key . '. ' . $option);
|
||||||
$keys[] = $key;
|
$keys[] = $key;
|
||||||
}
|
}
|
||||||
$selection = $this->in(__('Choose an existing class, or enter the name of a class that does not exist'));
|
$selection = $this->in(__d('cake', 'Choose an existing class, or enter the name of a class that does not exist'));
|
||||||
if (isset($options[$selection - 1])) {
|
if (isset($options[$selection - 1])) {
|
||||||
return $options[$selection - 1];
|
return $options[$selection - 1];
|
||||||
}
|
}
|
||||||
|
@ -365,10 +365,10 @@ class TestTask extends BakeTask {
|
||||||
* @return array Array of fixtures the user wants to add.
|
* @return array Array of fixtures the user wants to add.
|
||||||
*/
|
*/
|
||||||
public function getUserFixtures() {
|
public function getUserFixtures() {
|
||||||
$proceed = $this->in(__('Bake could not detect fixtures, would you like to add some?'), array('y','n'), 'n');
|
$proceed = $this->in(__d('cake', 'Bake could not detect fixtures, would you like to add some?'), array('y','n'), 'n');
|
||||||
$fixtures = array();
|
$fixtures = array();
|
||||||
if (strtolower($proceed) == 'y') {
|
if (strtolower($proceed) == 'y') {
|
||||||
$fixtureList = $this->in(__("Please provide a comma separated list of the fixtures names you'd like to use.\nExample: 'app.comment, app.post, plugin.forums.post'"));
|
$fixtureList = $this->in(__d('cake', "Please provide a comma separated list of the fixtures names you'd like to use.\nExample: 'app.comment, app.post, plugin.forums.post'"));
|
||||||
$fixtureListTrimmed = str_replace(' ', '', $fixtureList);
|
$fixtureListTrimmed = str_replace(' ', '', $fixtureList);
|
||||||
$fixtures = explode(',', $fixtureListTrimmed);
|
$fixtures = explode(',', $fixtureListTrimmed);
|
||||||
}
|
}
|
||||||
|
@ -431,15 +431,15 @@ class TestTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
public function getOptionParser() {
|
public function getOptionParser() {
|
||||||
$parser = parent::getOptionParser();
|
$parser = parent::getOptionParser();
|
||||||
return $parser->description(__('Bake test case skeletons for classes.'))
|
return $parser->description(__d('cake', 'Bake test case skeletons for classes.'))
|
||||||
->addArgument('type', array(
|
->addArgument('type', array(
|
||||||
'help' => __('Type of class to bake, can be any of the following: controller, model, helper, component or behavior.'),
|
'help' => __d('cake', 'Type of class to bake, can be any of the following: controller, model, helper, component or behavior.'),
|
||||||
'choices' => array('controller', 'model', 'helper', 'component', 'behavior')
|
'choices' => array('controller', 'model', 'helper', 'component', 'behavior')
|
||||||
))->addArgument('name', array(
|
))->addArgument('name', array(
|
||||||
'help' => __('An existing class to bake tests for.')
|
'help' => __d('cake', 'An existing class to bake tests for.')
|
||||||
))->addOption('plugin', array(
|
))->addOption('plugin', array(
|
||||||
'short' => 'p',
|
'short' => 'p',
|
||||||
'help' => __('CamelCased name of the plugin to bake tests for.')
|
'help' => __d('cake', 'CamelCased name of the plugin to bake tests for.')
|
||||||
))->epilog(__('Omitting all arguments and options will enter into an interactive mode.'));
|
))->epilog(__d('cake', 'Omitting all arguments and options will enter into an interactive mode.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,17 +221,17 @@ class ViewTask extends BakeTask {
|
||||||
|
|
||||||
$this->controllerPath = strtolower(Inflector::underscore($this->controllerName));
|
$this->controllerPath = strtolower(Inflector::underscore($this->controllerName));
|
||||||
|
|
||||||
$prompt = __("Would you like bake to build your views interactively?\nWarning: Choosing no will overwrite %s views if it exist.", $this->controllerName);
|
$prompt = __d('cake', "Would you like bake to build your views interactively?\nWarning: Choosing no will overwrite %s views if it exist.", $this->controllerName);
|
||||||
$interactive = $this->in($prompt, array('y', 'n'), 'n');
|
$interactive = $this->in($prompt, array('y', 'n'), 'n');
|
||||||
|
|
||||||
if (strtolower($interactive) == 'n') {
|
if (strtolower($interactive) == 'n') {
|
||||||
$this->interactive = false;
|
$this->interactive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$prompt = __("Would you like to create some CRUD views\n(index, add, view, edit) for this controller?\nNOTE: Before doing so, you'll need to create your controller\nand model classes (including associated models).");
|
$prompt = __d('cake', "Would you like to create some CRUD views\n(index, add, view, edit) for this controller?\nNOTE: Before doing so, you'll need to create your controller\nand model classes (including associated models).");
|
||||||
$wannaDoScaffold = $this->in($prompt, array('y','n'), 'y');
|
$wannaDoScaffold = $this->in($prompt, array('y','n'), 'y');
|
||||||
|
|
||||||
$wannaDoAdmin = $this->in(__("Would you like to create the views for admin routing?"), array('y','n'), 'n');
|
$wannaDoAdmin = $this->in(__d('cake', "Would you like to create the views for admin routing?"), array('y','n'), 'n');
|
||||||
|
|
||||||
if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoAdmin) == 'y') {
|
if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoAdmin) == 'y') {
|
||||||
$vars = $this->__loadController();
|
$vars = $this->__loadController();
|
||||||
|
@ -250,7 +250,7 @@ class ViewTask extends BakeTask {
|
||||||
}
|
}
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->out(__("View Scaffolding Complete.\n"));
|
$this->out(__d('cake', "View Scaffolding Complete.\n"));
|
||||||
} else {
|
} else {
|
||||||
$this->customAction();
|
$this->customAction();
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ class ViewTask extends BakeTask {
|
||||||
*/
|
*/
|
||||||
private function __loadController() {
|
private function __loadController() {
|
||||||
if (!$this->controllerName) {
|
if (!$this->controllerName) {
|
||||||
$this->err(__('Controller not found'));
|
$this->err(__d('cake', 'Controller not found'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$plugin = null;
|
$plugin = null;
|
||||||
|
@ -280,7 +280,7 @@ class ViewTask extends BakeTask {
|
||||||
App::uses($controllerClassName, $plugin . 'Controller');
|
App::uses($controllerClassName, $plugin . 'Controller');
|
||||||
if (!class_exists($controllerClassName)) {
|
if (!class_exists($controllerClassName)) {
|
||||||
$file = $controllerClassName . '.php';
|
$file = $controllerClassName . '.php';
|
||||||
$this->err(__("The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", $file));
|
$this->err(__d('cake', "The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", $file));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
$controllerObj = new $controllerClassName();
|
$controllerObj = new $controllerClassName();
|
||||||
|
@ -331,25 +331,25 @@ class ViewTask extends BakeTask {
|
||||||
public function customAction() {
|
public function customAction() {
|
||||||
$action = '';
|
$action = '';
|
||||||
while ($action == '') {
|
while ($action == '') {
|
||||||
$action = $this->in(__('Action Name? (use lowercase_underscored function name)'));
|
$action = $this->in(__d('cake', 'Action Name? (use lowercase_underscored function name)'));
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
$this->out(__('The action name you supplied was empty. Please try again.'));
|
$this->out(__d('cake', 'The action name you supplied was empty. Please try again.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->out();
|
$this->out();
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('The following view will be created:'));
|
$this->out(__d('cake', 'The following view will be created:'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$this->out(__('Controller Name: %s', $this->controllerName));
|
$this->out(__d('cake', 'Controller Name: %s', $this->controllerName));
|
||||||
$this->out(__('Action Name: %s', $action));
|
$this->out(__d('cake', 'Action Name: %s', $action));
|
||||||
$this->out(__('Path: %s', $this->params['app'] . DS . $this->controllerPath . DS . Inflector::underscore($action) . ".ctp"));
|
$this->out(__d('cake', 'Path: %s', $this->params['app'] . DS . $this->controllerPath . DS . Inflector::underscore($action) . ".ctp"));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
$looksGood = $this->in(__('Look okay?'), array('y','n'), 'y');
|
$looksGood = $this->in(__d('cake', 'Look okay?'), array('y','n'), 'y');
|
||||||
if (strtolower($looksGood) == 'y') {
|
if (strtolower($looksGood) == 'y') {
|
||||||
$this->bake($action, ' ');
|
$this->bake($action, ' ');
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
} else {
|
} else {
|
||||||
$this->out(__('Bake Aborted.'));
|
$this->out(__d('cake', 'Bake Aborted.'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,25 +431,25 @@ class ViewTask extends BakeTask {
|
||||||
public function getOptionParser() {
|
public function getOptionParser() {
|
||||||
$parser = parent::getOptionParser();
|
$parser = parent::getOptionParser();
|
||||||
return $parser->description(
|
return $parser->description(
|
||||||
__('Bake views for a controller, using built-in or custom templates.')
|
__d('cake', 'Bake views for a controller, using built-in or custom templates.')
|
||||||
)->addArgument('controller', array(
|
)->addArgument('controller', array(
|
||||||
'help' => __('Name of the controller views to bake. Can be Plugin.name as a shortcut for plugin baking.')
|
'help' => __d('cake', 'Name of the controller views to bake. Can be Plugin.name as a shortcut for plugin baking.')
|
||||||
))->addArgument('action', array(
|
))->addArgument('action', array(
|
||||||
'help' => __("Will bake a single action's file. core templates are (index, add, edit, view)")
|
'help' => __d('cake', "Will bake a single action's file. core templates are (index, add, edit, view)")
|
||||||
))->addArgument('alias', array(
|
))->addArgument('alias', array(
|
||||||
'help' => __('Will bake the template in <action> but create the filename after <alias>.')
|
'help' => __d('cake', 'Will bake the template in <action> but create the filename after <alias>.')
|
||||||
))->addOption('plugin', array(
|
))->addOption('plugin', array(
|
||||||
'short' => 'p',
|
'short' => 'p',
|
||||||
'help' => __('Plugin to bake the view into.')
|
'help' => __d('cake', 'Plugin to bake the view into.')
|
||||||
))->addOption('admin', array(
|
))->addOption('admin', array(
|
||||||
'help' => __('Set to only bake views for a prefix in Routing.prefixes'),
|
'help' => __d('cake', 'Set to only bake views for a prefix in Routing.prefixes'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('connection', array(
|
))->addOption('connection', array(
|
||||||
'short' => 'c',
|
'short' => 'c',
|
||||||
'help' => __('The connection the connected model is on.')
|
'help' => __d('cake', 'The connection the connected model is on.')
|
||||||
))->addSubcommand('all', array(
|
))->addSubcommand('all', array(
|
||||||
'help' => __('Bake all CRUD action views for all controllers. Requires models and controllers to exist.')
|
'help' => __d('cake', 'Bake all CRUD action views for all controllers. Requires models and controllers to exist.')
|
||||||
))->epilog(__('Omitting all arguments and options will enter into an interactive mode.'));
|
))->epilog(__d('cake', 'Omitting all arguments and options will enter into an interactive mode.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -44,113 +44,113 @@ class TestsuiteShell extends Shell {
|
||||||
'The CakePHP Testsuite allows you to run test cases from the command line',
|
'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'
|
'If run with no command line arguments, a list of available core test cases will be shown'
|
||||||
))->addArgument('category', array(
|
))->addArgument('category', array(
|
||||||
'help' => __('app, core or name of a plugin.'),
|
'help' => __d('cake', 'app, core or name of a plugin.'),
|
||||||
'required' => true
|
'required' => true
|
||||||
))->addArgument('file', array(
|
))->addArgument('file', array(
|
||||||
'help' => __('file name with folder prefix and without the test.php suffix.'),
|
'help' => __d('cake', 'file name with folder prefix and without the test.php suffix.'),
|
||||||
'required' => false,
|
'required' => false,
|
||||||
))->addOption('log-junit', array(
|
))->addOption('log-junit', array(
|
||||||
'help' => __('<file> Log test execution in JUnit XML format to file.'),
|
'help' => __d('cake', '<file> Log test execution in JUnit XML format to file.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('log-json', array(
|
))->addOption('log-json', array(
|
||||||
'help' => __('<file> Log test execution in TAP format to file.'),
|
'help' => __d('cake', '<file> Log test execution in TAP format to file.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('log-tap', array(
|
))->addOption('log-tap', array(
|
||||||
'help' => __('<file> Log test execution in TAP format to file.'),
|
'help' => __d('cake', '<file> Log test execution in TAP format to file.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('log-dbus', array(
|
))->addOption('log-dbus', array(
|
||||||
'help' => __('Log test execution to DBUS.'),
|
'help' => __d('cake', 'Log test execution to DBUS.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('coverage-html', array(
|
))->addOption('coverage-html', array(
|
||||||
'help' => __('<dir> Generate code coverage report in HTML format.'),
|
'help' => __d('cake', '<dir> Generate code coverage report in HTML format.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('coverage-clover', array(
|
))->addOption('coverage-clover', array(
|
||||||
'help' => __('<file> Write code coverage data in Clover XML format.'),
|
'help' => __d('cake', '<file> Write code coverage data in Clover XML format.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('testdox-html', array(
|
))->addOption('testdox-html', array(
|
||||||
'help' => __('<file> Write agile documentation in HTML format to file.'),
|
'help' => __d('cake', '<file> Write agile documentation in HTML format to file.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('testdox-text', array(
|
))->addOption('testdox-text', array(
|
||||||
'help' => __('<file> Write agile documentation in Text format to file.'),
|
'help' => __d('cake', '<file> Write agile documentation in Text format to file.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('filter', array(
|
))->addOption('filter', array(
|
||||||
'help' => __('<pattern> Filter which tests to run.'),
|
'help' => __d('cake', '<pattern> Filter which tests to run.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('group', array(
|
))->addOption('group', array(
|
||||||
'help' => __('<name> Only runs tests from the specified group(s).'),
|
'help' => __d('cake', '<name> Only runs tests from the specified group(s).'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('exclude-group', array(
|
))->addOption('exclude-group', array(
|
||||||
'help' => __('<name> Exclude tests from the specified group(s).'),
|
'help' => __d('cake', '<name> Exclude tests from the specified group(s).'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('list-groups', array(
|
))->addOption('list-groups', array(
|
||||||
'help' => __('List available test groups.'),
|
'help' => __d('cake', 'List available test groups.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('loader', array(
|
))->addOption('loader', array(
|
||||||
'help' => __('TestSuiteLoader implementation to use.'),
|
'help' => __d('cake', 'TestSuiteLoader implementation to use.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('repeat', array(
|
))->addOption('repeat', array(
|
||||||
'help' => __('<times> Runs the test(s) repeatedly.'),
|
'help' => __d('cake', '<times> Runs the test(s) repeatedly.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('tap', array(
|
))->addOption('tap', array(
|
||||||
'help' => __('Report test execution progress in TAP format.'),
|
'help' => __d('cake', 'Report test execution progress in TAP format.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('testdox', array(
|
))->addOption('testdox', array(
|
||||||
'help' => __('Report test execution progress in TestDox format.'),
|
'help' => __d('cake', 'Report test execution progress in TestDox format.'),
|
||||||
'default' => false,
|
'default' => false,
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('no-colors', array(
|
))->addOption('no-colors', array(
|
||||||
'help' => __('Do not use colors in output.'),
|
'help' => __d('cake', 'Do not use colors in output.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('stderr', array(
|
))->addOption('stderr', array(
|
||||||
'help' => __('Write to STDERR instead of STDOUT.'),
|
'help' => __d('cake', 'Write to STDERR instead of STDOUT.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('stop-on-error', array(
|
))->addOption('stop-on-error', array(
|
||||||
'help' => __('Stop execution upon first error or failure.'),
|
'help' => __d('cake', 'Stop execution upon first error or failure.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('stop-on-failure', array(
|
))->addOption('stop-on-failure', array(
|
||||||
'help' => __('Stop execution upon first failure.'),
|
'help' => __d('cake', 'Stop execution upon first failure.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('stop-on-skipped ', array(
|
))->addOption('stop-on-skipped ', array(
|
||||||
'help' => __('Stop execution upon first skipped test.'),
|
'help' => __d('cake', 'Stop execution upon first skipped test.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('stop-on-incomplete', array(
|
))->addOption('stop-on-incomplete', array(
|
||||||
'help' => __('Stop execution upon first incomplete test.'),
|
'help' => __d('cake', 'Stop execution upon first incomplete test.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('strict', array(
|
))->addOption('strict', array(
|
||||||
'help' => __('Mark a test as incomplete if no assertions are made.'),
|
'help' => __d('cake', 'Mark a test as incomplete if no assertions are made.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('wait', array(
|
))->addOption('wait', array(
|
||||||
'help' => __('Waits for a keystroke after each test.'),
|
'help' => __d('cake', 'Waits for a keystroke after each test.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('process-isolation', array(
|
))->addOption('process-isolation', array(
|
||||||
'help' => __('Run each test in a separate PHP process.'),
|
'help' => __d('cake', 'Run each test in a separate PHP process.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('no-globals-backup', array(
|
))->addOption('no-globals-backup', array(
|
||||||
'help' => __('Do not backup and restore $GLOBALS for each test.'),
|
'help' => __d('cake', 'Do not backup and restore $GLOBALS for each test.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('static-backup ', array(
|
))->addOption('static-backup ', array(
|
||||||
'help' => __('Backup and restore static attributes for each test.'),
|
'help' => __d('cake', 'Backup and restore static attributes for each test.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('syntax-check', array(
|
))->addOption('syntax-check', array(
|
||||||
'help' => __('Try to check source files for syntax errors.'),
|
'help' => __d('cake', 'Try to check source files for syntax errors.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('bootstrap', array(
|
))->addOption('bootstrap', array(
|
||||||
'help' => __('<file> A "bootstrap" PHP file that is run before the tests.'),
|
'help' => __d('cake', '<file> A "bootstrap" PHP file that is run before the tests.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('configuration', array(
|
))->addOption('configuration', array(
|
||||||
'help' => __('<file> Read configuration from XML file.'),
|
'help' => __d('cake', '<file> Read configuration from XML file.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('no-configuration', array(
|
))->addOption('no-configuration', array(
|
||||||
'help' => __('Ignore default configuration file (phpunit.xml).'),
|
'help' => __d('cake', 'Ignore default configuration file (phpunit.xml).'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('include-path', array(
|
))->addOption('include-path', array(
|
||||||
'help' => __('<path(s)> Prepend PHP include_path with given path(s).'),
|
'help' => __d('cake', '<path(s)> Prepend PHP include_path with given path(s).'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('directive', array(
|
))->addOption('directive', array(
|
||||||
'help' => __('key[=value] Sets a php.ini value.'),
|
'help' => __d('cake', 'key[=value] Sets a php.ini value.'),
|
||||||
'default' => false
|
'default' => false
|
||||||
))->addOption('fixture', array(
|
))->addOption('fixture', array(
|
||||||
'help' => __('Choose a custom fixture manager.'),
|
'help' => __d('cake', 'Choose a custom fixture manager.'),
|
||||||
));
|
));
|
||||||
|
|
||||||
return $parser;
|
return $parser;
|
||||||
|
@ -232,7 +232,7 @@ class TestsuiteShell extends Shell {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function main() {
|
public function main() {
|
||||||
$this->out(__('CakePHP Test Shell'));
|
$this->out(__d('cake', 'CakePHP Test Shell'));
|
||||||
$this->hr();
|
$this->hr();
|
||||||
|
|
||||||
$args = $this->parseArgs();
|
$args = $this->parseArgs();
|
||||||
|
@ -281,7 +281,7 @@ class TestsuiteShell extends Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($testCases)) {
|
if (empty($testCases)) {
|
||||||
$this->out(__("No test cases available \n\n"));
|
$this->out(__d('cake', "No test cases available \n\n"));
|
||||||
return $this->out($this->OptionParser->help());
|
return $this->out($this->OptionParser->help());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ class TestsuiteShell extends Shell {
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ($choice = $this->in(__('What test case would you like to run?'), null, 'q')) {
|
while ($choice = $this->in(__d('cake', 'What test case would you like to run?'), null, 'q')) {
|
||||||
if (is_numeric($choice) && isset($cases[$choice])) {
|
if (is_numeric($choice) && isset($cases[$choice])) {
|
||||||
$this->args[0] = $category;
|
$this->args[0] = $category;
|
||||||
$this->args[1] = $cases[$choice];
|
$this->args[1] = $cases[$choice];
|
||||||
|
|
|
@ -58,7 +58,7 @@ class ConsoleErrorHandler extends ErrorHandler {
|
||||||
public static function handleException(Exception $exception) {
|
public static function handleException(Exception $exception) {
|
||||||
$stderr = self::getStderr();
|
$stderr = self::getStderr();
|
||||||
$stderr->write(sprintf(
|
$stderr->write(sprintf(
|
||||||
__("<error>Error:</error> %s\n%s"),
|
__d('cake', "<error>Error:</error> %s\n%s"),
|
||||||
$exception->getMessage(),
|
$exception->getMessage(),
|
||||||
$exception->getTraceAsString()
|
$exception->getTraceAsString()
|
||||||
));
|
));
|
||||||
|
@ -80,8 +80,8 @@ class ConsoleErrorHandler extends ErrorHandler {
|
||||||
}
|
}
|
||||||
$stderr = self::getStderr();
|
$stderr = self::getStderr();
|
||||||
list($name, $log) = self::_mapErrorCode($code);
|
list($name, $log) = self::_mapErrorCode($code);
|
||||||
$message = __('%s in [%s, line %s]', $description, $file, $line);
|
$message = __d('cake', '%s in [%s, line %s]', $description, $file, $line);
|
||||||
$stderr->write(__("<error>%s Error:</error> %s\n", $name, $message));
|
$stderr->write(__d('cake', "<error>%s Error:</error> %s\n", $name, $message));
|
||||||
|
|
||||||
if (Configure::read('debug') == 0) {
|
if (Configure::read('debug') == 0) {
|
||||||
CakeLog::write($log, $message);
|
CakeLog::write($log, $message);
|
||||||
|
|
|
@ -95,10 +95,10 @@ class ConsoleInputArgument {
|
||||||
}
|
}
|
||||||
$optional = '';
|
$optional = '';
|
||||||
if (!$this->isRequired()) {
|
if (!$this->isRequired()) {
|
||||||
$optional = __(' <comment>(optional)</comment>');
|
$optional = __d('cake', ' <comment>(optional)</comment>');
|
||||||
}
|
}
|
||||||
if (!empty($this->_choices)) {
|
if (!empty($this->_choices)) {
|
||||||
$optional .= __(' <comment>(choices: %s)</comment>', implode('|', $this->_choices));
|
$optional .= __d('cake', ' <comment>(choices: %s)</comment>', implode('|', $this->_choices));
|
||||||
}
|
}
|
||||||
return sprintf('%s%s%s', $name, $this->_help, $optional);
|
return sprintf('%s%s%s', $name, $this->_help, $optional);
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ class ConsoleInputArgument {
|
||||||
}
|
}
|
||||||
if (!in_array($value, $this->_choices)) {
|
if (!in_array($value, $this->_choices)) {
|
||||||
throw new ConsoleException(sprintf(
|
throw new ConsoleException(sprintf(
|
||||||
__('"%s" is not a valid value for %s. Please use one of "%s"'),
|
__d('cake', '"%s" is not a valid value for %s. Please use one of "%s"'),
|
||||||
$value, $this->_name, implode(', ', $this->_choices)
|
$value, $this->_name, implode(', ', $this->_choices)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,10 +119,10 @@ class ConsoleInputOption {
|
||||||
public function help($width = 0) {
|
public function help($width = 0) {
|
||||||
$default = $short = '';
|
$default = $short = '';
|
||||||
if (!empty($this->_default) && $this->_default !== true) {
|
if (!empty($this->_default) && $this->_default !== true) {
|
||||||
$default = __(' <comment>(default: %s)</comment>', $this->_default);
|
$default = __d('cake', ' <comment>(default: %s)</comment>', $this->_default);
|
||||||
}
|
}
|
||||||
if (!empty($this->_choices)) {
|
if (!empty($this->_choices)) {
|
||||||
$default .= __(' <comment>(choices: %s)</comment>', implode('|', $this->_choices));
|
$default .= __d('cake', ' <comment>(choices: %s)</comment>', implode('|', $this->_choices));
|
||||||
}
|
}
|
||||||
if (!empty($this->_short)) {
|
if (!empty($this->_short)) {
|
||||||
$short = ', -' . $this->_short;
|
$short = ', -' . $this->_short;
|
||||||
|
@ -180,7 +180,7 @@ class ConsoleInputOption {
|
||||||
}
|
}
|
||||||
if (!in_array($value, $this->_choices)) {
|
if (!in_array($value, $this->_choices)) {
|
||||||
throw new ConsoleException(sprintf(
|
throw new ConsoleException(sprintf(
|
||||||
__('"%s" is not a valid value for --%s. Please use one of "%s"'),
|
__d('cake', '"%s" is not a valid value for --%s. Please use one of "%s"'),
|
||||||
$value, $this->_name, implode(', ', $this->_choices)
|
$value, $this->_name, implode(', ', $this->_choices)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,11 +134,11 @@ class ConsoleOptionParser {
|
||||||
if ($defaultOptions) {
|
if ($defaultOptions) {
|
||||||
$this->addOption('verbose', array(
|
$this->addOption('verbose', array(
|
||||||
'short' => 'v',
|
'short' => 'v',
|
||||||
'help' => __('Enable verbose output.'),
|
'help' => __d('cake', 'Enable verbose output.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
))->addOption('quiet', array(
|
))->addOption('quiet', array(
|
||||||
'short' => 'q',
|
'short' => 'q',
|
||||||
'help' => __('Enable quiet output.'),
|
'help' => __d('cake', 'Enable quiet output.'),
|
||||||
'boolean' => true
|
'boolean' => true
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,7 @@ class ConsoleOptionParser {
|
||||||
foreach ($this->_args as $i => $arg) {
|
foreach ($this->_args as $i => $arg) {
|
||||||
if ($arg->isRequired() && !isset($args[$i]) && empty($params['help'])) {
|
if ($arg->isRequired() && !isset($args[$i]) && empty($params['help'])) {
|
||||||
throw new ConsoleException(
|
throw new ConsoleException(
|
||||||
__('Missing required arguments. %s is required.', $arg->name())
|
__d('cake', 'Missing required arguments. %s is required.', $arg->name())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -555,7 +555,7 @@ class ConsoleOptionParser {
|
||||||
*/
|
*/
|
||||||
protected function _parseOption($name, $params) {
|
protected function _parseOption($name, $params) {
|
||||||
if (!isset($this->_options[$name])) {
|
if (!isset($this->_options[$name])) {
|
||||||
throw new ConsoleException(__('Unknown option `%s`', $name));
|
throw new ConsoleException(__d('cake', 'Unknown option `%s`', $name));
|
||||||
}
|
}
|
||||||
$option = $this->_options[$name];
|
$option = $this->_options[$name];
|
||||||
$isBoolean = $option->isBoolean();
|
$isBoolean = $option->isBoolean();
|
||||||
|
@ -589,7 +589,7 @@ class ConsoleOptionParser {
|
||||||
}
|
}
|
||||||
$next = count($args);
|
$next = count($args);
|
||||||
if (!isset($this->_args[$next])) {
|
if (!isset($this->_args[$next])) {
|
||||||
throw new ConsoleException(__('Too many arguments.'));
|
throw new ConsoleException(__d('cake', 'Too many arguments.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_args[$next]->validChoice($argument)) {
|
if ($this->_args[$next]->validChoice($argument)) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ class HelpFormatter {
|
||||||
}
|
}
|
||||||
$out[] = '';
|
$out[] = '';
|
||||||
$out[] = sprintf(
|
$out[] = sprintf(
|
||||||
__('To see help on a subcommand use <info>`cake %s [subcommand] --help`</info>'),
|
__d('cake', 'To see help on a subcommand use <info>`cake %s [subcommand] --help`</info>'),
|
||||||
$parser->command()
|
$parser->command()
|
||||||
);
|
);
|
||||||
$out[] = '';
|
$out[] = '';
|
||||||
|
|
|
@ -560,7 +560,7 @@ class Shell extends Object {
|
||||||
* @param string $message An optional error message
|
* @param string $message An optional error message
|
||||||
*/
|
*/
|
||||||
public function error($title, $message = null) {
|
public function error($title, $message = null) {
|
||||||
$this->err(__('<error>Error:</error> %s', $title));
|
$this->err(__d('cake', '<error>Error:</error> %s', $title));
|
||||||
|
|
||||||
if (!empty($message)) {
|
if (!empty($message)) {
|
||||||
$this->err($message);
|
$this->err($message);
|
||||||
|
@ -596,27 +596,27 @@ class Shell extends Object {
|
||||||
$this->out();
|
$this->out();
|
||||||
|
|
||||||
if (is_file($path) && $this->interactive === true) {
|
if (is_file($path) && $this->interactive === true) {
|
||||||
$this->out(__('<warning>File `%s` exists</warning>', $path));
|
$this->out(__d('cake', '<warning>File `%s` exists</warning>', $path));
|
||||||
$key = $this->in(__('Do you want to overwrite?'), array('y', 'n', 'q'), 'n');
|
$key = $this->in(__d('cake', 'Do you want to overwrite?'), array('y', 'n', 'q'), 'n');
|
||||||
|
|
||||||
if (strtolower($key) == 'q') {
|
if (strtolower($key) == 'q') {
|
||||||
$this->out(__('<error>Quitting</error>.'), 2);
|
$this->out(__d('cake', '<error>Quitting</error>.'), 2);
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
} elseif (strtolower($key) != 'y') {
|
} elseif (strtolower($key) != 'y') {
|
||||||
$this->out(__('Skip `%s`', $path), 2);
|
$this->out(__d('cake', 'Skip `%s`', $path), 2);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->out(__('Creating file %s', $path));
|
$this->out(__d('cake', 'Creating file %s', $path));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($File = new File($path, true)) {
|
if ($File = new File($path, true)) {
|
||||||
$data = $File->prepare($contents);
|
$data = $File->prepare($contents);
|
||||||
$File->write($data);
|
$File->write($data);
|
||||||
$this->out(__('<success>Wrote</success> `%s`', $path));
|
$this->out(__d('cake', '<success>Wrote</success> `%s`', $path));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
$this->err(__('<error>Could not write to `%s`</error>.', $path), 2);
|
$this->err(__d('cake', '<error>Could not write to `%s`</error>.', $path), 2);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue