-
Notifications
You must be signed in to change notification settings - Fork 1
/
CreatePhar.php
54 lines (42 loc) · 1.22 KB
/
CreatePhar.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
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* ______ __ __
* / ____/___ ____ / /__________ / /
* / / / __ \/ __ \/ __/ ___/ __ \/ /
* / /___/ /_/ / / / / /_/ / / /_/ / /
* \______________/_/\__/_/ \____/_/
* / | / / /_
* / /| | / / __/
* / ___ |/ / /_
* /_/ _|||_/\__/ __ __
* / __ \___ / /__ / /____
* / / / / _ \/ / _ \/ __/ _ \
* / /_/ / __/ / __/ /_/ __/
* /_____/\___/_/\___/\__/\___/
*
*/
ini_set('phar.readonly', 'off');
// The php.ini setting phar.readonly must be set to 0
$pharFile = 'revive.phar';
exec('mkdir build; cp -rf src build/src; cp -rf vendor build/vendor');
// clean up
if (file_exists($pharFile)) {
unlink($pharFile);
}
if (file_exists($pharFile . '.gz')) {
unlink($pharFile . '.gz');
}
// create phar
$phar = new Phar($pharFile);
// creating our library using whole directory
$phar->buildFromDirectory('./build');
// pointing main file which requires all classes
$phar->setDefaultStub('src/Revive.php', 'src/Revive.php');
// plus - compressing it into gzip
$phar->compress(Phar::GZ);
$phar->compressFiles(Phar::GZ);
echo $pharFile . ' successfully created' . PHP_EOL;
if (file_exists($pharFile . '.gz')) {
unlink($pharFile . '.gz');
}
exec('rm -rf build');