Skip to content

Commit

Permalink
Fixing issues in lithium console file that prevented tests from bei…
Browse files Browse the repository at this point in the history
…ng run inside plugins.
  • Loading branch information
nateabele committed Mar 11, 2011
1 parent 5fc8944 commit 3e9ed1c
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions libraries/lithium/console/lithium.php
Expand Up @@ -18,8 +18,8 @@
*/

$library = dirname(dirname(__DIR__));
$app = null;
$working = getcwd() ?: __DIR__;
$app = null;

while (!$app && $working) {
if (file_exists($working . '/config/bootstrap.php')) {
Expand All @@ -31,21 +31,29 @@
}
}

if ($app) {
include $app . '/config/bootstrap.php';
} else {
define('LITHIUM_LIBRARY_PATH', $library);
define('LITHIUM_APP_PATH', dirname($library) . '/app');

if (!include LITHIUM_LIBRARY_PATH . '/lithium/core/Libraries.php') {
$message = "Lithium core could not be found. Check the value of `LITHIUM_LIBRARY_PATH` ";
$message .= "in `config/bootstrap.php`. It should point to the directory containing your ";
$message .= "`/libraries` directory.";
trigger_error($message, E_USER_ERROR);
}
Libraries::add('lithium');
if ($app && is_dir("{$app}/config/bootstrap") && file_exists("{$app}/webroot/index.php")) {
include "{$app}/config/bootstrap.php";
exit(Dispatcher::run()->status);
}

define('LITHIUM_LIBRARY_PATH', $library);
define('LITHIUM_APP_PATH', $app ? $working : dirname($library) . '/app');

if (!include LITHIUM_LIBRARY_PATH . '/lithium/core/Libraries.php') {
$message = "Lithium core could not be found. Check the value of `LITHIUM_LIBRARY_PATH` ";
$message .= "in `config/bootstrap.php`. It should point to the directory containing your ";
$message .= "`/libraries` directory.";
trigger_error($message, E_USER_ERROR);
}

Libraries::add('lithium');

if ($app) {
Libraries::add(basename(LITHIUM_APP_PATH), array(
'path' => LITHIUM_APP_PATH,
'default' => true
));
}
exit(Dispatcher::run()->status);

?>

0 comments on commit 3e9ed1c

Please sign in to comment.