5 * Contains \Drupal\Console\Generator\ProfileGenerator.
8 namespace Drupal\Console\Generator;
10 use Drupal\Console\Core\Generator\Generator;
12 class ProfileGenerator extends Generator
17 public function generate(array $parameters)
19 $dir = $parameters['dir'];
20 $machine_name = $parameters['machine_name'];
22 $dir = ($dir == '/' ? '' : $dir) . '/' . $machine_name;
23 if (file_exists($dir)) {
25 throw new \RuntimeException(
27 'Unable to generate the profile as the target directory "%s" exists but is a file.',
32 $files = scandir($dir);
33 if ($files != ['.', '..']) {
34 throw new \RuntimeException(
36 'Unable to generate the profile as the target directory "%s" is not empty.',
41 if (!is_writable($dir)) {
42 throw new \RuntimeException(
44 'Unable to generate the profile as the target directory "%s" is not writable.',
51 $profilePath = $dir . '/' . $machine_name;
55 'profile/info.yml.twig',
56 $profilePath . '.info.yml',
61 'profile/profile.twig',
62 $profilePath . '.profile',
67 'profile/install.twig',
68 $profilePath . '.install',