diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vendor/chi-teck/drupal-code-generator/src/Command/Other/ApacheVirtualHost.php	Thu Jul 05 14:24:15 2018 +0000
@@ -0,0 +1,37 @@
+<?php
+
+namespace DrupalCodeGenerator\Command\Other;
+
+use DrupalCodeGenerator\Command\BaseGenerator;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Question\Question;
+
+/**
+ * Implements other:apache-virtual-host command.
+ */
+class ApacheVirtualHost extends BaseGenerator {
+
+  protected $name = 'other:apache-virtual-host';
+  protected $description = 'Generates an Apache site configuration file';
+  protected $alias = 'apache-virtual-host';
+  protected $destination = '/etc/apache2/sites-available';
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function interact(InputInterface $input, OutputInterface $output) {
+
+    $questions = [
+      'hostname' => new Question('Host name', 'example.com'),
+      'docroot' => new Question('Document root', '/var/www/{hostname}/public'),
+    ];
+
+    $this->collectVars($input, $output, $questions);
+
+    $this->addFile()
+      ->path('{hostname}.conf')
+      ->template('other/apache-virtual-host.twig');
+  }
+
+}