Skip to content

Commit

Permalink
Merge pull request #226 from antograssiot/use-psysh
Browse files Browse the repository at this point in the history
Use `psysh` for `cake console` instead of `boris`
  • Loading branch information
lorenzo committed Mar 16, 2015
2 parents 14792c2 + 5fd2256 commit 654574a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"cakephp/plugin-installer": "*"
},
"require-dev": {
"d11wtq/boris": "1.0.*",
"psy/psysh": "@stable",
"cakephp/debug_kit": "3.0.*-dev",
"cakephp/bake": "dev-master"
},
Expand Down
30 changes: 12 additions & 18 deletions src/Shell/ConsoleShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
*/
namespace App\Shell;

use Boris\Boris;
use Cake\Console\ConsoleOptionParser;
use Cake\Console\Shell;
use Cake\Log\Log;
use Psy\Shell as PsyShell;

/**
* Simple console wrapper around Boris.
Expand All @@ -32,34 +32,30 @@ class ConsoleShell extends Shell
*/
public function main()
{
if (!class_exists('Boris\Boris')) {
$this->err('<error>Unable to load Boris\Boris.</error>');
if (!class_exists('Psy\Shell')) {
$this->err('<error>Unable to load Psy\Shell.</error>');
$this->err('');
$this->err('Make sure you have installed boris as a dependency,');
$this->err('and that Boris\Boris is registered in your autoloader.');
$this->err('Make sure you have installed psysh as a dependency,');
$this->err('and that Psy\Shell is registered in your autoloader.');
$this->err('');
$this->err('If you are using composer run');
$this->err('');
$this->err('<info>$ php composer.phar require d11wtq/boris</info>');
$this->err('<info>$ php composer.phar require --dev psy/psysh</info>');
$this->err('');
return 1;
}
if (!function_exists('pcntl_signal')) {
$this->err('<error>No process control functions.</error>');
$this->err('');
$this->err('You are missing the pcntl extension, the interactive console requires this extension.');
return 2;
}
$this->out('You can exit with <info>CTRL-D</info>');

$this->out("You can exit with <info>`CTRL-C`</info> or <info>`exit`</info>");
$this->out('');

Log::drop('debug');
Log::drop('error');
$this->_io->setLoggers(false);
restore_error_handler();
restore_exception_handler();

$boris = new Boris('app > ');
$boris->start();
$psy = new PsyShell();
$psy->run();
}

/**
Expand All @@ -76,9 +72,7 @@ public function getOptionParser()
'it to run adhoc queries with your models, or experiment ' .
'and explore the features of CakePHP and your application.' .
"\n\n" .
'You will need to have boris installed for this Shell to work. ' .
'Boris is known to not work well on windows due to dependencies on ' .
'readline and posix.'
'You will need to have psysh installed for this Shell to work.'
);
return $parser;
}
Expand Down

0 comments on commit 654574a

Please sign in to comment.