-
Notifications
You must be signed in to change notification settings - Fork 51
/
buildPHAR.php
38 lines (33 loc) · 992 Bytes
/
buildPHAR.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
<?php
$phar = new Phar('build/phpctags.phar', 0, 'phpctags.phar');
$phar->buildFromIterator(
new RecursiveIteratorIterator(
new RecursiveCallbackFilterIterator(
new RecursiveDirectoryIterator(
getcwd(),
FilesystemIterator::SKIP_DOTS
),
function ($current) {
$excludes = array(
'.*',
'tags',
'build/*',
'tests/*',
'Makefile',
'bin/phpctags',
'buildPHAR.php',
);
foreach($excludes as $exclude) {
if (fnmatch(getcwd().'/'.$exclude, $current->getPathName())) {
return false;
}
}
return true;
}
)
),
getcwd()
);
$phar->setStub(
"#!/usr/bin/env php\n".$phar->createDefaultStub('bootstrap.php')
);