3 use Drupal\Console\Core\Utils\DrupalFinder;
4 use Drupal\Console\Core\Utils\ArgvInputReader;
5 use Drupal\Console\Bootstrap\Drupal;
6 use Drupal\Console\Application;
7 use Drupal\Console\Core\Utils\ConfigurationManager;
13 if (file_exists(__DIR__ . '/../autoload.local.php')) {
14 include_once __DIR__ . '/../autoload.local.php';
17 __DIR__ . '/../../../autoload.php',
18 __DIR__ . '/../vendor/autoload.php'
22 foreach ($autoloaders as $file) {
23 if (file_exists($file)) {
29 if (isset($autoloader)) {
30 $autoload = include_once $autoloader;
32 echo ' You must set up the project dependencies using `composer install`' . PHP_EOL;
36 $drupalFinder = new DrupalFinder();
37 if (!$drupalFinder->locateRoot(getcwd())) {
38 echo ' DrupalConsole must be executed within a Drupal Site.'.PHP_EOL;
43 chdir($drupalFinder->getDrupalRoot());
45 $configurationManager = new ConfigurationManager();
46 $configuration = $configurationManager
47 ->loadConfigurationFromDirectory($drupalFinder->getComposerRoot());
49 $argvInputReader = new ArgvInputReader();
50 if ($configuration && $options = $configuration->get('application.options') ?: []) {
51 $argvInputReader->setOptionsFromConfiguration($options);
53 $argvInputReader->setOptionsAsArgv();
55 $drupal = new Drupal($autoload, $drupalFinder);
56 $container = $drupal->boot();
59 echo ' Something was wrong. Drupal can not be bootstrap.';
64 $application = new Application($container);
65 $application->setDefaultCommand('about');