annotate vendor/chi-teck/drupal-code-generator/src/Command/Other/ApacheVirtualHost.php @ 0:c75dbcec494b

Initial commit from drush-created site
author Chris Cannam
date Thu, 05 Jul 2018 14:24:15 +0000
parents
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace DrupalCodeGenerator\Command\Other;
Chris@0 4
Chris@0 5 use DrupalCodeGenerator\Command\BaseGenerator;
Chris@0 6 use Symfony\Component\Console\Input\InputInterface;
Chris@0 7 use Symfony\Component\Console\Output\OutputInterface;
Chris@0 8 use Symfony\Component\Console\Question\Question;
Chris@0 9
Chris@0 10 /**
Chris@0 11 * Implements other:apache-virtual-host command.
Chris@0 12 */
Chris@0 13 class ApacheVirtualHost extends BaseGenerator {
Chris@0 14
Chris@0 15 protected $name = 'other:apache-virtual-host';
Chris@0 16 protected $description = 'Generates an Apache site configuration file';
Chris@0 17 protected $alias = 'apache-virtual-host';
Chris@0 18 protected $destination = '/etc/apache2/sites-available';
Chris@0 19
Chris@0 20 /**
Chris@0 21 * {@inheritdoc}
Chris@0 22 */
Chris@0 23 protected function interact(InputInterface $input, OutputInterface $output) {
Chris@0 24
Chris@0 25 $questions = [
Chris@0 26 'hostname' => new Question('Host name', 'example.com'),
Chris@0 27 'docroot' => new Question('Document root', '/var/www/{hostname}/public'),
Chris@0 28 ];
Chris@0 29
Chris@0 30 $this->collectVars($input, $output, $questions);
Chris@0 31
Chris@0 32 $this->addFile()
Chris@0 33 ->path('{hostname}.conf')
Chris@0 34 ->template('other/apache-virtual-host.twig');
Chris@0 35 }
Chris@0 36
Chris@0 37 }