forked from doctrine/migrations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.php
41 lines (30 loc) · 909 Bytes
/
package.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/**
* Phing alternative to packaging the PHAR:
* $ php package.php
*
* @author Eric Clemmons <eric@smarterspam.com>
*/
$buildDir = realpath(dirname(__FILE__)) . '/build';
$pharName = "$buildDir/doctrine-migrations.phar";
if (!file_exists($buildDir)) {
mkdir($buildDir);
}
if (file_exists($pharName)) {
unlink($pharName);
}
$p = new Phar($pharName);
$p->CompressFiles(Phar::GZ);
$p->setSignatureAlgorithm(Phar::SHA1);
$p->startBuffering();
$dirs = array(
'./lib' => '/Doctrine\/DBAL\/Migrations/',
'./lib/vendor/doctrine-dbal/lib' => '/Doctrine/',
'./lib/vendor/doctrine-common/lib' => '/Doctrine/',
'./lib/vendor' => '/Symfony/'
);
foreach ($dirs as $dir => $filter) {
$p->buildFromDirectory($dir, $filter);
}
$p->stopBuffering();
$p->setStub(file_get_contents('phar-cli-stub.php'));