gtPackage.php 699 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * This creates a standalone phar file with all of the PHP source included. To run the
  4. * phar just type 'php generate-phpt.phar <options>' at the command line.
  5. */
  6. if (Phar::canWrite()) {
  7. echo "Writing phar archive\n";
  8. } else {
  9. echo "Unable to write archive, check that phar.readonly is 0 in your php.ini\n";
  10. exit();
  11. }
  12. $thisDir = dirname(__FILE__);
  13. $pharPath = substr($thisDir, 0, -strlen('/generate-phpt'));
  14. $phar = new Phar($pharPath.'/generate-phpt.phar');
  15. $phar->buildFromDirectory($thisDir.'/src');
  16. $stub = <<<ENDSTUB
  17. <?php
  18. Phar::mapPhar('generate-phpt.phar');
  19. require 'phar://generate-phpt.phar/generate-phpt.php';
  20. __HALT_COMPILER();
  21. ENDSTUB;
  22. $phar->setStub($stub);
  23. ?>