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
16 * @package Drupal\Console\Core\Bootstrap
18 class DrupalConsoleCore
31 * DrupalConsole constructor.
35 public function __construct($root, $appRoot = null)
38 $this->appRoot = $appRoot;
42 * @return ContainerBuilder
44 public function boot()
46 $container = new ContainerBuilder();
47 $loader = new YamlFileLoader($container, new FileLocator($this->root));
48 $loader->load($this->root.DRUPAL_CONSOLE_CORE.'/services.yml');
49 if (file_exists($this->root.'/services.yml')) {
50 $loader->load('services.yml');
53 if (file_exists($this->root.DRUPAL_CONSOLE.'/services-drupal-install.yml')) {
55 $this->root . DRUPAL_CONSOLE . '/services-drupal-install.yml'
59 $container->get('console.configuration_manager')
60 ->loadConfiguration($this->root)
63 $container->get('console.translator_manager')
64 ->loadCoreLanguage('en', $this->root);
66 $appRoot = $this->appRoot?$this->appRoot:$this->root;
71 $consoleRoot = $appRoot;
72 if (stripos($this->root, '/bin/') <= 0) {
73 $consoleRoot = $this->root;
80 $configurationManager = $container->get('console.configuration_manager');
81 $directory = $configurationManager->getConsoleDirectory() . 'extend/';
82 $autoloadFile = $directory . 'vendor/autoload.php';
83 if (is_file($autoloadFile)) {
84 include_once $autoloadFile;
85 $extendServicesFile = $directory . 'extend.console.services.yml';
86 if (is_file($extendServicesFile)) {
87 $loader->load($extendServicesFile);
91 $container->get('console.renderer')
94 $this->root.'/templates/',
95 $this->root.DRUPAL_CONSOLE_CORE.'/templates/'