5 * Contains \Drupal\Console\Generator\ProfileGenerator.
8 namespace Drupal\Console\Generator;
10 use Drupal\Console\Core\Generator\Generator;
12 class ProfileGenerator extends Generator
14 public function generate(
24 $dir = $profile_path . '/' . $machine_name;
26 if (file_exists($dir)) {
28 throw new \RuntimeException(
30 'Unable to generate the profile as the target directory "%s" exists but is a file.',
35 $files = scandir($dir);
36 if ($files != ['.', '..']) {
37 throw new \RuntimeException(
39 'Unable to generate the profile as the target directory "%s" is not empty.',
44 if (!is_writable($dir)) {
45 throw new \RuntimeException(
47 'Unable to generate the profile as the target directory "%s" is not writable.',
55 'profile' => $profile,
56 'machine_name' => $machine_name,
59 'description' => $description,
60 'dependencies' => $dependencies,
62 'distribution' => $distribution,
66 'profile/info.yml.twig',
67 $dir . '/' . $machine_name . '.info.yml',
72 'profile/profile.twig',
73 $dir . '/' . $machine_name . '.profile',
78 'profile/install.twig',
79 $dir . '/' . $machine_name . '.install',