-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole
More file actions
46 lines (37 loc) · 1.19 KB
/
console
File metadata and controls
46 lines (37 loc) · 1.19 KB
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
<?php
/*!
* Pattern Lab Builder CLI
*
* Copyright (c) 2013-2014 Dave Olsen, http://dmolsen.com
* Licensed under the MIT license
*
*/
use \PatternLab\Config;
use \PatternLab\Console;
use \PatternLab\Dispatcher;
use \PatternLab\Timer;
// check to see if json_decode exists. might be disabled in installs of PHP 5.5
if (!function_exists("json_decode")) {
print "Please check that your version of PHP includes the JSON extension. It's required for Pattern Lab to run. Aborting.\n";
exit;
}
// set-up the project base directory
$baseDir = __DIR__.DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR;
// auto-load classes
if (file_exists($baseDir."vendor".DIRECTORY_SEPARATOR."autoload.php")) {
require($baseDir."vendor".DIRECTORY_SEPARATOR."autoload.php");
} else {
print "it doesn't appear that pattern lab has been set-up yet...\n";
print "please install pattern lab's dependencies by typing: composer install...\n";
exit;
}
// start the timer
Timer::start();
// load the options
Console::init();
Config::init($baseDir);
// initialize the dispatcher & note that the config has been loaded
Dispatcher::init();
Dispatcher::getInstance()->dispatch("config.configLoadEnd");
// run the console
Console::run();