pastebin

Paste Search Dynamic
Recent pastes
dcg
  1. #!/usr/bin/env php
  2. <?php
  3.  
  4. use DrupalCodeGeneratorApplicationFactory;
  5. use DrupalCodeGeneratorCommandNavigation;
  6. use DrupalCodeGeneratorGeneratorDiscovery;
  7. use DrupalCodeGeneratorUtils;
  8. use SymfonyComponentFilesystemFilesystem;
  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();
Parsed in 0.019 seconds