Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Make drush optional #711

Merged
merged 7 commits into from
Nov 20, 2016
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
MACHINE_NAME: drupalvm
IP: 192.168.88.88
DRUPALVM_DIR: /var/www/drupalvm
DRUSH_BIN: drush
TEST_INSTALLED_EXTRAS: true
matrix:
# Defaults - Ubuntu 16.04.
Expand All @@ -31,6 +32,7 @@ env:
run_opts: "--privileged"
local_config: tests/ubuntu-16-postgresql.config.yml
config_dir: /var/www/drupalvm/config
DRUSH_BIN: "${DRUPALVM_DIR}/drupal/vendor/drush/drush/drush"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With #991 drush is no longer installed in this scenario.

TEST_INSTALLED_EXTRAS: false
# Defaults - CentOS 7.
- type: centos
Expand Down Expand Up @@ -131,7 +133,7 @@ script:
|| (echo 'Dashboard install fail' && exit 1)

- >
docker exec ${container_id} drush @${MACHINE_NAME}.${HOSTNAME} status
docker exec ${container_id} ${DRUSH_BIN} @${MACHINE_NAME}.${HOSTNAME} status
| grep -q 'Drupal bootstrap.*Successful'
&& (echo 'Drush install pass' && exit 0)
|| (echo 'Drush install fail' && exit 1)
1 change: 1 addition & 0 deletions default.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ installed_extras:
- adminer
# - blackfire
- drupalconsole
- drush
# - elasticsearch
# - java
- mailhog
Expand Down
7 changes: 6 additions & 1 deletion provisioning/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@
- geerlingguy.php
- geerlingguy.php-pecl
- geerlingguy.composer
- geerlingguy.drush
- { role: geerlingguy.mysql, when: drupalvm_database == 'mysql' }
- { role: geerlingguy.php-mysql, when: drupalvm_database == 'mysql' }
- { role: geerlingguy.postgresql, when: drupalvm_database == 'pgsql' }
- { role: geerlingguy.php-pgsql, when: drupalvm_database == 'pgsql' }

# Conditionally-installed roles.
- { role: geerlingguy.drupal-console, when: 'drupal_major_version > 7 and "drupalconsole" in installed_extras' }
- { role: geerlingguy.drush, when: '"drush" in installed_extras' }
- { role: geerlingguy.memcached, when: '"memcached" in installed_extras' }
- { role: geerlingguy.php-memcached, when: '"memcached" in installed_extras' }
- { role: geerlingguy.php-xdebug, when: '"xdebug" in installed_extras' }
Expand Down Expand Up @@ -100,6 +100,11 @@
set_fact:
drupal_site_exists: "{{ drupal_site.stat.exists|default(false) }}"

- name: Update drush_path if drush is not available globally.
set_fact:
drush_path: "{{ drupal_composer_install_dir }}/vendor/drush/drush/drush"
when: "'drush' not in installed_extras"
Copy link
Collaborator Author

@oxyc oxyc Nov 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to variable precedence this will override the role default but can still be overridden in config.yml. I think? I'll test it and make sure a bit later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, it's not possible to override it.


- include: tasks/sshd.yml
- include: tasks/extras.yml
- include: tasks/www.yml
Expand Down
3 changes: 3 additions & 0 deletions provisioning/templates/drupalvm.aliases.drushrc.php.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ $aliases['{{ host }}'] = array(
'remote-host' => '{{ host }}',
'remote-user' => '{{ vagrant_user }}',
'ssh-options' => '-o PasswordAuthentication=no -i ' . drush_server_home() . '/.vagrant.d/insecure_private_key',
'path-aliases' => array(
'%drush-script' => '{{ drush_path }}',
),
);

{% endif -%}
Expand Down