Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / chi-teck / drupal-code-generator / bin / dcg
1 #!/usr/bin/env php
2 <?php
3
4 use DrupalCodeGenerator\ApplicationFactory;
5 use DrupalCodeGenerator\Command\Navigation;
6 use DrupalCodeGenerator\GeneratorDiscovery;
7 use DrupalCodeGenerator\Utils;
8 use Symfony\Component\Filesystem\Filesystem;
9
10 // The autoloader may have a different location if DCG is installed as a local
11 // Composer package.
12 $autoloader = file_exists(__DIR__ . '/../vendor/autoload.php')
13   ? require __DIR__ . '/../vendor/autoload.php'
14   : require __DIR__ . '/../../../autoload.php';
15
16 // Create an application.
17 $application = ApplicationFactory::create();
18
19 // Discover generators.
20 $discovery = new GeneratorDiscovery(new Filesystem());
21 $commands_directories[] = ApplicationFactory::getRoot() . '/src/Command';
22 $home = Utils::getHomeDirectory();
23 if (file_exists($home . '/.dcg/Command')) {
24   $commands_directories[] = $home . '/.dcg/Command';
25   $autoloader->addPsr4('DrupalCodeGenerator\\', $home . '/.dcg');
26 }
27 $generators = $discovery->getGenerators($commands_directories);
28 $application->addCommands($generators);
29
30 // Add the navigation command.
31 $application->add(new Navigation($generators));
32 $application->setDefaultCommand('navigation');
33
34 // Run.
35 $application->run();