diff --git a/.travis.yml b/.travis.yml index a30f50165..215d465e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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. @@ -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 @@ -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) diff --git a/README.md b/README.md index 544294cf7..fb93f26e4 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/default.config.yml b/default.config.yml index b896e570a..deec7e8af 100644 --- a/default.config.yml +++ b/default.config.yml @@ -192,6 +192,7 @@ installed_extras: - adminer # - blackfire - drupalconsole + - drush # - elasticsearch # - java - mailhog diff --git a/examples/acquia/acquia.config.yml b/examples/acquia/acquia.config.yml index e991adeed..23b485fe5 100644 --- a/examples/acquia/acquia.config.yml +++ b/examples/acquia/acquia.config.yml @@ -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 diff --git a/examples/prod/prod.config.yml b/examples/prod/prod.config.yml index 76b0ea6ef..4f0fa06d1 100644 --- a/examples/prod/prod.config.yml +++ b/examples/prod/prod.config.yml @@ -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 diff --git a/provisioning/playbook.yml b/provisioning/playbook.yml index 6a32407b5..0301de3ad 100644 --- a/provisioning/playbook.yml +++ b/provisioning/playbook.yml @@ -54,7 +54,6 @@ - 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' } @@ -62,6 +61,7 @@ # 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' } @@ -118,6 +118,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 diff --git a/provisioning/templates/drupalvm.aliases.drushrc.php.j2 b/provisioning/templates/drupalvm.aliases.drushrc.php.j2 index cc9249bf6..1fff6d7be 100644 --- a/provisioning/templates/drupalvm.aliases.drushrc.php.j2 +++ b/provisioning/templates/drupalvm.aliases.drushrc.php.j2 @@ -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 -%}