Merge branch '2.0' of github.com:cakephp/cakephp into 2.0

This commit is contained in:
Jose Lorenzo Rodriguez 2011-07-25 23:25:35 -04:30
commit 94f9ef63c6
34 changed files with 174 additions and 208 deletions

View file

@ -81,3 +81,6 @@
if ($namedConfig['rules'] === false) {
Router::connectNamed(true);
}
unset($namedConfig, $params, $indexParams, $prefix, $prefixes, $shortParams, $match,
$pluginPattern, $plugins, $key, $value);

View file

@ -23,14 +23,29 @@
* regards to boolean and null values.
*
* In addition to the native parse_ini_file features, IniReader also allows you
* to create nested array structures through usage of . delimited names. This allows
* to create nested array structures through usage of `.` delimited names. This allows
* you to create nested arrays structures in an ini config file. For example:
*
* `db.password = secret` would turn into `array('db' => array('password' => 'secret'))`
*
* You can nest properties as deeply as needed using .'s. IniReader also manipulates
* how the special ini values of 'yes', 'no', 'on', 'off', 'null' are handled.
* These values will be converted to their boolean equivalents.
* You can nest properties as deeply as needed using `.`'s. In addition to using `.` you
* can use standard ini section notation to create nested structures:
*
* {{{
* [section]
* key = value
* }}}
*
* Once loaded into Configure, the above would be accessed using:
*
* `Configure::read('section.key');
*
* You can combine `.` separated values with sections to create more deeply
* nested structures.
*
* IniReader also manipulates how the special ini values of
* 'yes', 'no', 'on', 'off', 'null' are handled. These values will be
* converted to their boolean equivalents.
*
* @package cake.config
* @see http://php.net/parse_ini_file
@ -56,7 +71,8 @@ class IniReader implements ConfigReaderInterface {
* ini files that are on the filesystem.
*
* @param string $path Path to load ini config files from.
* @param string $section Only get one section.
* @param string $section Only get one section, leave null to parse and fetch
* all sections in the ini file.
*/
public function __construct($path, $section = null) {
$this->_path = $path;
@ -66,7 +82,8 @@ class IniReader implements ConfigReaderInterface {
/**
* Read an ini file and return the results as an array.
*
* @param string $file Name of the file to read.
* @param string $file Name of the file to read. The chosen file
* must be on the reader's path.
* @return array
*/
public function read($file) {
@ -116,4 +133,4 @@ class IniReader implements ConfigReaderInterface {
}
return $values;
}
}
}

View file

@ -21,6 +21,9 @@
* PHP Reader allows Configure to load configuration values from
* files containing simple PHP arrays.
*
* Files compatible with PhpReader should define a `$config` variable, that
* contains all of the configuration data contained in the file.
*
* @package cake.libs.config
*/
class PhpReader implements ConfigReaderInterface {
@ -46,12 +49,11 @@ class PhpReader implements ConfigReaderInterface {
/**
* Read a config file and return its contents.
*
* Keys with `.` will be treated as values in plugins. Instead of reading from
* Files with `.` in the name will be treated as values in plugins. Instead of reading from
* the initialized path, plugin keys will be located using App::pluginPath().
*
*
* @param string $key The identifier to read from. If the key has a . it will be treated
* as a plugin prefix.
* as a plugin prefix.
* @return array Parsed configuration values.
* @throws ConfigureException when files don't exist or they don't contain `$config`.
* Or when files contain '..' as this could lead to abusive reads.

View file

@ -12,19 +12,18 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* This is a placeholder class.
* Create the same file in app/console/shells/AppShell.php
* Create the same file in app/Console/Command/AppShell.php
*
* Add your application-wide methods in the class below, your shells
* will inherit them.
*
* @package cake.console.libs
* @package Cake.Console
*/
class AppShell extends Shell {

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -24,7 +23,7 @@ App::uses('DbAcl', 'Model');
* Shell for ACL management. This console is known to have issues with zend.ze1_compatibility_mode
* being enabled. Be sure to turn it off when using this shell.
*
* @package cake.console.libs
* @package Cake.Console.Command
*/
class AclShell extends Shell {
@ -32,7 +31,6 @@ class AclShell extends Shell {
* Contains instance of AclComponent
*
* @var AclComponent
* @access public
*/
public $Acl;
@ -40,7 +38,6 @@ class AclShell extends Shell {
* Contains arguments parsed from the command line.
*
* @var array
* @access public
*/
public $args;
@ -48,7 +45,6 @@ class AclShell extends Shell {
* Contains database source to use
*
* @var string
* @access public
*/
public $connection = 'default';
@ -56,7 +52,6 @@ class AclShell extends Shell {
* Contains tasks to load and instantiate
*
* @var array
* @access public
*/
public $tasks = array('DbConfig');
@ -556,7 +551,6 @@ class AclShell extends Shell {
* get params for standard Acl methods
*
* @return array aro, aco, action
* @access private
*/
function __getParams() {
$aro = is_numeric($this->args[0]) ? intval($this->args[0]) : $this->args[0];
@ -585,7 +579,6 @@ class AclShell extends Shell {
*
* @param string $type Node type (ARO/ACO)
* @return array Variables
* @access private
*/
function __dataVars($type = null) {
if ($type == null) {

View file

@ -14,7 +14,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -23,7 +22,7 @@ App::uses('File', 'Utility');
/**
* API shell to show method signatures of CakePHP core classes.
*
* @package cake.console.libs
* @package Cake.Console.Command
*/
class ApiShell extends Shell {
@ -31,7 +30,6 @@ class ApiShell extends Shell {
* Map between short name for paths and real paths.
*
* @var array
* @access public
*/
public $paths = array();
@ -192,9 +190,8 @@ class ApiShell extends Shell {
* @param object $File File object
* @param string $class Class name
* @return array Methods and signatures indexed by method name
* @access private
*/
function __parseClass($path, $class) {
private function __parseClass($path, $class) {
$parsed = array();
if (!class_exists($class)) {

View file

@ -16,7 +16,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -26,7 +25,7 @@ App::uses('Model', 'Model');
/**
* Bake is a command-line code generation utility for automating programmer chores.
*
* @package cake.console.libs
* @package Cake.Console.Command
* @link http://book.cakephp.org/view/1522/Code-Generation-with-Bake
*/
class BakeShell extends Shell {
@ -35,7 +34,6 @@ class BakeShell extends Shell {
* Contains tasks to load and instantiate
*
* @var array
* @access public
*/
public $tasks = array('Project', 'DbConfig', 'Model', 'Controller', 'View', 'Plugin', 'Fixture', 'Test');

View file

@ -21,7 +21,7 @@ App::uses('Inflector', 'Utility');
/**
* Shows a list of commands available from the console.
*
* @package cake.console.shells
* @package Cake.Console.Command
*/
class CommandListShell extends Shell {

View file

@ -12,13 +12,14 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* @package cake.console.shells
* Provides a very basic 'interactive' console for CakePHP apps.
*
* @package Cake.Console.Command
*/
class ConsoleShell extends Shell {
@ -26,7 +27,6 @@ class ConsoleShell extends Shell {
* Available binding types
*
* @var array
* @access public
*/
public $associations = array('hasOne', 'hasMany', 'belongsTo', 'hasAndBelongsToMany');
@ -34,7 +34,6 @@ class ConsoleShell extends Shell {
* Chars that describe invalid commands
*
* @var array
* @access public
*/
public $badCommandChars = array('$', ';');
@ -42,7 +41,6 @@ class ConsoleShell extends Shell {
* Available models
*
* @var array
* @access public
*/
public $models = array();

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5669
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -20,7 +19,7 @@
/**
* Shell for I18N management.
*
* @package cake.console.shells
* @package Cake.Console.Command
*/
class I18nShell extends Shell {
@ -28,7 +27,6 @@ class I18nShell extends Shell {
* Contains database source to use
*
* @var string
* @access public
*/
public $dataSource = 'default';
@ -36,7 +34,6 @@ class I18nShell extends Shell {
* Contains tasks to load and instantiate
*
* @var array
* @access public
*/
public $tasks = array('DbConfig', 'Extract');

View file

@ -15,7 +15,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5550
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -26,7 +25,7 @@ App::uses('CakeSchema', 'Model');
/**
* Schema is a command-line database management utility for automating programmer chores.
*
* @package cake.console.shells
* @package Cake.Console.Command
* @link http://book.cakephp.org/view/1523/Schema-management-and-migrations
*/
class SchemaShell extends Shell {
@ -35,7 +34,6 @@ class SchemaShell extends Shell {
* is this a dry run?
*
* @var boolean
* @access private
*/
private $__dry = null;
@ -302,7 +300,6 @@ class SchemaShell extends Shell {
* Create database from Schema object
* Should be called via the run method
*
* @access private
*/
function __create($Schema, $table = null) {
$db = ConnectionManager::getDataSource($this->Schema->connection);
@ -345,7 +342,6 @@ class SchemaShell extends Shell {
* Update database with Schema object
* Should be called via the run method
*
* @access private
*/
function __update(&$Schema, $table = null) {
$db = ConnectionManager::getDataSource($this->Schema->connection);
@ -387,7 +383,6 @@ class SchemaShell extends Shell {
/**
* Runs sql from __create() or __update()
*
* @access private
*/
function __run($contents, $event, &$Schema) {
if (empty($contents)) {

View file

@ -12,10 +12,14 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Base class for Bake Tasks.
*
* @package Cake.Console.Command.Task
*/
class BakeTask extends Shell {
/**

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -23,7 +22,7 @@ App::uses('AppModel', 'Model');
/**
* Task class for creating and updating controller files.
*
* @package cake.console.shells.tasks
* @package Cake.Console.Command.Task
*/
class ControllerTask extends BakeTask {
@ -31,7 +30,6 @@ class ControllerTask extends BakeTask {
* Tasks to be loaded by this Task
*
* @var array
* @access public
*/
public $tasks = array('Model', 'Test', 'Template', 'DbConfig', 'Project');
@ -39,7 +37,6 @@ class ControllerTask extends BakeTask {
* path to Controller directory
*
* @var array
* @access public
*/
public $path = null;
@ -265,7 +262,6 @@ class ControllerTask extends BakeTask {
* @param string $admin Admin route to use
* @param boolean $wannaUseSession Set to true to use sessions, false otherwise
* @return string Baked actions
* @access private
*/
public function bakeActions($controllerName, $admin = null, $wannaUseSession = true) {
$currentModelName = $modelImport = $this->_modelName($controllerName);

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -20,7 +19,7 @@
/**
* Task class for creating and updating the database configuration file.
*
* @package cake.console.shells.tasks
* @package Cake.Console.Command.Task
*/
class DbConfigTask extends Shell {

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -22,7 +21,7 @@ App::uses('Folder', 'Utility');
/**
* Language string extractor
*
* @package cake.console.shells.tasks
* @package Cake.Console.Command.Task
*/
class ExtractTask extends Shell {
@ -30,7 +29,6 @@ class ExtractTask extends Shell {
* Paths to use when looking for strings
*
* @var string
* @access protected
*/
protected $_paths = array();
@ -38,7 +36,6 @@ class ExtractTask extends Shell {
* Files from where to extract
*
* @var array
* @access protected
*/
protected $_files = array();
@ -46,7 +43,6 @@ class ExtractTask extends Shell {
* Merge all domains string into the default.pot file
*
* @var boolean
* @access protected
*/
protected $_merge = false;
@ -54,7 +50,6 @@ class ExtractTask extends Shell {
* Current file being processed
*
* @var string
* @access protected
*/
protected $_file = null;
@ -62,7 +57,6 @@ class ExtractTask extends Shell {
* Contains all content waiting to be write
*
* @var string
* @access protected
*/
protected $_storage = array();
@ -70,7 +64,6 @@ class ExtractTask extends Shell {
* Extracted tokens
*
* @var array
* @access protected
*/
protected $_tokens = array();
@ -78,7 +71,6 @@ class ExtractTask extends Shell {
* Extracted strings
*
* @var array
* @access protected
*/
protected $_strings = array();
@ -86,7 +78,6 @@ class ExtractTask extends Shell {
* Destination path
*
* @var string
* @access protected
*/
protected $_output = null;
@ -115,7 +106,6 @@ class ExtractTask extends Shell {
* Execution method always used for tasks
*
* @return void
* @access public
*/
public function execute() {
if (!empty($this->params['exclude'])) {
@ -204,7 +194,6 @@ class ExtractTask extends Shell {
* Extract text
*
* @return void
* @access protected
*/
protected function _extract() {
$this->out();
@ -269,7 +258,6 @@ class ExtractTask extends Shell {
* Extract tokens out of all files to be processed
*
* @return void
* @access protected
*/
protected function _extractTokens() {
foreach ($this->_files as $file) {
@ -302,7 +290,6 @@ class ExtractTask extends Shell {
* @param string $functionName Function name that indicates translatable string (e.g: '__')
* @param array $map Array containing what variables it will find (e.g: domain, singular, plural)
* @return void
* @access protected
*/
protected function _parse($functionName, $map) {
$count = 0;
@ -413,7 +400,6 @@ class ExtractTask extends Shell {
* Build the translate template file contents out of obtained strings
*
* @return void
* @access protected
*/
protected function _buildFiles() {
foreach ($this->_strings as $domain => $strings) {
@ -448,7 +434,6 @@ class ExtractTask extends Shell {
* Prepare a file to be stored
*
* @return void
* @access protected
*/
protected function _store($domain, $header, $sentence) {
if (!isset($this->_storage[$domain])) {
@ -465,7 +450,6 @@ class ExtractTask extends Shell {
* Write the files that need to be stored
*
* @return void
* @access protected
*/
protected function _writeFiles() {
$overwriteAll = false;
@ -501,7 +485,6 @@ class ExtractTask extends Shell {
* Build the translation template header
*
* @return string Translation template header
* @access protected
*/
protected function _writeHeader() {
$output = "# LANGUAGE translation of CakePHP Application\n";
@ -528,7 +511,6 @@ class ExtractTask extends Shell {
* @param int $position Actual position on tokens array
* @param int $target Number of strings to extract
* @return array Strings extracted
* @access protected
*/
protected function _getStrings(&$position, $target) {
$strings = array();
@ -555,7 +537,6 @@ class ExtractTask extends Shell {
*
* @param string $string String to format
* @return string Formatted string
* @access protected
*/
protected function _formatString($string) {
$quote = substr($string, 0, 1);
@ -577,7 +558,6 @@ class ExtractTask extends Shell {
* @param string $marker Marker found
* @param integer $count Count
* @return void
* @access protected
*/
protected function _markerError($file, $line, $marker, $count) {
$this->out(__d('cake_console', "Invalid marker content in %s:%s\n* %s(", $file, $line, $marker), true);
@ -607,7 +587,6 @@ class ExtractTask extends Shell {
* Search files that may contain translatable strings
*
* @return void
* @access protected
*/
protected function _searchFiles() {
$pattern = false;

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -23,7 +22,7 @@ App::uses('Model', 'Model');
/**
* Task class for creating and updating fixtures files.
*
* @package cake.console.shells.tasks
* @package Cake.Console.Command.Task
*/
class FixtureTask extends BakeTask {
@ -31,7 +30,6 @@ class FixtureTask extends BakeTask {
* Tasks to be loaded by this Task
*
* @var array
* @access public
*/
public $tasks = array('DbConfig', 'Model', 'Template');
@ -39,7 +37,6 @@ class FixtureTask extends BakeTask {
* path to fixtures directory
*
* @var string
* @access public
*/
public $path = null;
@ -47,7 +44,6 @@ class FixtureTask extends BakeTask {
* Schema instance
*
* @var object
* @access protected
*/
protected $_Schema = null;

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -25,7 +24,7 @@ App::uses('Validation', 'Utility');
/**
* Task class for creating and updating model files.
*
* @package cake.console.shells.tasks
* @package Cake.Console.Command.Task
*/
class ModelTask extends BakeTask {
@ -33,7 +32,6 @@ class ModelTask extends BakeTask {
* path to Model directory
*
* @var string
* @access public
*/
public $path = null;
@ -41,7 +39,6 @@ class ModelTask extends BakeTask {
* tasks
*
* @var array
* @access public
*/
public $tasks = array('DbConfig', 'Fixture', 'Test', 'Template');
@ -49,7 +46,6 @@ class ModelTask extends BakeTask {
* Tables to skip when running all()
*
* @var array
* @access protected
*/
public $skipTables = array('i18n');
@ -57,7 +53,6 @@ class ModelTask extends BakeTask {
* Holds tables found on connection.
*
* @var array
* @access protected
*/
protected $_tables = array();
@ -65,7 +60,6 @@ class ModelTask extends BakeTask {
* Holds validation method map.
*
* @var array
* @access protected
*/
protected $_validations = array();
@ -172,7 +166,6 @@ class ModelTask extends BakeTask {
/**
* Handles interactive baking
*
* @access private
*/
protected function _interactive() {
$this->hr();

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -23,7 +22,7 @@ App::uses('Folder', 'Utility');
/**
* Task class for creating a plugin
*
* @package cake.console.shells.tasks
* @package Cake.Console.Command.Task
*/
class PluginTask extends Shell {
@ -31,7 +30,6 @@ class PluginTask extends Shell {
* path to plugins directory
*
* @var array
* @access public
*/
public $path = null;
@ -67,7 +65,6 @@ class PluginTask extends Shell {
/**
* Interactive interface
*
* @access private
* @return void
*/
protected function _interactive($plugin = null) {
@ -84,7 +81,6 @@ class PluginTask extends Shell {
* Bake the plugin, create directories and files
*
* @params $plugin name of the plugin in CamelCased format
* @access public
* @return bool
*/
public function bake($plugin) {

View file

@ -13,7 +13,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -26,7 +25,7 @@ App::uses('Security', 'Utility');
/**
* Task class for creating new project apps and plugins
*
* @package cake.console.shells.tasks
* @package Cake.Console.Command.Task
*/
class ProjectTask extends Shell {
@ -138,7 +137,6 @@ class ProjectTask extends Shell {
* @param string $path Project path
* @param string $skel Path to copy from
* @param string $skip array of directories to skip when copying
* @access private
*/
public function bake($path, $skel = null, $skip = array('empty')) {
if (!$skel && !empty($this->params['skel'])) {

View file

@ -12,13 +12,17 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('Folder', 'Utility');
/**
* Template Task can generate templated output Used in other Tasks.
* Acts like a simplified View class.
*
* @package Cake.Console.Command.Task
*/
class TemplateTask extends Shell {
/**
@ -39,7 +43,6 @@ class TemplateTask extends Shell {
/**
* Initialize callback. Setup paths for the template task.
*
* @access public
* @return void
*/
public function initialize() {
@ -127,7 +130,6 @@ class TemplateTask extends Shell {
* @param string $directory directory / type of thing you want
* @param string $filename template name
* @param string $vars Additional vars to set to template scope.
* @access public
* @return contents of generated code template
*/
public function generate($directory, $filename, $vars = null) {
@ -192,7 +194,6 @@ class TemplateTask extends Shell {
* @param string $path The initial path to look for the file on. If it is not found fallbacks will be used.
* @param string $directory Subdirectory to look for ie. 'views', 'objects'
* @param string $filename lower_case_underscored filename you want.
* @access public
* @return string filename will exit program if template is not found.
*/
protected function _findTemplate($path, $directory, $filename) {

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells.tasks
* @since CakePHP(tm) v 1.3
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -23,7 +22,7 @@ App::uses('ClassRegistry', 'Utility');
/**
* Task class for creating and updating test files.
*
* @package cake.console.shells.tasks
* @package Cake.Console.Command.Task
*/
class TestTask extends BakeTask {
@ -31,7 +30,6 @@ class TestTask extends BakeTask {
* path to TESTS directory
*
* @var string
* @access public
*/
public $path = TESTS;
@ -39,7 +37,6 @@ class TestTask extends BakeTask {
* Tasks used.
*
* @var array
* @access public
*/
public $tasks = array('Template');
@ -47,7 +44,6 @@ class TestTask extends BakeTask {
* class types that methods can be generated for
*
* @var array
* @access public
*/
public $classTypes = array(
'Model' => 'Model',
@ -61,7 +57,6 @@ class TestTask extends BakeTask {
* Internal list of fixtures that have been added so far.
*
* @var string
* @access protected
*/
protected $_fixtures = array();
@ -90,7 +85,6 @@ class TestTask extends BakeTask {
/**
* Handles interactive baking
*
* @access private
*/
protected function _interactive($type = null) {
$this->interactive = true;

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs.tasks
* @since CakePHP(tm) v 1.2
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -23,7 +22,7 @@ App::uses('BakeTask', 'Console/Command/Task');
/**
* Task class for creating and updating view files.
*
* @package cake.console.shells.tasks
* @package Cake.Console.Command.Task
*/
class ViewTask extends BakeTask {
@ -31,7 +30,6 @@ class ViewTask extends BakeTask {
* Tasks to be loaded by this Task
*
* @var array
* @access public
*/
public $tasks = array('Project', 'Controller', 'DbConfig', 'Template');
@ -39,7 +37,6 @@ class ViewTask extends BakeTask {
* path to View directory
*
* @var array
* @access public
*/
public $path = null;
@ -47,7 +44,6 @@ class ViewTask extends BakeTask {
* Name of the controller being used
*
* @var string
* @access public
*/
public $controllerName = null;
@ -55,7 +51,6 @@ class ViewTask extends BakeTask {
* The template file to use
*
* @var string
* @access public
*/
public $template = null;
@ -63,7 +58,6 @@ class ViewTask extends BakeTask {
* Actions to use for scaffolding
*
* @var array
* @access public
*/
public $scaffoldActions = array('index', 'view', 'add', 'edit');
@ -72,7 +66,6 @@ class ViewTask extends BakeTask {
* actions will not emit errors when doing bakeActions()
*
* @var array
* @access public
*/
public $noTemplateActions = array('delete');
@ -253,7 +246,6 @@ class ViewTask extends BakeTask {
* 'belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany'
*
* @return array Returns an variables to be made available to a view template
* @access private
*/
private function __loadController() {
if (!$this->controllerName) {
@ -445,7 +437,6 @@ class ViewTask extends BakeTask {
* Returns associations for controllers models.
*
* @return array $associations
* @access private
*/
private function __associations($model) {
$keys = array('belongsTo', 'hasOne', 'hasMany', 'hasAndBelongsToMany');

View file

@ -14,7 +14,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://book.cakephp.org/view/1196/Testing CakePHP(tm) Tests
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.4433
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -24,6 +23,12 @@ App::uses('CakeTestSuiteDispatcher', 'TestSuite');
App::uses('CakeTestSuiteCommand', 'TestSuite');
App::uses('CakeTestLoader', 'TestSuite');
/**
* Provides a CakePHP wrapper around PHPUnit.
* Adds in CakePHP's fixtures and gives access to plugin, app and core test cases
*
* @package Cake.Console.Command
*/
class TestsuiteShell extends Shell {
/**
@ -318,4 +323,4 @@ class TestsuiteShell extends Shell {
}
}
}
}
}

View file

@ -1,12 +1,11 @@
<?php
App::uses('Folder', 'Utility');
/**
* A shell class to help developers upgrade applications to CakePHP 2.0
*
* @package cake.console/shells
* @package Cake.Console.Command
*/
App::uses('Folder', 'Utility');
class UpgradeShell extends Shell {
protected $_files = array();
@ -47,7 +46,6 @@ class UpgradeShell extends Shell {
/**
* Run all upgrade steps one at a time
*
* @access public
* @return void
*/
public function all() {
@ -68,7 +66,6 @@ class UpgradeShell extends Shell {
* and then looks for all php files except vendors, and moves them to where Cake 2.0 expects
* to find them.
*
* @access public
* @return void
*/
public function locations() {
@ -341,7 +338,6 @@ class UpgradeShell extends Shell {
/**
* constants
*
* @access public
* @return void
*/
public function constants() {
@ -452,7 +448,6 @@ class UpgradeShell extends Shell {
*
* @param mixed $path
* @param mixed $options array(recursive, checkFolder)
* @access protected
* @return void
*/
protected function _movePhpFiles($path, $options) {

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -24,7 +23,7 @@ App::uses('CakeLog', 'Log');
* Error Handler for Cake console. Does simple printing of the
* exception that occurred and the stack trace of the error.
*
* @package cake.console.libs
* @package Cake.Console
*/
class ConsoleErrorHandler extends ErrorHandler {
@ -64,7 +63,8 @@ class ConsoleErrorHandler extends ErrorHandler {
}
/**
* Handle errors in the console environment.
* Handle errors in the console environment. Writes errors to stderr,
* and logs messages if Configure::read('debug') is 0.
*
* @param int $code Error code
* @param string $description Description of the error.

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -21,7 +20,7 @@
* ConsoleOptionParser creates these when you use addArgument()
*
* @see ConsoleOptionParser::addArgument()
* @package cake.console.libs
* @package Cake.Console
*/
class ConsoleInputArgument {
/**

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -22,7 +21,7 @@
* ConsoleOptionParser creates these when you use addOption()
*
* @see ConsoleOptionParser::addOption()
* @package cake.console.libs
* @package Cake.Console
*/
class ConsoleInputOption {
/**

View file

@ -12,17 +12,16 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* An object to represent a single subcommand used in the command line.
* ConsoleOptionParser creates these when you use addSubcommand()
* Created when you call ConsoleOptionParser::addSubcommand()
*
* @see ConsoleOptionParser::addSubcommand()
* @package cake.console.libs
* @package Cake.Console
*/
class ConsoleInputSubcommand {

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -31,7 +30,42 @@ App::uses('HelpFormatter', 'Console');
* for GetOpt compatible option definition. Provides a builder pattern implementation
* for creating shell option parsers.
*
* @package cake.console.libs
* ### Options
*
* Named arguments come in two forms, long and short. Long arguments are preceded
* by two - and give a more verbose option name. i.e. `--version`. Short arguments are
* preceded by one - and are only one character long. They usually match with a long option,
* and provide a more terse alternative.
*
* ### Using Options
*
* Options can be defined with both long and short forms. By using `$parser->addOption()`
* you can define new options. The name of the option is used as its long form, and you
* can supply an additional short form, with the `short` option.
*
* Calling options can be done using syntax similar to most *nix command line tools. Long options
* cane either include an `=` or leave it out.
*
* `cake myshell command --connection default --name=something`
*
* Short options can be defined signally or in groups.
*
* `cake myshell command -cn`
*
* ### Positional arguments
*
* If no positional arguments are defined, all of them will be parsed. If you define positional
* arguments any arguments greater than those defined will cause exceptions. Additionally you can
* declare arguments as optional, by setting the required param to false.
*
* `$parser->addArgument('model', array('required' => false));`
*
* ### Providing Help text
*
* By providing help text for your positional arguments and named arguments, the ConsoleOptionParser
* can generate a help display for you. You can view the help for shells by using the `--help` or `-h` switch.
*
* @package Cake.Console
*/
class ConsoleOptionParser {
@ -77,6 +111,7 @@ class ConsoleOptionParser {
/**
* Subcommands for this Shell.
*
* @see ConsoleOptionParser::addSubcommand()
* @var array
*/
protected $_subcommands = array();
@ -84,43 +119,9 @@ class ConsoleOptionParser {
/**
* Construct an OptionParser so you can define its behavior
*
* ### Options
*
* Named arguments come in two forms, long and short. Long arguments are preceded
* by two - and give a more verbose option name. i.e. `--version`. Short arguments are
* preceded by one - and are only one character long. They usually match with a long option,
* and provide a more terse alternative.
*
* ### Using Options
*
* Options can be defined with both long and short forms. By using `$parser->addOption()`
* you can define new options. The name of the option is used as its long form, and you
* can supply an additional short form, with the `short` option.
*
* Calling options can be done using syntax similar to most *nix command line tools. Long options
* cane either include an `=` or leave it out.
*
* `cake myshell command --connection default --name=something`
*
* Short options can be defined signally or in groups.
*
* `cake myshell command -cn`
*
* ### Positional arguments
*
* If no positional arguments are defined, all of them will be parsed. If you define positional
* arguments any arguments greater than those defined will cause exceptions. Additionally you can
* declare arguments as optional, by setting the required param to false.
*
* `$parser->addArgument('model', array('required' => false));`
*
* ### Providing Help text
*
* By providing help text for your positional arguments and named arguments, the ConsoleOptionParser
* can generate a help display for you. You can view the help for shells by using the `--help` or `-h` switch.
*
* @param string $command The command name this parser is for. The command name is used for generating help.
* @param boolean $defaultOptions Whether you want the verbose and quiet options set.
* @param boolean $defaultOptions Whether you want the verbose and quiet options set. Setting
* this to false will prevent the addition of `--verbose` & `--quiet` options.
*/
public function __construct($command = null, $defaultOptions = true) {
$this->_command = $command;
@ -214,7 +215,8 @@ class ConsoleOptionParser {
/**
* Get or set the description text for shell/task.
*
* @param mixed $text The text to set, or null if you want to read. . If an array the text will be imploded with "\n"
* @param mixed $text The text to set, or null if you want to read. If an array the
* text will be imploded with "\n"
* @return mixed If reading, the value of the description. If setting $this will be returned
*/
public function description($text = null) {

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -41,7 +40,7 @@
* See ConsoleOutput::styles() to learn more about defining your own styles. Nested styles are not supported
* at this time.
*
* @package cake.console.libs
* @package Cake.Console
*/
class ConsoleOutput {
/**
@ -285,4 +284,4 @@ class ConsoleOutput {
public function __destruct() {
fclose($this->_output);
}
}
}

View file

@ -25,8 +25,8 @@ App::uses('String', 'Utility');
*
* Xml output is useful for integration with other tools like IDE's or other build tools.
*
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @package Cake.Console
* @since CakePHP(tm) v 2.0
*/
class HelpFormatter {
/**
@ -171,4 +171,4 @@ class HelpFormatter {
}
return $string ? $xml->asXml() : $xml;
}
}
}

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.shells
* @since CakePHP(tm) v 1.2.0.5012
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -27,7 +26,7 @@ App::uses('File', 'Utility');
/**
* Base class for command-line utilities for automating programmer chores.
*
* @package cake.console.shells
* @package Cake.Console
*/
class Shell extends Object {
@ -72,7 +71,6 @@ class Shell extends Object {
* Contains arguments parsed from the command line.
*
* @var array
* @access public
*/
public $args = array();
@ -80,7 +78,6 @@ class Shell extends Object {
* The name of the shell in camelized.
*
* @var string
* @access public
*/
public $name = null;
@ -88,7 +85,6 @@ class Shell extends Object {
* Contains tasks to load and instantiate
*
* @var array
* @access public
*/
public $tasks = array();
@ -96,7 +92,6 @@ class Shell extends Object {
* Contains the loaded tasks
*
* @var array
* @access public
*/
public $taskNames = array();
@ -104,7 +99,6 @@ class Shell extends Object {
* Contains models to load and instantiate
*
* @var array
* @access public
*/
public $uses = array();
@ -146,6 +140,9 @@ class Shell extends Object {
/**
* Constructs this Shell instance.
*
* @param ConsoleOutput $stdout A ConsoleOutput object for stdout.
* @param ConsoleOutput $stderr A ConsoleOutput object for stderr.
* @param ConsoleInput $stdin A ConsoleInput object for stdin.
*/
function __construct($stdout = null, $stderr = null, $stdin = null) {
if ($this->name == null) {
@ -180,16 +177,20 @@ class Shell extends Object {
* acts as constructor for subclasses
* allows configuration of tasks prior to shell execution
*
* @return void
*/
public function initialize() {
$this->_loadModels();
}
/**
* Starts up the Shell
* allows for checking and configuring prior to command or main execution
* can be overridden in subclasses
* Starts up the Shell and displays the welcome message.
* Allows for checking and configuring prior to command or main execution
*
* Override this method if you want to remove the welcome information,
* or otherwise modify the pre-command flow.
*
* @return void
*/
public function startup() {
$this->_welcome();
@ -198,6 +199,7 @@ class Shell extends Object {
/**
* Displays a header for the shell
*
* @return void
*/
protected function _welcome() {
$this->out();
@ -209,10 +211,10 @@ class Shell extends Object {
}
/**
* if public $uses = true
* If $uses = true
* Loads AppModel file and constructs AppModel class
* makes $this->AppModel available to subclasses
* if public $uses is an array of models will load those models
* If public $uses is an array of models will load those models
*
* @return bool
*/
@ -300,6 +302,10 @@ class Shell extends Object {
*
* `return $this->dispatchShell('schema create DbAcl');`
*
* Avoid using this form if you have string arguments, with spaces in them.
* The dispatched will be invoked incorrectly. Only use this form for simple
* command dispatching.
*
* With an array command:
*
* `return $this->dispatchShell('schema', 'create', 'i18n', '--dry');`
@ -319,8 +325,20 @@ class Shell extends Object {
}
/**
* Runs the Shell with the provided argv
* Runs the Shell with the provided argv.
*
* Delegates calls to Tasks and resolves methods inside the class. Commands are looked
* up with the following order:
*
* - Method on the shell.
* - Matching task name.
* - `main()` method.
*
* If a shell implements a `main()` method, all missing method calls will be sent to
* `main()` with the original method name in the argv.
*
* @param string $command The command name to run on this shell. If this argument is empty,
* and the shell has a `main()` method, that will be called instead.
* @param array $argv Array of arguments to run the shell with. This array should be missing the shell name.
* @return void
*/

View file

@ -12,7 +12,6 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
@ -20,7 +19,7 @@
/**
* Shell dispatcher handles dispatching cli commands.
*
* @package cake.console
* @package Cake.Console
*/
class ShellDispatcher {
@ -28,7 +27,6 @@ class ShellDispatcher {
* Contains command switches parsed from the command line.
*
* @var array
* @access public
*/
public $params = array();
@ -36,7 +34,6 @@ class ShellDispatcher {
* Contains arguments parsed from the command line.
*
* @var array
* @access public
*/
public $args = array();
@ -46,14 +43,15 @@ class ShellDispatcher {
* The execution of the script is stopped after dispatching the request with
* a status code of either 0 or 1 according to the result of the dispatch.
*
* @param array $args the argv
* @param array $args the argv from PHP
* @param bool $bootstrap Should the environment be bootstrapped.
* @return void
*/
public function __construct($args = array(), $bootstrap = true) {
set_time_limit(0);
if ($bootstrap) {
$this->__initConstants();
$this->_initConstants();
}
$this->parseParams($args);
if ($bootstrap) {
@ -64,6 +62,7 @@ class ShellDispatcher {
/**
* Run the dispatcher
*
* @param array $argv The argv from PHP
* @return void
*/
public static function run($argv) {
@ -74,9 +73,9 @@ class ShellDispatcher {
/**
* Defines core configuration.
*
* @access private
* @return void
*/
function __initConstants() {
protected function _initConstants() {
if (function_exists('ini_set')) {
ini_set('html_errors', false);
ini_set('implicit_flush', true);
@ -96,6 +95,7 @@ class ShellDispatcher {
/**
* Defines current working environment.
*
* @return void
*/
protected function _initEnvironment() {
if (!$this->__bootstrap()) {
@ -118,10 +118,8 @@ class ShellDispatcher {
* Initializes the environment and loads the Cake core.
*
* @return boolean Success.
* @access private
*/
function __bootstrap() {
private function __bootstrap() {
define('ROOT', $this->params['root']);
define('APP_DIR', $this->params['app']);
define('APP_PATH', $this->params['working'] . DS);
@ -308,6 +306,7 @@ class ShellDispatcher {
/**
* Shows console help. Performs an internal dispatch to the CommandList Shell
*
* @return void
*/
public function help() {
$this->args = array_merge(array('command_list'), $this->args);

View file

@ -11,13 +11,18 @@
*
* @copyright Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @package cake.console.libs
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('ObjectCollection', 'Utility');
/**
* Collection object for Tasks. Provides features
* for lazily loading tasks, and firing callbacks on loaded tasks.
*
* @package Cake.Console
*/
class TaskCollection extends ObjectCollection {
/**
* Shell to use to set params to tasks.