annotate vendor/psy/psysh/bin/build-stub @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents c2387f117808
children
rev   line source
Chris@16 1 #!/usr/bin/env php
Chris@16 2 <?php
Chris@16 3
Chris@16 4 $license = file_get_contents(dirname(__DIR__) . '/LICENSE');
Chris@16 5 $license = str_replace('The MIT License (MIT)', '', $license);
Chris@16 6 $license = str_replace("\n", "\n * ", trim($license));
Chris@16 7
Chris@16 8 $autoload = <<<'EOS'
Chris@16 9 Phar::mapPhar('psysh.phar');
Chris@16 10 require 'phar://psysh.phar/.box/check_requirements.php';
Chris@16 11 require 'phar://psysh.phar/vendor/autoload.php';
Chris@16 12 EOS;
Chris@16 13
Chris@16 14 $content = file_get_contents(dirname(__DIR__) . '/bin/psysh');
Chris@16 15 $content = preg_replace('{/\* <<<.*?>>> \*/}sm', $autoload, $content);
Chris@16 16 $content = preg_replace('/\\(c\\) .*?with this source code./sm', $license, $content);
Chris@16 17
Chris@16 18 $content .= '__HALT_COMPILER();';
Chris@16 19
Chris@16 20 @mkdir(dirname(__DIR__) . '/build');
Chris@16 21
Chris@16 22 file_put_contents(dirname(__DIR__) . '/build/stub', $content);