From e3690ebccba6f8b29f50c4ffbc69d7869a805112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20Lorenzo=20Rodri=CC=81guez?= Date: Tue, 7 Dec 2010 01:26:10 -0430 Subject: [PATCH] Making shells run again --- lib/Cake/Console/Command/CommandListShell.php | 8 ++++---- lib/Cake/Console/ConsoleErrorHandler.php | 4 ++-- lib/Cake/Console/ConsoleOptionParser.php | 9 +++++---- lib/Cake/Console/Shell.php | 9 +++++---- lib/Cake/Console/ShellDispatcher.php | 13 +++++-------- lib/Cake/Console/TaskCollection.php | 2 +- lib/Cake/Console/cake.php | 2 +- lib/Cake/Core/App.php | 2 +- lib/Cake/Core/Configure.php | 2 +- lib/Cake/I18n/L10n.php | 2 +- lib/Cake/bootstrap.php | 4 ++-- {cake => lib/Cake}/config/config.php | 0 .../Cake}/config/unicode/casefolding/0080_00ff.php | 0 .../Cake}/config/unicode/casefolding/0100_017f.php | 0 .../Cake}/config/unicode/casefolding/0180_024F.php | 0 .../Cake}/config/unicode/casefolding/0250_02af.php | 0 .../Cake}/config/unicode/casefolding/0370_03ff.php | 0 .../Cake}/config/unicode/casefolding/0400_04ff.php | 0 .../Cake}/config/unicode/casefolding/0500_052f.php | 0 .../Cake}/config/unicode/casefolding/0530_058f.php | 0 .../Cake}/config/unicode/casefolding/1e00_1eff.php | 0 .../Cake}/config/unicode/casefolding/1f00_1fff.php | 0 .../Cake}/config/unicode/casefolding/2100_214f.php | 0 .../Cake}/config/unicode/casefolding/2150_218f.php | 0 .../Cake}/config/unicode/casefolding/2460_24ff.php | 0 .../Cake}/config/unicode/casefolding/2c00_2c5f.php | 0 .../Cake}/config/unicode/casefolding/2c60_2c7f.php | 0 .../Cake}/config/unicode/casefolding/2c80_2cff.php | 0 .../Cake}/config/unicode/casefolding/ff00_ffef.php | 0 29 files changed, 28 insertions(+), 29 deletions(-) rename {cake => lib/Cake}/config/config.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/0080_00ff.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/0100_017f.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/0180_024F.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/0250_02af.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/0370_03ff.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/0400_04ff.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/0500_052f.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/0530_058f.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/1e00_1eff.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/1f00_1fff.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/2100_214f.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/2150_218f.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/2460_24ff.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/2c00_2c5f.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/2c60_2c7f.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/2c80_2cff.php (100%) rename {cake => lib/Cake}/config/unicode/casefolding/ff00_ffef.php (100%) diff --git a/lib/Cake/Console/Command/CommandListShell.php b/lib/Cake/Console/Command/CommandListShell.php index cd05af4ba..4df4dc847 100644 --- a/lib/Cake/Console/Command/CommandListShell.php +++ b/lib/Cake/Console/Command/CommandListShell.php @@ -18,6 +18,8 @@ * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ +App::uses('Shell', 'Console'); + /** * Shows a list of commands available from the console. * @@ -111,10 +113,8 @@ class CommandListShell extends Shell { continue; } foreach ($shells as $shell) { - if ($shell !== 'shell.php' && $shell !== 'app_shell.php') { - $shell = str_replace('.php', '', $shell); - $shellList[$shell][$type] = $type; - } + $shell = str_replace('Shell.php', '', $shell); + $shellList[$shell][$type] = $type; } } return $shellList; diff --git a/lib/Cake/Console/ConsoleErrorHandler.php b/lib/Cake/Console/ConsoleErrorHandler.php index 120c09d74..9eaebb2e5 100644 --- a/lib/Cake/Console/ConsoleErrorHandler.php +++ b/lib/Cake/Console/ConsoleErrorHandler.php @@ -17,8 +17,8 @@ * @since CakePHP(tm) v 2.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -App::import('Core', 'ErrorHandler'); -require_once 'console_output.php'; +App::uses('ErrorHandler', 'Error'); +App::uses('ConsoleOutput', 'Console'); /** * Error Handler for Cake console. Does simple printing of the diff --git a/lib/Cake/Console/ConsoleOptionParser.php b/lib/Cake/Console/ConsoleOptionParser.php index 8a9f8af65..8eec763d6 100644 --- a/lib/Cake/Console/ConsoleOptionParser.php +++ b/lib/Cake/Console/ConsoleOptionParser.php @@ -17,10 +17,11 @@ * @since CakePHP(tm) v 2.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -require_once CONSOLE_LIBS . 'console_input_option.php'; -require_once CONSOLE_LIBS . 'console_input_argument.php'; -require_once CONSOLE_LIBS . 'console_input_subcommand.php'; -require_once CONSOLE_LIBS . 'help_formatter.php'; +App::uses('TaskCollection', 'Console'); +App::uses('ConsoleOutput', 'Console'); +App::uses('ConsoleInput', 'Console'); +App::uses('ConsoleInputOption', 'Console'); +App::uses('ConsoleOptionParser', 'Console'); /** * Handles parsing the ARGV in the command line and provides support diff --git a/lib/Cake/Console/Shell.php b/lib/Cake/Console/Shell.php index 55c81f94d..4f40bc8de 100644 --- a/lib/Cake/Console/Shell.php +++ b/lib/Cake/Console/Shell.php @@ -17,10 +17,11 @@ * @since CakePHP(tm) v 1.2.0.5012 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -require_once CONSOLE_LIBS . 'task_collection.php'; -require_once CONSOLE_LIBS . 'console_output.php'; -require_once CONSOLE_LIBS . 'console_input.php'; -require_once CONSOLE_LIBS . 'console_option_parser.php'; + +App::uses('TaskCollection', 'Console'); +App::uses('ConsoleOutput', 'Console'); +App::uses('ConsoleInput', 'Console'); +App::uses('ConsoleOptionParser', 'Console'); /** * Base class for command-line utilities for automating programmer chores. diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php index a80407613..ad75dd1d7 100644 --- a/lib/Cake/Console/ShellDispatcher.php +++ b/lib/Cake/Console/ShellDispatcher.php @@ -133,13 +133,13 @@ class ShellDispatcher { } $boot = file_exists(ROOT . DS . APP_DIR . DS . 'config' . DS . 'bootstrap.php'); - require CORE_PATH . 'cake' . DS . 'bootstrap.php'; + require CORE_PATH . 'Cake' . DS . 'bootstrap.php'; if (!file_exists(APP_PATH . 'config' . DS . 'core.php')) { include_once CAKE_CORE_INCLUDE_PATH . DS . 'cake' . DS . 'console' . DS . 'templates' . DS . 'skel' . DS . 'config' . DS . 'core.php'; App::build(); } - require_once CONSOLE_LIBS . 'console_error_handler.php'; + require_once CONSOLE_LIBS . 'ConsoleErrorHandler.php'; set_exception_handler(array('ConsoleErrorHandler', 'handleException')); set_error_handler(array('ConsoleErrorHandler', 'handleError'), Configure::read('Error.level')); @@ -209,14 +209,11 @@ class ShellDispatcher { protected function _getShell($shell) { list($plugin, $shell) = pluginSplit($shell, true); - $loaded = App::import('Shell', $plugin . $shell); $class = Inflector::camelize($shell) . 'Shell'; - - if (!$loaded) { - throw new MissingShellFileException(array('shell' => $shell)); - } + $loaded = App::uses($class, $plugin . 'Console/Command'); + if (!class_exists($class)) { - throw new MissingShellClassException(array('shell' => $class)); + throw new MissingShellFileException(array('shell' => $shell)); } $Shell = new $class(); return $Shell; diff --git a/lib/Cake/Console/TaskCollection.php b/lib/Cake/Console/TaskCollection.php index d28b13b6d..00a1c4b54 100644 --- a/lib/Cake/Console/TaskCollection.php +++ b/lib/Cake/Console/TaskCollection.php @@ -16,7 +16,7 @@ * @since CakePHP(tm) v 2.0 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -App::import('Core', 'ObjectCollection'); +App::uses('ObjectCollection', 'Utility'); class TaskCollection extends ObjectCollection { /** diff --git a/lib/Cake/Console/cake.php b/lib/Cake/Console/cake.php index 02468c38f..fc0c0b484 100644 --- a/lib/Cake/Console/cake.php +++ b/lib/Cake/Console/cake.php @@ -20,7 +20,7 @@ * @since CakePHP(tm) v 1.2.0.5012 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR. 'shell_dispatcher.php'); +require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR. 'ShellDispatcher.php'); return ShellDispatcher::run($argv); diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 1410637ba..444f99057 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -354,7 +354,7 @@ class App { $paths['helpers'][] = $libs . 'view' . DS . 'helpers' . DS; $paths['plugins'][] = $path . 'plugins' . DS; $paths['vendors'][] = $path . 'vendors' . DS; - $paths['shells'][] = $cake . 'console' . DS . 'shells' . DS; + $paths['shells'][] = $libs . 'Console' . DS . 'Command' . DS; // Provide BC path to vendors/shells $paths['shells'][] = $path . 'vendors' . DS . 'shells' . DS; } diff --git a/lib/Cake/Core/Configure.php b/lib/Cake/Core/Configure.php index fca858832..243956433 100644 --- a/lib/Cake/Core/Configure.php +++ b/lib/Cake/Core/Configure.php @@ -345,7 +345,7 @@ class Configure { */ public static function version() { if (!isset(self::$_values['Cake']['version'])) { - require(CORE_PATH . 'cake' . DS . 'config' . DS . 'config.php'); + require(LIBS . 'config' . DS . 'config.php'); self::write($config); } return self::$_values['Cake']['version']; diff --git a/lib/Cake/I18n/L10n.php b/lib/Cake/I18n/L10n.php index 1844507c3..08b25ca92 100644 --- a/lib/Cake/I18n/L10n.php +++ b/lib/Cake/I18n/L10n.php @@ -17,7 +17,7 @@ * @since CakePHP(tm) v 1.2.0.4116 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -App::uses('CakeRequest', 'Core'); +App::uses('CakeRequest', 'Network'); /** * Localization diff --git a/lib/Cake/bootstrap.php b/lib/Cake/bootstrap.php index f7ca698e3..a6b0099f6 100644 --- a/lib/Cake/bootstrap.php +++ b/lib/Cake/bootstrap.php @@ -40,7 +40,7 @@ error_reporting(E_ALL & ~E_DEPRECATED); /** * Path to the cake directory. */ - define('CAKE', CORE_PATH . 'lib' . DS . 'Cake' . DS); + define('CAKE', CORE_PATH . 'Cake' . DS); /** * Path to the application's directory. @@ -126,7 +126,7 @@ if (!defined('CONFIGS')) { /** * Path to the console libs direcotry. */ - define('CONSOLE_LIBS', CAKE.'console'.DS.'libs'.DS); + define('CONSOLE_LIBS', CAKE . 'Console' . DS); /** * Path to the tests directory. diff --git a/cake/config/config.php b/lib/Cake/config/config.php similarity index 100% rename from cake/config/config.php rename to lib/Cake/config/config.php diff --git a/cake/config/unicode/casefolding/0080_00ff.php b/lib/Cake/config/unicode/casefolding/0080_00ff.php similarity index 100% rename from cake/config/unicode/casefolding/0080_00ff.php rename to lib/Cake/config/unicode/casefolding/0080_00ff.php diff --git a/cake/config/unicode/casefolding/0100_017f.php b/lib/Cake/config/unicode/casefolding/0100_017f.php similarity index 100% rename from cake/config/unicode/casefolding/0100_017f.php rename to lib/Cake/config/unicode/casefolding/0100_017f.php diff --git a/cake/config/unicode/casefolding/0180_024F.php b/lib/Cake/config/unicode/casefolding/0180_024F.php similarity index 100% rename from cake/config/unicode/casefolding/0180_024F.php rename to lib/Cake/config/unicode/casefolding/0180_024F.php diff --git a/cake/config/unicode/casefolding/0250_02af.php b/lib/Cake/config/unicode/casefolding/0250_02af.php similarity index 100% rename from cake/config/unicode/casefolding/0250_02af.php rename to lib/Cake/config/unicode/casefolding/0250_02af.php diff --git a/cake/config/unicode/casefolding/0370_03ff.php b/lib/Cake/config/unicode/casefolding/0370_03ff.php similarity index 100% rename from cake/config/unicode/casefolding/0370_03ff.php rename to lib/Cake/config/unicode/casefolding/0370_03ff.php diff --git a/cake/config/unicode/casefolding/0400_04ff.php b/lib/Cake/config/unicode/casefolding/0400_04ff.php similarity index 100% rename from cake/config/unicode/casefolding/0400_04ff.php rename to lib/Cake/config/unicode/casefolding/0400_04ff.php diff --git a/cake/config/unicode/casefolding/0500_052f.php b/lib/Cake/config/unicode/casefolding/0500_052f.php similarity index 100% rename from cake/config/unicode/casefolding/0500_052f.php rename to lib/Cake/config/unicode/casefolding/0500_052f.php diff --git a/cake/config/unicode/casefolding/0530_058f.php b/lib/Cake/config/unicode/casefolding/0530_058f.php similarity index 100% rename from cake/config/unicode/casefolding/0530_058f.php rename to lib/Cake/config/unicode/casefolding/0530_058f.php diff --git a/cake/config/unicode/casefolding/1e00_1eff.php b/lib/Cake/config/unicode/casefolding/1e00_1eff.php similarity index 100% rename from cake/config/unicode/casefolding/1e00_1eff.php rename to lib/Cake/config/unicode/casefolding/1e00_1eff.php diff --git a/cake/config/unicode/casefolding/1f00_1fff.php b/lib/Cake/config/unicode/casefolding/1f00_1fff.php similarity index 100% rename from cake/config/unicode/casefolding/1f00_1fff.php rename to lib/Cake/config/unicode/casefolding/1f00_1fff.php diff --git a/cake/config/unicode/casefolding/2100_214f.php b/lib/Cake/config/unicode/casefolding/2100_214f.php similarity index 100% rename from cake/config/unicode/casefolding/2100_214f.php rename to lib/Cake/config/unicode/casefolding/2100_214f.php diff --git a/cake/config/unicode/casefolding/2150_218f.php b/lib/Cake/config/unicode/casefolding/2150_218f.php similarity index 100% rename from cake/config/unicode/casefolding/2150_218f.php rename to lib/Cake/config/unicode/casefolding/2150_218f.php diff --git a/cake/config/unicode/casefolding/2460_24ff.php b/lib/Cake/config/unicode/casefolding/2460_24ff.php similarity index 100% rename from cake/config/unicode/casefolding/2460_24ff.php rename to lib/Cake/config/unicode/casefolding/2460_24ff.php diff --git a/cake/config/unicode/casefolding/2c00_2c5f.php b/lib/Cake/config/unicode/casefolding/2c00_2c5f.php similarity index 100% rename from cake/config/unicode/casefolding/2c00_2c5f.php rename to lib/Cake/config/unicode/casefolding/2c00_2c5f.php diff --git a/cake/config/unicode/casefolding/2c60_2c7f.php b/lib/Cake/config/unicode/casefolding/2c60_2c7f.php similarity index 100% rename from cake/config/unicode/casefolding/2c60_2c7f.php rename to lib/Cake/config/unicode/casefolding/2c60_2c7f.php diff --git a/cake/config/unicode/casefolding/2c80_2cff.php b/lib/Cake/config/unicode/casefolding/2c80_2cff.php similarity index 100% rename from cake/config/unicode/casefolding/2c80_2cff.php rename to lib/Cake/config/unicode/casefolding/2c80_2cff.php diff --git a/cake/config/unicode/casefolding/ff00_ffef.php b/lib/Cake/config/unicode/casefolding/ff00_ffef.php similarity index 100% rename from cake/config/unicode/casefolding/ff00_ffef.php rename to lib/Cake/config/unicode/casefolding/ff00_ffef.php