update v 1.0.7.5
This commit is contained in:
6
vendor/psy/psysh/bin/build
vendored
Normal file
6
vendor/psy/psysh/bin/build
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd "${BASH_SOURCE%/*}/.."
|
||||
|
||||
./bin/build-vendor || exit 1
|
||||
./bin/build-phar
|
||||
@@ -2,9 +2,9 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of PsySH
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2013 Justin Hileman
|
||||
* (c) 2012-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
@@ -119,15 +119,15 @@ function format_doc($doc)
|
||||
if (!empty($doc['params'])) {
|
||||
$chunks[] = '<comment>Param:</comment>';
|
||||
|
||||
$typeMax = max(array_map(function($param) {
|
||||
$typeMax = max(array_map(function ($param) {
|
||||
return strlen($param['type']);
|
||||
}, $doc['params']));
|
||||
|
||||
$max = max(array_map(function($param) {
|
||||
$max = max(array_map(function ($param) {
|
||||
return strlen($param['name']);
|
||||
}, $doc['params']));
|
||||
|
||||
$template = ' <info>%-'.$typeMax.'s</info> <strong>%-'.$max.'s</strong> %s';
|
||||
$template = ' <info>%-' . $typeMax . 's</info> <strong>%-' . $max . 's</strong> %s';
|
||||
$indent = str_repeat(' ', $typeMax + $max + 6);
|
||||
$wrapWidth = WRAP_WIDTH - strlen($indent);
|
||||
|
||||
@@ -182,7 +182,7 @@ function thunk_tags($text)
|
||||
|
||||
function indent_text($text, $indent = ' ', $leading = true)
|
||||
{
|
||||
return ($leading ? $indent : '') . str_replace("\n", "\n".$indent, $text);
|
||||
return ($leading ? $indent : '') . str_replace("\n", "\n" . $indent, $text);
|
||||
}
|
||||
|
||||
function find_type($xml, $paramName)
|
||||
@@ -190,7 +190,7 @@ function find_type($xml, $paramName)
|
||||
foreach ($xml->getElementsByTagName('methodparam') as $param) {
|
||||
if ($type = $param->getElementsByTagName('type')->item(0)) {
|
||||
if ($parameter = $param->getElementsByTagName('parameter')->item(0)) {
|
||||
if ($paramName == $parameter->textContent) {
|
||||
if ($paramName === $parameter->textContent) {
|
||||
return $type->textContent;
|
||||
}
|
||||
}
|
||||
@@ -201,7 +201,7 @@ function find_type($xml, $paramName)
|
||||
$docs = array();
|
||||
foreach (glob($argv[1] . '/*/*/*.xml') as $function) {
|
||||
$funcname = basename($function);
|
||||
if ($funcname == 'main.xml' || strpos($funcname, 'entities.') === 0) {
|
||||
if ($funcname === 'main.xml' || strpos($funcname, 'entities.') === 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ foreach (glob($argv[1] . '/*/*/*.xml') as $function) {
|
||||
|
||||
if ($synopsis = $refsect1->getElementsByTagName('methodsynopsis')->item(0)) {
|
||||
foreach ($synopsis->childNodes as $node) {
|
||||
if ($node instanceof DOMElement && $node->tagName == 'type') {
|
||||
if ($node instanceof DOMElement && $node->tagName === 'type') {
|
||||
$doc['return_type'] = $node->textContent;
|
||||
break;
|
||||
}
|
||||
@@ -244,7 +244,7 @@ foreach (glob($argv[1] . '/*/*/*.xml') as $function) {
|
||||
foreach ($vars as $var) {
|
||||
if ($name = $var->getElementsByTagName('parameter')->item(0)) {
|
||||
$params[] = array(
|
||||
'name' => '$'.$name->textContent,
|
||||
'name' => '$' . $name->textContent,
|
||||
'type' => find_type($xml, $name->textContent),
|
||||
'description' => extract_paragraphs($var),
|
||||
);
|
||||
@@ -276,7 +276,7 @@ if (is_file($argv[2])) {
|
||||
unlink($argv[2]);
|
||||
}
|
||||
|
||||
$db = new PDO('sqlite:'.$argv[2]);
|
||||
$db = new PDO('sqlite:' . $argv[2]);
|
||||
|
||||
$db->query('CREATE TABLE php_manual (id char(256) PRIMARY KEY, doc TEXT)');
|
||||
$cmd = $db->prepare('INSERT INTO php_manual (id, doc) VALUES (?, ?)');
|
||||
@@ -2,16 +2,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of PsySH
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2013 Justin Hileman
|
||||
* (c) 2012-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
if (!is_file(dirname(__DIR__).'/vendor/autoload.php')) {
|
||||
throw new RuntimeException('Missing PsySH dev dependencies in ' . dirname(__DIR__).'/vendor/' . ', install with `composer.phar install --dev`.');
|
||||
if (!is_file(dirname(__DIR__) . '/vendor/autoload.php')) {
|
||||
throw new RuntimeException('Missing PsySH dev dependencies in ' . dirname(__DIR__) . '/vendor/' . ', install with `composer.phar install --dev`.');
|
||||
}
|
||||
|
||||
require dirname(__DIR__) . '/vendor/autoload.php';
|
||||
@@ -20,6 +20,10 @@ if (!class_exists('Symfony\Component\Finder\Finder')) {
|
||||
throw new RuntimeException('Missing PsySH dev dependencies, install with `composer.phar install --dev`.');
|
||||
}
|
||||
|
||||
if (!is_file(dirname(__DIR__) . '/build-vendor/autoload.php')) {
|
||||
throw new RuntimeException('Missing phar vendor dependencies, install with bin/build-vendor');
|
||||
}
|
||||
|
||||
use Psy\Compiler;
|
||||
|
||||
error_reporting(-1);
|
||||
7
vendor/psy/psysh/bin/build-vendor
vendored
Normal file
7
vendor/psy/psysh/bin/build-vendor
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd "${BASH_SOURCE%/*}/.."
|
||||
|
||||
rm -rf build-vendor
|
||||
|
||||
COMPOSER_VENDOR_DIR=build-vendor composer install --ignore-platform-reqs --no-dev --no-progress --classmap-authoritative
|
||||
192
vendor/psy/psysh/bin/psysh
vendored
192
vendor/psy/psysh/bin/psysh
vendored
@@ -2,34 +2,99 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of PsySH
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2013 Justin Hileman
|
||||
* (c) 2012-2015 Justin Hileman
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/* <<< */
|
||||
if (is_file(__DIR__ . '/../vendor/autoload.php')) {
|
||||
require(__DIR__ . '/../vendor/autoload.php');
|
||||
} elseif (is_file(__DIR__ . '/../../../autoload.php')) {
|
||||
require(__DIR__ . '/../../../autoload.php');
|
||||
} else {
|
||||
die(
|
||||
'You must set up the Psy Shell dependencies, run the following commands:' . PHP_EOL .
|
||||
'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
|
||||
'php composer.phar install' . PHP_EOL
|
||||
);
|
||||
}
|
||||
/* >>> */
|
||||
// Try to find an autoloader for a local psysh version.
|
||||
// We'll wrap this whole mess in a Closure so it doesn't leak any globals.
|
||||
call_user_func(function () {
|
||||
$cwd = null;
|
||||
|
||||
use Psy\Configuration;
|
||||
use Psy\Shell;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputDefinition;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
// Find the cwd arg (if present)
|
||||
$argv = isset($_SERVER['argv']) ? $_SERVER['argv'] : array();
|
||||
foreach ($argv as $i => $arg) {
|
||||
if ($arg === '--cwd') {
|
||||
if ($i >= count($argv) - 1) {
|
||||
echo 'Missing --cwd argument.' . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
$cwd = $argv[$i + 1];
|
||||
break;
|
||||
}
|
||||
|
||||
if (preg_match('/^--cwd=/', $arg)) {
|
||||
$cwd = substr($arg, 6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Or fall back to the actual cwd
|
||||
if (!isset($cwd)) {
|
||||
$cwd = getcwd();
|
||||
}
|
||||
|
||||
$cwd = str_replace('\\', '/', $cwd);
|
||||
|
||||
$chunks = explode('/', $cwd);
|
||||
while (!empty($chunks)) {
|
||||
$path = implode('/', $chunks);
|
||||
|
||||
// Find composer.json
|
||||
if (is_file($path . '/composer.json')) {
|
||||
if ($cfg = json_decode(file_get_contents($path . '/composer.json'), true)) {
|
||||
if (isset($cfg['name']) && $cfg['name'] === 'psy/psysh') {
|
||||
// We're inside the psysh project. Let's use the local
|
||||
// Composer autoload.
|
||||
if (is_file($path . '/vendor/autoload.php')) {
|
||||
require $path . '/vendor/autoload.php';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Or a composer.lock
|
||||
if (is_file($path . '/composer.lock')) {
|
||||
if ($cfg = json_decode(file_get_contents($path . '/composer.lock'), true)) {
|
||||
foreach (array_merge($cfg['packages'], $cfg['packages-dev']) as $pkg) {
|
||||
if (isset($pkg['name']) && $pkg['name'] === 'psy/psysh') {
|
||||
// We're inside a project which requires psysh. We'll
|
||||
// use the local Composer autoload.
|
||||
if (is_file($path . '/vendor/autoload.php')) {
|
||||
require $path . '/vendor/autoload.php';
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
array_pop($chunks);
|
||||
}
|
||||
});
|
||||
|
||||
// We didn't find an autoloader for a local version, so use the autoloader that
|
||||
// came with this script.
|
||||
if (!class_exists('Psy\Shell')) {
|
||||
/* <<< */
|
||||
if (is_file(__DIR__ . '/../vendor/autoload.php')) {
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
} elseif (is_file(__DIR__ . '/../../../autoload.php')) {
|
||||
require __DIR__ . '/../../../autoload.php';
|
||||
} else {
|
||||
echo 'PsySH dependencies not found, be sure to run `composer install`.' . PHP_EOL;
|
||||
echo 'See https://getcomposer.org to get Composer.' . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
/* >>> */
|
||||
}
|
||||
|
||||
// If the psysh binary was included directly, assume they just wanted an
|
||||
// autoloader and bail early.
|
||||
@@ -41,7 +106,7 @@ if (version_compare(PHP_VERSION, '5.3.6', '<')) {
|
||||
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
|
||||
}
|
||||
|
||||
if (Shell::isIncluded($trace)) {
|
||||
if (Psy\Shell::isIncluded($trace)) {
|
||||
unset($trace);
|
||||
|
||||
return;
|
||||
@@ -50,74 +115,21 @@ if (Shell::isIncluded($trace)) {
|
||||
// Clean up after ourselves.
|
||||
unset($trace);
|
||||
|
||||
call_user_func(function() {
|
||||
$usageException = null;
|
||||
|
||||
$input = new ArgvInput();
|
||||
try {
|
||||
$input->bind(new InputDefinition(array(
|
||||
new InputOption('help', 'h', InputOption::VALUE_NONE),
|
||||
new InputOption('config', 'c', InputOption::VALUE_REQUIRED),
|
||||
new InputOption('version', 'v', InputOption::VALUE_NONE),
|
||||
|
||||
new InputArgument('include', InputArgument::IS_ARRAY),
|
||||
)));
|
||||
} catch (\RuntimeException $e) {
|
||||
$usageException = $e;
|
||||
// If the local version is too old, we can't do this
|
||||
if (!function_exists('Psy\bin')) {
|
||||
$argv = $_SERVER['argv'];
|
||||
$first = array_shift($argv);
|
||||
if (preg_match('/php(\.exe)?$/', $first)) {
|
||||
array_shift($argv);
|
||||
}
|
||||
array_unshift($argv, 'vendor/bin/psysh');
|
||||
|
||||
$config = array();
|
||||
echo 'A local PsySH dependency was found, but it cannot be loaded. Please update to' . PHP_EOL;
|
||||
echo 'the latest version, or run the local copy directly, e.g.:' . PHP_EOL;
|
||||
echo PHP_EOL;
|
||||
echo ' ' . implode(' ', $argv) . PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// Handle --config
|
||||
if ($configFile = $input->getOption('config')) {
|
||||
$config['configFile'] = $configFile;
|
||||
}
|
||||
|
||||
$shell = new Shell(new Configuration($config));
|
||||
|
||||
// Handle --help
|
||||
if ($usageException !== null || $input->getOption('help')) {
|
||||
if ($usageException !== null) {
|
||||
echo $usageException->getMessage() . PHP_EOL . PHP_EOL;
|
||||
}
|
||||
|
||||
$version = $shell->getVersion();
|
||||
$name = basename(reset($_SERVER['argv']));
|
||||
echo <<<EOL
|
||||
$version
|
||||
|
||||
Usage:
|
||||
$name [--version] [--help] [files...]
|
||||
|
||||
Options:
|
||||
--help -h Display this help message.
|
||||
--config -c Use an alternate PsySH config file location.
|
||||
--version -v Display the PsySH version.
|
||||
|
||||
EOL;
|
||||
exit($usageException === null ? 0 : 1);
|
||||
}
|
||||
|
||||
|
||||
// Handle --version
|
||||
if ($input->getOption('version')) {
|
||||
echo $shell->getVersion() . PHP_EOL;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// Pass additional arguments to Shell as 'includes'
|
||||
$shell->setIncludes($input->getArgument('include'));
|
||||
|
||||
try {
|
||||
// And go!
|
||||
$shell->run();
|
||||
} catch (Exception $e) {
|
||||
echo $e->getMessage() . PHP_EOL;
|
||||
|
||||
// TODO: this triggers the "exited unexpectedly" logic in the
|
||||
// ForkingLoop, so we can't exit(1) after starting the shell...
|
||||
// fix this :)
|
||||
|
||||
// exit(1);
|
||||
}
|
||||
});
|
||||
// And go!
|
||||
call_user_func(Psy\bin());
|
||||
|
||||
Reference in New Issue
Block a user