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

Commit

Permalink
Merge pull request #711 from oxyc/drush-optional
Browse files Browse the repository at this point in the history
Make drush optional
  • Loading branch information
geerlingguy authored Nov 20, 2016
2 parents 740a3c2 + 2f115c9 commit 9018a48
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 2 deletions.
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"
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)
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ By default, this VM includes the extras listed in the `config.yml` option `insta
- adminer
# - blackfire
- drupalconsole
- drush
# - elasticsearch
# - java
- mailhog
# - memcached
# - newrelic
Expand Down
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
1 change: 1 addition & 0 deletions examples/acquia/acquia.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ xhprof_download_folder_name: xhprof-master
# Acquia Cloud Search defaults to Solr 4.x.
solr_version: "4.5.1"
installed_extras:
- drush
- solr
1 change: 1 addition & 0 deletions examples/prod/prod.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ mysql_root_password: root
# Only install extras that you will need/use on your site, and don't install
# development-related software on production environments!
installed_extras:
- drush
# - memcached
# - redis
# - solr
Expand Down
12 changes: 11 additions & 1 deletion provisioning/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,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 @@ -119,6 +119,16 @@
- include: tasks/build-composer-project.yml
when: build_composer_project

- name: Check if a project specific Drush binary exists.
stat: "path={{ drupal_composer_install_dir }}/vendor/drush/drush/drush"
register: drush_vendor_bin
ignore_errors: true

- name: Use project specific Drush if available.
set_fact:
drush_path: "{{ drupal_composer_install_dir }}/vendor/drush/drush/drush"
when: drush_vendor_bin.stat.exists

# Install site if configured.
- include: tasks/install-site.yml
when: install_site
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

0 comments on commit 9018a48

Please sign in to comment.