package.php 909 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. './lib' => '/Doctrine\/DBAL\/Migrations/',
  22. './lib/vendor/doctrine-dbal/lib' => '/Doctrine/',
  23. './lib/vendor/doctrine-common/lib' => '/Doctrine/',
  24. './lib/vendor' => '/Symfony/'
  25. );
  26. foreach ($dirs as $dir => $filter) {
  27. $p->buildFromDirectory($dir, $filter);
  28. }
  29. $p->stopBuffering();
  30. $p->setStub(file_get_contents('phar-cli-stub.php'));