Making shells run again

This commit is contained in:
José Lorenzo Rodríguez 2010-12-07 01:26:10 -04:30
parent 1c0a4c9e0a
commit e3690ebccb
29 changed files with 28 additions and 29 deletions

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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;

View file

@ -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 {
/**

View file

@ -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);

View file

@ -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;
}

View file

@ -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'];

View file

@ -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

View file

@ -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.