forked from dwoo-project/dwoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompiler.php
43 lines (39 loc) · 1012 Bytes
/
compiler.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
<?php
try {
$pharFile = 'dwoo.phar';
if (file_exists($pharFile)) {
unlink($pharFile);
}
$phar = new Phar($pharFile, FilesystemIterator::CURRENT_AS_FILEINFO);
$phar->setSignatureAlgorithm(\Phar::SHA1);
$phar->startBuffering();
$phar->buildFromDirectory(__DIR__ . '/lib/Dwoo');
$stub = <<<EOF
<?php
/**
* This file is part of Scion framework.
*
* @author David Sanchez <david38sanchez@gmail.com>
* @copyright Copyright (c) 2013-2014, David Sanchez
* @license http://dwoo.org/LICENSE Modified BSD License
* @link http://dwoo.org/
* @version 1.0
* @date 2014-02-15
* @package Dwoo
*/
Phar::mapPhar('{$pharFile}');
require 'phar://{$pharFile}/Autoloader.php';
\$autoloader = new Dwoo\Autoloader();
\$autoloader->add('Dwoo', __FILE__);
\$autoloader->register(true);
__HALT_COMPILER();
EOF;
$phar->setStub($stub);
$phar->stopBuffering();
}
catch (UnexpectedValueException $e) {
echo $e->getMessage();
}
catch (BadMethodCallException $e) {
echo $e->getMessage();
}