Esempio n. 1
0
 public function init($workingDirectory)
 {
     if (\posix_getuid() !== 0) {
         $this->logger->addError('Order not running as root, some functionality may fail to work.');
     }
     $this->workingDirectory = $workingDirectory;
     $this->orderConfig = new Combined($this->logger, [__DIR__ . '/../config/order', $workingDirectory . '/.order-override']);
     $dossiers = array_merge($this->orderConfig->get('order-dossier'), $this->orderConfig->has('dossier') ? $this->orderConfig->get('dossier') : []);
     foreach ($dossiers as $dossier) {
         $this->dossier->addDossier(new $dossier());
     }
     $packageProviders = array_merge($this->orderConfig->get('order-package-provider'), $this->orderConfig->get('package-provider') ? $this->orderConfig->get('package-provider') : []);
     $serviceProviders = array_merge($this->orderConfig->get('order-service-provider'), $this->orderConfig->get('service-provider') ? $this->orderConfig->get('service-provider') : []);
     $userProviders = array_merge($this->orderConfig->get('order-user-provider'), $this->orderConfig->get('user-provider') ? $this->orderConfig->get('user-provider') : []);
     $os = $this->dossier->get('os.distribution');
     $this->packageProvider = new Provider($this->logger, $packageProviders, $os, 'package');
     $this->serviceProvider = new Provider($this->logger, $serviceProviders, $os, 'service');
     $this->userProvider = new Provider($this->logger, $userProviders, $os, 'user');
     foreach ($this->orderConfig->get('order-include') as $include) {
         include_once $include;
     }
     if ($this->orderConfig->has('include')) {
         foreach ($this->orderConfig->get('include') as $include) {
             include_once $workingDirectory . '/' . $include;
         }
     }
     Stream::register('law');
     Stream::setLogger($this->logger);
     Stream::setStorage(new Storage(new Filesystem(new Local('/')), ['']));
     $this->twigLoader->addPath($workingDirectory);
 }
Esempio n. 2
0
 public function setUp()
 {
     $this->flySystem = new Filesystem(new MemoryAdapter());
     $this->flySystem->write('law', '<?php file("test");');
     $this->flySystem->write('henk/is-there/another', '<? file("somewhere");');
     $logger = new Logger("Order");
     $logger->pushHandler(new NullHandler());
     Stream::setLogger($logger);
     Stream::setStorage($this->createStorage());
 }
Esempio n. 3
0
<?php

include __DIR__ . '/../vendor/autoload.php';
use Eater\Order\Law\Stream;
Stream::register('law');