Initial commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace NetteUtils\System;
|
||||
|
||||
use Nette\Bootstrap\Configurator;
|
||||
|
||||
class Bootstrap
|
||||
{
|
||||
public static function boot(): Configurator
|
||||
{
|
||||
$configurator = new Configurator;
|
||||
|
||||
if (getenv('APP_ENV') == 'local' || getenv('PHP_ENV') == 'development') {
|
||||
$configurator->setDebugMode(true);
|
||||
} else {
|
||||
$configurator->setDebugMode(false);
|
||||
}
|
||||
$configurator->enableTracy(__DIR__ . '/../log');
|
||||
|
||||
self::setupCommon($configurator);
|
||||
|
||||
$configurator->addConfig(__DIR__ . '/Config/local.neon');
|
||||
|
||||
return $configurator;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static function bootForTests(): Configurator
|
||||
{
|
||||
$configurator = new Configurator;
|
||||
|
||||
self::setupCommon($configurator);
|
||||
|
||||
$configurator->addConfig(__DIR__ . '/Config/test.neon');
|
||||
|
||||
return $configurator;
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected static function setupCommon(Configurator $configurator) : void
|
||||
{
|
||||
$configurator->setTimeZone('Europe/Prague');
|
||||
$configurator->setTempDirectory(__DIR__ . '/../temp');
|
||||
|
||||
$configurator->createRobotLoader()
|
||||
->addDirectory(__DIR__)
|
||||
->addDirectory(__DIR__ . '/../src')
|
||||
->register();
|
||||
|
||||
$configurator->addConfig(__DIR__ . '/Config/config.neon');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user