5 * Contains \Drupal\Console\Core\Bootstrap.
8 namespace Drupal\Console\Core\Bootstrap;
10 use Symfony\Component\DependencyInjection\ContainerBuilder;
11 use Symfony\Component\Config\FileLocator;
12 use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
15 * Class DrupalConsoleCore
17 * @package Drupal\Console\Core\Bootstrap
19 class DrupalConsoleCore
32 * DrupalConsole constructor.
37 public function __construct($root, $appRoot = null)
40 $this->appRoot = $appRoot;
44 * @return ContainerBuilder
46 public function boot()
48 $container = new ContainerBuilder();
49 $loader = new YamlFileLoader($container, new FileLocator($this->root));
52 $this->root.DRUPAL_CONSOLE_CORE.'/services.yml',
53 $this->root.'/services.yml',
54 $this->root.DRUPAL_CONSOLE.'/uninstall.services.yml',
55 $this->root.DRUPAL_CONSOLE.'/extend.console.uninstall.services.yml'
58 foreach ($servicesFiles as $servicesFile) {
59 if (file_exists($servicesFile)) {
60 $loader->load($servicesFile);
64 $container->get('console.configuration_manager')
65 ->loadConfiguration($this->root)
68 $container->get('console.translator_manager')
69 ->loadCoreLanguage('en', $this->root);
71 $appRoot = $this->appRoot?$this->appRoot:$this->root;
76 $consoleRoot = $appRoot;
77 if (stripos($this->root, '/bin/') <= 0) {
78 $consoleRoot = $this->root;
85 $configurationManager = $container->get('console.configuration_manager');
86 $directory = $configurationManager->getConsoleDirectory() . 'extend/';
87 $autoloadFile = $directory . 'vendor/autoload.php';
88 if (is_file($autoloadFile)) {
89 include_once $autoloadFile;
90 $extendServicesFile = $directory . 'extend.console.uninstall.services.yml';
91 if (is_file($extendServicesFile)) {
92 $loader->load($extendServicesFile);
96 $container->get('console.renderer')
99 $this->root.'/templates/',
100 $this->root.DRUPAL_CONSOLE_CORE.'/templates/'