2016-07-03 21:33:53 -04:00

47 lines
1.2 KiB
Plaintext

<?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();