Skip to content

Commit

Permalink
Making shells run again
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Dec 7, 2010
1 parent 1c0a4c9 commit e3690eb
Show file tree
Hide file tree
Showing 29 changed files with 28 additions and 29 deletions.
8 changes: 4 additions & 4 deletions lib/Cake/Console/Command/CommandListShell.php
Expand Up @@ -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.
*
Expand Down Expand Up @@ -111,10 +113,8 @@ protected function _appendShells($type, $paths, $shellList) {
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;
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Console/ConsoleErrorHandler.php
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions lib/Cake/Console/ConsoleOptionParser.php
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions lib/Cake/Console/Shell.php
Expand Up @@ -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.
Expand Down
13 changes: 5 additions & 8 deletions lib/Cake/Console/ShellDispatcher.php
Expand Up @@ -133,13 +133,13 @@ function __bootstrap() {
}

$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'));

Expand Down Expand Up @@ -209,14 +209,11 @@ public function dispatch() {
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;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/TaskCollection.php
Expand Up @@ -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 {
/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Console/cake.php
Expand Up @@ -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);

2 changes: 1 addition & 1 deletion lib/Cake/Core/App.php
Expand Up @@ -354,7 +354,7 @@ public static function core($type = null) {
$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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Core/Configure.php
Expand Up @@ -345,7 +345,7 @@ public static function load($key, $config = 'default') {
*/
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'];
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/I18n/L10n.php
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/bootstrap.php
Expand Up @@ -40,7 +40,7 @@
/**
* 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.
Expand Down Expand Up @@ -126,7 +126,7 @@
/**
* 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.
Expand Down
File renamed without changes.

0 comments on commit e3690eb

Please sign in to comment.