5 * Contains \Drupal\Console\Generator\ThemeGenerator.
8 namespace Drupal\Console\Generator;
10 use Drupal\Console\Core\Generator\Generator;
11 use Drupal\Console\Extension\Manager;
16 class ThemeGenerator extends Generator
21 protected $extensionManager;
24 * AuthenticationProviderGenerator constructor.
26 * @param Manager $extensionManager
28 public function __construct(
29 Manager $extensionManager
31 $this->extensionManager = $extensionManager;
37 public function generate(array $parameters)
39 $dir = $parameters['dir'];
40 $breakpoints = $parameters['breakpoints'];
41 $libraries = $parameters['libraries'];
42 $machine_name = $parameters['machine_name'];
43 $parameters['type'] = 'theme';
45 $dir = ($dir == '/' ? '': $dir) . '/' . $machine_name;
46 if (file_exists($dir)) {
48 throw new \RuntimeException(
50 'Unable to generate the bundle as the target directory "%s" exists but is a file.',
55 $files = scandir($dir);
56 if ($files != ['.', '..']) {
57 throw new \RuntimeException(
59 'Unable to generate the bundle as the target directory "%s" is not empty.',
64 if (!is_writable($dir)) {
65 throw new \RuntimeException(
67 'Unable to generate the bundle as the target directory "%s" is not writable.',
74 $themePath = $dir . '/' . $machine_name;
77 'theme/info.yml.twig',
78 $themePath . '.info.yml',
84 $themePath . '.theme',
90 'theme/libraries.yml.twig',
91 $themePath . '.libraries.yml',
98 'theme/breakpoints.yml.twig',
99 $themePath . '.breakpoints.yml',