Permalink
Browse files

integrate Boris into Tinker command hwen available.

  • Loading branch information...
taylorotwell committed Sep 20, 2013
1 parent a8f015e commit 5e8d2c0e38b9630cf881336cbfde6c64657e4d30
Showing with 51 additions and 3 deletions.
  1. +10 −3 composer.json
  2. +41 −0 src/Illuminate/Foundation/Console/TinkerCommand.php
@@ -12,13 +12,15 @@
"require": {
"php": ">=5.3.0",
"classpreloader/classpreloader": "1.0.*",
"d11wtq/boris": "1.0.*",
"ircmaxell/password-compat": "1.0.*",
"filp/whoops": "1.0.7",
"monolog/monolog": "1.6.*",
"nesbot/carbon": "1.*",
"patchwork/utf8": "1.1.*",
"phpseclib/phpseclib": "0.3.x",
"phpseclib/phpseclib": "0.3.*",
"predis/predis": "0.8.*",
"react/socket": "0.3.*",
"swiftmailer/swiftmailer": "5.0.*",
"symfony/browser-kit": "2.3.*",
"symfony/console": "2.3.*",
@@ -78,14 +80,19 @@
"Illuminate": "src/"
}
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/laravel/boris"
}
],
"extra": {
"branch-alias": {
"dev-master": "4.1-dev"
}
},
"suggest": {
"doctrine/dbal": "Allow renaming columns and dropping SQLite columns.",
"react/socket": "Allow live debugging using 'debug' Artisan command."
"doctrine/dbal": "Allow renaming columns and dropping SQLite columns."
},
"minimum-stability": "dev"
}
@@ -24,6 +24,37 @@ class TinkerCommand extends Command {
* @return void
*/
public function fire()
{
if ($this->supportsBoris())
{
$this->runBorisShell();
}
else
{
$this->comment('Full REPL not supported. Falling back to simple shell.');
$this->runPlainShell();
}
}
/**
* Run the Boris REPL with the current context.
*
* @return void
*/
protected function runBorisShell()
{
with(new \Boris\Boris('laravel> '))->start();
return;
}
/**
* Run the plain Artisan tinker shell.
*
* @return void
*/
protected function runPlainShell()
{
$input = $this->prompt();
@@ -66,4 +97,14 @@ protected function prompt()
return $dialog->ask($this->output, "<info>></info>", null);
}
/**
* Determine if the current environment supports Boris.
*
* @return bool
*/
protected function supportsBoris()
{
return (extension_loaded('readline') and extension_loaded('posix'));
}
}

0 comments on commit 5e8d2c0

Please sign in to comment.