From d7722d3bec10c054d49f94099e3f6407e482aa6f Mon Sep 17 00:00:00 2001 From: antograssiot Date: Sun, 15 Mar 2015 09:26:10 +0100 Subject: [PATCH 1/2] use psysh for cake console instead of boris so even windows users can enjoy this feature --- composer.json | 2 +- src/Shell/ConsoleShell.php | 31 +++++++++++++------------------ 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index afa4b4d338..e8469cd5f1 100644 --- a/composer.json +++ b/composer.json @@ -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" }, diff --git a/src/Shell/ConsoleShell.php b/src/Shell/ConsoleShell.php index 20ad22a546..599325be32 100644 --- a/src/Shell/ConsoleShell.php +++ b/src/Shell/ConsoleShell.php @@ -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. @@ -32,25 +32,22 @@ class ConsoleShell extends Shell */ public function main() { - if (!class_exists('Boris\Boris')) { - $this->err('Unable to load Boris\Boris.'); + + if (!class_exists('Psy\Shell')) { + $this->err('Unable to load Psy\Shell.'); $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('$ php composer.phar require d11wtq/boris'); + $this->err('$ php composer.phar require --dev psy/psysh'); $this->err(''); return 1; } - if (!function_exists('pcntl_signal')) { - $this->err('No process control functions.'); - $this->err(''); - $this->err('You are missing the pcntl extension, the interactive console requires this extension.'); - return 2; - } - $this->out('You can exit with CTRL-D'); + + $this->out("You can exit with `CTRL-C` or `exit`"); + $this->out(''); Log::drop('debug'); Log::drop('error'); @@ -58,8 +55,8 @@ public function main() restore_error_handler(); restore_exception_handler(); - $boris = new Boris('app > '); - $boris->start(); + $psy = new PsyShell(); + $psy->run(); } /** @@ -76,9 +73,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; } From 5fd2256a312a96943376255c74a8e1bfa762ad18 Mon Sep 17 00:00:00 2001 From: antograssiot Date: Sun, 15 Mar 2015 16:19:18 +0100 Subject: [PATCH 2/2] fix CS error --- src/Shell/ConsoleShell.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Shell/ConsoleShell.php b/src/Shell/ConsoleShell.php index 599325be32..d8ccd7e611 100644 --- a/src/Shell/ConsoleShell.php +++ b/src/Shell/ConsoleShell.php @@ -32,7 +32,6 @@ class ConsoleShell extends Shell */ public function main() { - if (!class_exists('Psy\Shell')) { $this->err('Unable to load Psy\Shell.'); $this->err('');