package.php 976 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * Phing alternative to packaging the PHAR:
  4. * $ php package.php
  5. *
  6. * @author Eric Clemmons <eric@smarterspam.com>
  7. */
  8. $buildDir = realpath(dirname(__FILE__)) . '/build';
  9. $pharName = "$buildDir/doctrine-migrations.phar";
  10. if (!file_exists($buildDir)) {
  11. mkdir($buildDir);
  12. }
  13. if (file_exists($pharName)) {
  14. unlink($pharName);
  15. }
  16. $p = new Phar($pharName);
  17. $p->CompressFiles(Phar::GZ);
  18. $p->setSignatureAlgorithm(Phar::SHA1);
  19. $p->startBuffering();
  20. $dirs = array(
  21. __DIR__ . '/lib' => '/Doctrine\/DBAL\/Migrations/',
  22. __DIR__ . '/vendor/doctrine/dbal/lib' => '/Doctrine/',
  23. __DIR__ . '/vendor/doctrine/common/lib' => '/Doctrine/',
  24. __DIR__ . '/vendor/symfony/console' => '/Symfony/',
  25. __DIR__ . '/vendor/symfony/yaml' => '/Symfony/',
  26. );
  27. foreach ($dirs as $dir => $filter) {
  28. $p->buildFromDirectory($dir, $filter);
  29. }
  30. $p->stopBuffering();
  31. $p->setStub(file_get_contents('phar-cli-stub.php'));