Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / vendor / chi-teck / drupal-code-generator / src / Command / Drupal_8 / Composer.php
1 <?php
2
3 namespace DrupalCodeGenerator\Command\Drupal_8;
4
5 use DrupalCodeGenerator\Command\BaseGenerator;
6 use DrupalCodeGenerator\Utils;
7 use Symfony\Component\Console\Input\InputInterface;
8 use Symfony\Component\Console\Output\OutputInterface;
9 use Symfony\Component\Console\Question\ConfirmationQuestion;
10 use Symfony\Component\Console\Question\Question;
11
12 /**
13  * Implements d8:composer command.
14  */
15 class Composer extends BaseGenerator {
16
17   protected $name = 'd8:composer';
18   protected $description = 'Generates a composer.json file';
19   protected $alias = 'composer.json';
20   protected $label = 'composer.json';
21
22   /**
23    * {@inheritdoc}
24    */
25   protected function interact(InputInterface $input, OutputInterface $output) {
26     $questions['machine_name'] = new Question('Project machine name');
27     $questions['machine_name']->setValidator([Utils::class, 'validateMachineName']);
28     $questions['description'] = new Question('Description');
29     $questions['type'] = new Question('Type', 'drupal-module');
30     $questions['type']->setValidator([Utils::class, 'validateRequired']);
31     $questions['type']->setAutocompleterValues([
32       'drupal-module',
33       'drupal-theme',
34       'drupal-library',
35       'drupal-profile',
36       'drupal-drush',
37     ]);
38     $questions['drupal_org'] = new ConfirmationQuestion('Is this project hosted on drupal.org?', FALSE);
39
40     $this->collectVars($input, $output, $questions);
41
42     $this->addFile()
43       ->path('composer.json')
44       ->template('d8/composer.twig');
45   }
46
47 }