update v 1.0.7.5
This commit is contained in:
47
vendor/psy/psysh/src/Psy/Compiler.php
vendored
47
vendor/psy/psysh/src/Psy/Compiler.php
vendored
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Psy Shell
|
||||
* This file is part of Psy Shell.
|
||||
*
|
||||
* (c) 2012-2014 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.
|
||||
@@ -53,33 +53,17 @@ class Compiler
|
||||
->ignoreVCS(true)
|
||||
->name('*.php')
|
||||
->exclude('Tests')
|
||||
->in(__DIR__ . '/../../vendor/dnoegel/php-xdg-base-dir/src')
|
||||
->in(__DIR__ . '/../../vendor/jakub-onderka/php-console-color')
|
||||
->in(__DIR__ . '/../../vendor/jakub-onderka/php-console-highlighter')
|
||||
->in(__DIR__ . '/../../vendor/nikic/php-parser/lib')
|
||||
->in(__DIR__ . '/../../vendor/symfony/console')
|
||||
->in(__DIR__ . '/../../vendor/symfony/yaml');
|
||||
->in(__DIR__ . '/../../build-vendor');
|
||||
|
||||
foreach ($finder as $file) {
|
||||
$this->addFile($phar, $file);
|
||||
}
|
||||
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/autoload.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/include_paths.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_files.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_psr4.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_real.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_namespaces.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/autoload_classmap.php'));
|
||||
$this->addFile($phar, new \SplFileInfo(__DIR__ . '/../../vendor/composer/ClassLoader.php'));
|
||||
|
||||
// Stubs
|
||||
$phar->setStub($this->getStub());
|
||||
|
||||
$phar->stopBuffering();
|
||||
|
||||
// $this->addFile($phar, new \SplFileInfo(__DIR__.'/../../LICENSE'), false);
|
||||
|
||||
unset($phar);
|
||||
}
|
||||
|
||||
@@ -139,6 +123,20 @@ class Compiler
|
||||
return $output;
|
||||
}
|
||||
|
||||
private static function getStubLicense()
|
||||
{
|
||||
$license = file_get_contents(__DIR__ . '/../../LICENSE');
|
||||
$license = str_replace('The MIT License (MIT)', '', $license);
|
||||
$license = str_replace("\n", "\n * ", trim($license));
|
||||
|
||||
return $license;
|
||||
}
|
||||
|
||||
const STUB_AUTOLOAD = <<<'EOS'
|
||||
Phar::mapPhar('psysh.phar');
|
||||
require 'phar://psysh.phar/build-vendor/autoload.php';
|
||||
EOS;
|
||||
|
||||
/**
|
||||
* Get a Phar stub for psysh.
|
||||
*
|
||||
@@ -148,14 +146,11 @@ class Compiler
|
||||
*/
|
||||
private function getStub()
|
||||
{
|
||||
$autoload = <<<'EOS'
|
||||
Phar::mapPhar('psysh.phar');
|
||||
require 'phar://psysh.phar/vendor/autoload.php';
|
||||
EOS;
|
||||
|
||||
$content = file_get_contents(__DIR__ . '/../../bin/psysh');
|
||||
$content = preg_replace('{/\* <<<.*?>>> \*/}sm', $autoload, $content);
|
||||
$content .= "__HALT_COMPILER();";
|
||||
$content = preg_replace('{/\* <<<.*?>>> \*/}sm', self::STUB_AUTOLOAD, $content);
|
||||
$content = preg_replace('/\\(c\\) .*?with this source code./sm', self::getStubLicense(), $content);
|
||||
|
||||
$content .= '__HALT_COMPILER();';
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user