forked from PHP-Hearth/hearth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhearth.php
executable file
·49 lines (39 loc) · 1.35 KB
/
hearth.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
#!/usr/bin/env php
<?php
/**
* hearth.php
*
* Core of application
*
* @category Hearth
* @author Maxwell Vandervelde <[email protected]>
* @author Douglas Linsmeyer <[email protected]>
* @version 0.0.0
* @license http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode
* Attribution-NonCommercial-ShareAlike 3.0 Unported
* Some Rights Reserved
*/
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Hearth'
. DIRECTORY_SEPARATOR. 'Autoload.php';
$autoloader = new \Hearth\Autoload();
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Hearth' . DIRECTORY_SEPARATOR . 'Autoload' . DIRECTORY_SEPARATOR . 'Path.php';
$corePath = new \Hearth\Autoload\Path(dirname(__FILE__));
$autoloader->addLoadPath($corePath);
spl_autoload_register(array($autoloader, 'load'));
// Autoload Composer libraries
require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendor'
. DIRECTORY_SEPARATOR . 'autoload.php';
$outputProcessor = new \Hearth\Console\Output();
// Strip off the program name
$program = array_shift($argv);
$core = new \Hearth\Core();
$core->setOutputProcessor($outputProcessor)
->setArguments($argv)
->setAutoloader($autoloader);
try {
$core->main()->close();
} catch(\Hearth\Exception\BuildException $e) {
$core->failBuild($e)->close();
} catch(\Exception $e) {
$core->displayException($e)->close();
}