X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FBootstrap%2FDrupalConsoleCore.php;fp=vendor%2Fdrupal%2Fconsole-core%2Fsrc%2FBootstrap%2FDrupalConsoleCore.php;h=d35c262e7909e36b59e3a6266a62140ce8ff3eae;hp=0000000000000000000000000000000000000000;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad diff --git a/vendor/drupal/console-core/src/Bootstrap/DrupalConsoleCore.php b/vendor/drupal/console-core/src/Bootstrap/DrupalConsoleCore.php new file mode 100644 index 000000000..d35c262e7 --- /dev/null +++ b/vendor/drupal/console-core/src/Bootstrap/DrupalConsoleCore.php @@ -0,0 +1,101 @@ +root = $root; + $this->appRoot = $appRoot; + } + + /** + * @return ContainerBuilder + */ + public function boot() + { + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator($this->root)); + $loader->load($this->root.DRUPAL_CONSOLE_CORE.'/services.yml'); + if (file_exists($this->root.'/services.yml')) { + $loader->load('services.yml'); + } + + if (file_exists($this->root.DRUPAL_CONSOLE.'/services-drupal-install.yml')) { + $loader->load( + $this->root . DRUPAL_CONSOLE . '/services-drupal-install.yml' + ); + } + + $container->get('console.configuration_manager') + ->loadConfiguration($this->root) + ->getConfiguration(); + + $container->get('console.translator_manager') + ->loadCoreLanguage('en', $this->root); + + $appRoot = $this->appRoot?$this->appRoot:$this->root; + $container->set( + 'app.root', + $appRoot + ); + $consoleRoot = $appRoot; + if (stripos($this->root, '/bin/') <= 0) { + $consoleRoot = $this->root; + } + $container->set( + 'console.root', + $consoleRoot + ); + + $configurationManager = $container->get('console.configuration_manager'); + $directory = $configurationManager->getConsoleDirectory() . 'extend/'; + $autoloadFile = $directory . 'vendor/autoload.php'; + if (is_file($autoloadFile)) { + include_once $autoloadFile; + $extendServicesFile = $directory . 'extend.console.services.yml'; + if (is_file($extendServicesFile)) { + $loader->load($extendServicesFile); + } + } + + $container->get('console.renderer') + ->setSkeletonDirs( + [ + $this->root.'/templates/', + $this->root.DRUPAL_CONSOLE_CORE.'/templates/' + ] + ); + + return $container; + } +}