setup cache before running tessts
continuous-integration/drone/push Build is passing Details

master
eater 4 years ago
parent f391e2ef6c
commit eb1cbef43b
Signed by: eater
GPG Key ID: AD2560A0F84F0759

@ -6,6 +6,7 @@ steps:
- name: code checks
image: composer
commands:
- composer install
- composer install --no-ansi --no-interaction
- ./bin/setup
- ./vendor/bin/php-cs-fixer fix --dry-run src
- ./vendor/bin/phpstan analyse src
- ./vendor/bin/phpstan analyse -a config/autoload_with_route.php src

@ -0,0 +1,8 @@
#!/usr/bin/env php
<?php
use CubiStore\Web\Main;
require __DIR__ . '/../vendor/autoload.php';
Main::make();

@ -30,9 +30,6 @@
"autoload": {
"psr-4": {
"CubiStore\\Web\\": "src/"
},
"files": [
"var/cache/routes.php"
]
}
}
}

@ -0,0 +1,3 @@
<?php
include __DIR__ . '/../vendor/autoload.php';
include __DIR__ . '/../var/cache/routes/CompiledRoutes.php';

@ -3,7 +3,6 @@
namespace CubiStore\Web;
use CubiStore\Web\Cache\CompiledRoutes;
use CubiStore\Web\Utils\ICompiledRoutes;
use CubiStore\Web\Utils\RouteCompiler;
use DI\Bridge\Slim\Bridge;
@ -61,7 +60,7 @@ class Main
public function setupRoutes(): ICompiledRoutes
{
$compiledRoutesFile = __DIR__ . '/../var/cache/routes.php';
$compiledRoutesFile = __DIR__ . '/../var/cache/routes/CompiledRoutes.php';
if ($this->env !== 'prod' || !file_exists($compiledRoutesFile)) {
$routes = include(__DIR__ . '/../config/routes.php');
@ -70,8 +69,9 @@ class Main
$compiler->writeCache();
}
include(__DIR__ . '/../var/cache/routes.php');
return new CompiledRoutes();
include(__DIR__ . '/../var/cache/routes/CompiledRoutes.php');
$x = "\CubiStore\Web\Cache\CompiledRoutes";
return new $x();
}
public function setupContainer(ICompiledRoutes $routes)

@ -46,6 +46,12 @@ class RouteCompiler
public function writeCache()
{
$dirname = dirname($this->target);
if (!is_dir($dirname)) {
mkdir($dirname, 0777, true);
}
file_put_contents($this->target, $this->compile());
}

Loading…
Cancel
Save