Skip to content

Commit

Permalink
[generate:site:alias] Add drupal console binary option (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjuarez20 authored and enzolutions committed May 17, 2019
1 parent c897e04 commit db3fa22
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/Command/Generate/SiteAliasCommand.php
Expand Up @@ -47,6 +47,7 @@ class SiteAliasCommand extends Command
private $extraOptions = [
'ssh' => [
'none' => '',
'tty' => '-tt',
'vagrant' => '-o PasswordAuthentication=no -i ~/.vagrant.d/insecure_private_key',
],
'container' => [
Expand Down Expand Up @@ -131,6 +132,12 @@ protected function configure()
InputOption::VALUE_OPTIONAL,
$this->trans('commands.generate.site.alias.options.port')
)
->addOption(
'drupal-console-binary',
null,
InputOption::VALUE_OPTIONAL,
$this->trans('commands.generate.site.alias.options.drupal-console-binary')
)
->addOption(
'extra-options',
null,
Expand Down Expand Up @@ -232,6 +239,19 @@ protected function interact(
}

if ($type !== 'local') {
$drupalConsoleBinary = $input->getOption('drupal-console-binary');
if (!$drupalConsoleBinary) {

$drupalConsoleBinary = $this->getIo()->askEmpty(
$this->trans(
'commands.generate.site.alias.questions.drupal-console-binary'
),
'drupal'
);

$input->setOption('drupal-console-binary', $drupalConsoleBinary);
}

$extraOptions = $input->getOption('extra-options');
if (!$extraOptions) {
$options = array_values($this->extraOptions[$type]);
Expand Down Expand Up @@ -308,6 +328,7 @@ protected function execute(
'environment' => $input->getOption('environment'),
'type' => $input->getOption('type'),
'extra_options' => $input->getOption('extra-options'),
'drupal_console_binary' => $input->getOption('drupal-console-binary'),
'root' => $input->getOption('composer-root'),
'uri' => $input->getOption('site-uri'),
'port' => $input->getOption('port'),
Expand Down
7 changes: 6 additions & 1 deletion templates/core/sites/alias.yml.twig
Expand Up @@ -10,9 +10,14 @@
{% if user %}
user: {{ user }}
{% endif %}
{% if uri %}
{% if uri or drupal_console_binary %}
options:
{% if uri %}
uri: {{ uri }}
{% endif %}
{% if drupal_console_binary %}
drupal-console-binary: {{ drupal_console_binary }}
{% endif %}
{% else %}
# options:
{% endif %}
Expand Down

0 comments on commit db3fa22

Please sign in to comment.