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(
23 $dir = $profile_path . '/' . $machine_name;
25 if (file_exists($dir)) {
27 throw new \RuntimeException(
29 'Unable to generate the profile as the target directory "%s" exists but is a file.',
34 $files = scandir($dir);
35 if ($files != ['.', '..']) {
36 throw new \RuntimeException(
38 'Unable to generate the profile as the target directory "%s" is not empty.',
43 if (!is_writable($dir)) {
44 throw new \RuntimeException(
46 'Unable to generate the profile as the target directory "%s" is not writable.',
54 'profile' => $profile,
55 'machine_name' => $machine_name,
58 'description' => $description,
59 'dependencies' => $dependencies,
60 'distribution' => $distribution,
64 'profile/info.yml.twig',
65 $dir . '/' . $machine_name . '.info.yml',
70 'profile/profile.twig',
71 $dir . '/' . $machine_name . '.profile',
76 'profile/install.twig',
77 $dir . '/' . $machine_name . '.install',