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

Commit 1f4b79d

Browse files
committed
Merge branch 'drush-launcher'
2 parents 0863eda + d579225 commit 1f4b79d

25 files changed

+368
-83
lines changed

.travis.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,17 @@ env:
4444
# Nginx and Drush make file test - Ubuntu 16.04.
4545
- type: nginx-drush-make
4646
distro: ubuntu1604
47-
local_config: tests/ubuntu-16-nginx.config.yml
47+
local_config: tests/ubuntu-16-nginx-drush-make.config.yml
4848
config_dir: /var/www/drupalvm/config
4949

50+
# TODO: See https://github.com/geerlingguy/drupal-vm/issues/1675
5051
# PostgreSQL - Ubuntu 16.04.
51-
- type: postgresql
52-
distro: ubuntu1604
53-
local_config: tests/ubuntu-16-postgresql.config.yml
54-
config_dir: /var/www/drupalvm/config
55-
DRUSH_BIN: "${DRUPALVM_DIR}/drupal/vendor/drush/drush/drush"
56-
TEST_INSTALLED_EXTRAS: false
52+
# - type: postgresql
53+
# distro: ubuntu1604
54+
# local_config: tests/ubuntu-16-postgresql.config.yml
55+
# config_dir: /var/www/drupalvm/config
56+
# DRUSH_BIN: "${DRUPALVM_DIR}/drupal/vendor/drush/drush/drush"
57+
# TEST_INSTALLED_EXTRAS: false
5758

5859
before_install:
5960
# Pull container.

default.config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ drupalvm_cron_jobs: []
110110
# this variable is 'true'.
111111
configure_drush_aliases: true
112112
drush_aliases_host_template: "templates/drupalvm.aliases.drushrc.php.j2"
113+
drush_aliases_host_template_yml: "templates/drupalvm.aliases.yml.j2"
113114
drush_aliases_guest_template: "templates/drupalvm-local.aliases.drushrc.php.j2"
115+
drush_aliases_guest_template_yml: "templates/drupalvm-local.aliases.yml.j2"
114116

115117
# Helper variable to configure the PHP-FPM connection for each Apache
116118
# VirtualHost in the `apache_vhosts` list.
@@ -234,8 +236,6 @@ extra_packages:
234236
- sqlite
235237

236238
# You can configure almost anything else on the server in the rest of this file.
237-
drush_version: "8.1.15"
238-
239239
extra_security_enabled: false
240240

241241
firewall_enabled: true

docs/deployment/drush-make.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
If you want to build a Drupal site using a [Drush make file](http://www.drush.org/en/master/make/) instead of composer, set `drupal_build_composer_project: false`, `drupal_build_makefile: true` and either use the `example.drupal.make.yml` file as a base, or use your own Drush make file: just place it or symlink it into the root of the Drupal VM folder with the filename `drupal.make.yml`. You can also set a separate path to the makefile using the `drush_makefile_path` variable.
1+
If you want to build a Drupal site using a [Drush make file](http://www.drush.org/en/master/make/) instead of Composer, you will need to do the following:
2+
3+
- Set `drupal_build_composer_project: false`
4+
- Set `drupal_build_makefile: true`
5+
- Use the `example.drupal.make.yml` file as a base (copy it to a new file named `drupal.make.yml`), or use your own Drush make file
6+
- (You can also set a separate path to the makefile using the `drush_makefile_path` variable.)
7+
- Set the following options to force an install an older version of Drush (Drush 9+ no longer supports Drush make files):
28

39
```yaml
4-
drupal_build_composer_project: false
5-
drupal_build_makefile: true
10+
drush_launcher_install: no
11+
drush_install_from_source: yes
12+
drush_source_install_version: "8.1.15"
613
```
714
815
Have a look at the defaults in `default.config.yml` and tweak the settings as you'd like in your `config.yml`, then run `vagrant up` as in the Quick Start Guide. Within a few minutes, you should have your site running and available at the `drupal_domain` configured in `config.yml`, falling back to the default `http://drupalvm.test` set in `default.config.yml`.

docs/extras/drush.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
If you have [Drush](http://www.drush.org) and Ansible installed on your host workstation, and would like to interact with a Drupal site running inside Drupal VM, there are drush aliases automatically created by Drupal VM for each of the virtual hosts you have configured.
22

3+
> Note: Drush 9.0.0 and later require some architectural changes to the way Drush is installed and used both within Drupal VM and on your host computer. Please check the [Drush](https://github.com/drush-ops/drush/issues) and [Drupal VM](https://github.com/geerlingguy/drupal-vm/issues) issue queues if you encounter any strange behavior when using Drush.
4+
35
With the example configuration, you can manage the example Drupal site using the Drush alias `@drupalvm.test`. For example, to check if Drush can connect to the site in Drupal VM, run:
46

57
```
@@ -33,9 +35,9 @@ $ drush @drupalvm.test status
3335
Staging config path : [...]
3436
```
3537

36-
Drupal VM automatically generates a drush alias file in `~/.drush/drupalvm.aliases.drushrc.php` with an alias for every site you have defined in the `apache_vhosts` variable.
38+
Drupal VM automatically generates a drush alias file in `~/.drush/drupalvm.aliases.drushrc.php` (for Drush < 9.0.0) and `~/.drush/sites/drupalvm.site.yml` (for Drupal 9.0.0+) with an alias for every site you have defined in the `apache_vhosts` or `nginx_vhosts` variable.
3739

38-
If you want to customize the generated alias file you can override the `drush_aliases_host_template` and `drush_aliases_guest_template` variables in your `config.yml`.
40+
If you want to customize the generated alias file you can override the `drush_aliases_host_template` and `drush_aliases_guest_template` variables (or `_yml` variables for Drush 9.0.0+) in your `config.yml`.
3941

4042
```yaml
4143
drush_aliases_host_template: "{{ config_dir }}/templates/drupalvm.aliases.drushrc.php.j2"
@@ -62,7 +64,7 @@ If you're locked to an older version of Drush, it is likely that Drush will try
6264
If you're still having issues, you can avoid `sql-sync` entirely and pipe the mysqldump output yourself with:
6365

6466
```
65-
drush @remote sql-dump | drush @drupalvm.drupalvm.test sql-cli
67+
drush @remote sql-dump | drush @drupalvm.drupalvm sql-cli
6668
```
6769

6870
## Running `drush core-cron` as a cron job.

docs/extras/xdebug.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ php_xdebug_idekey: netbeans-xdebug
5353
As long as `xdebug` is listed in `installed_extras` Drupal VM is configured to accept the `PHP_IDE_CONFIG`, `XDEBUG_CONFIG` and `PHP_OPTIONS` environment variables over SSH and this can be used to set up some IDE's as well as enable XDebug on a per request basis:
5454

5555
```
56-
PHP_OPTIONS="-d xdebug.default_enable=1" drush @drupalvm.drupalvm.test migrate-import
56+
PHP_OPTIONS="-d xdebug.default_enable=1" drush @drupalvm.drupalvm migrate-import
5757
```
5858

5959
To send the environment variables when using `vagrant ssh`, [create a `Vagrantfile.local`](../extending/vagrantfile.md) with:

provisioning/playbook.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
tags: ['database']
112112

113113
- include: tasks/drush-aliases.yml
114+
when: configure_drush_aliases
114115

115116
- include: tasks/cron.yml
116117
tags: ['cron']

provisioning/requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
- src: geerlingguy.drupal-console
2323
version: 1.1.0
2424
- src: geerlingguy.drush
25-
version: 2.0.2
25+
version: 3.0.0
2626
- src: geerlingguy.elasticsearch
2727
version: 2.1.3
2828
- src: geerlingguy.firewall

provisioning/roles/geerlingguy.drush/.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
services: docker
33

44
env:
5-
# Normal installation.
5+
# Default installation.
66
- distro: centos7
77
playbook: test.yml
88
- distro: ubuntu1604
@@ -11,6 +11,9 @@ env:
1111
playbook: test.yml
1212
- distro: debian9
1313
playbook: test.yml
14+
# Install from composer.
15+
- distro: centos7
16+
playbook: test-composer-install.yml
1417
# Install from source.
1518
- distro: centos7
1619
playbook: test-source-install.yml

provisioning/roles/geerlingguy.drush/README.md

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,80 @@
22

33
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-drush.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-drush)
44

5-
Installs [Drush](http://www.drush.org/en/master/), a command line shell and scripting interface for Drupal, on any Linux or UNIX system.
5+
Installs [Drush](http://www.drush.org), a command line shell and scripting interface for Drupal, on any Linux or UNIX system.
66

77
## Requirements
88

99
PHP must be installed on the system prior to running this role (suggested role: `geerlingguy.php`).
1010

11+
Global composer installation requires Composer to also be installed on the system (suggested role: `geerlingguy.composer`).
12+
1113
Source installation additionally requires Git and Composer to also be installed on the system (suggested roles: `geerlingguy.git` and `geerlingguy.composer`).
1214

1315
## Role Variables
1416

1517
Available variables are listed below, along with default values (see `defaults/main.yml`):
1618

17-
drush_phar_url: https://github.com/drush-ops/drush/releases/download/8.1.10/drush.phar
19+
### Drush Launcher
20+
21+
[Drush Launcher](https://github.com/drush-ops/drush-launcher) is a small wrapper around Drush for your global `$PATH`.
22+
23+
It is the recommended way to use `drush`, but there are some situations where you might wish to install and run Drush globally without using Drush Launcher. The following variables control Drush Launcher's installation:
24+
25+
drush_launcher_install: yes
26+
27+
Set to `no` if you don't want the launcher installed.
1828

19-
The URL from which the Drush phar file will be downloaded.
29+
drush_launcher_version: "0.5.1"
2030

21-
drush_path: /usr/local/bin/drush
31+
The version of the Drush Launcher to install. This should exactly match an available [Drush Launcher release](https://github.com/drush-ops/drush-launcher/releases).
32+
33+
drush_launcher_phar_url: https://github.com/drush-ops/drush-launcher/releases/download/{{ drush_launcher_version }}/drush.phar
34+
35+
The URL from which the Drush Launcher phar file will be downloaded.
36+
37+
drush_launcher_path: /usr/local/bin/drush
2238

2339
The path where drush will be installed and available to your system. Should be in your user's `$PATH` so you can run commands simply with `drush` instead of the full path.
2440

25-
drush_config: ~/.drush
41+
### Drush global install via Composer
2642

27-
Path to the directory where Drush will store its generated config.
43+
Some people need to have the full power of `drush` available globally, and this role allows the global install of Drush via Composer. If using this option, make sure you have Composer installed!
2844

29-
drush_install_from_source: no
45+
drush_composer_global_install: no
3046

31-
Whether to use Git and Composer to install Drush from source.
47+
Set to `yes` (and set `drush_launcher_install` to `no`) if you want to install `drush` globally using Composer.
3248

33-
drush_version: 8.1.10
49+
drush_composer_version: "~9.0"
3450

35-
The version of Drush to download (examples: `8.1.10`, `8.1.9`). This should exactly match an available [Drush release](https://github.com/drush-ops/drush/releases). Note that setting `drush_install_from_source` to `yes` changes the possible values for `drush_version`--see below for more information.
51+
The version constraint for the global Drush installation.
52+
53+
drush_composer_update: no
54+
55+
Whether to run `composer update drush/drush` to ensure the version of Drush installed globally is the latest version.
56+
57+
drush_composer_path: /usr/local/bin/drush
58+
59+
The path in which a symlink to the Drush binary installed via Composer should be placed.
60+
61+
> NOTE: Composer 'global' installation is global _to the user under which Drush is installed_—e.g. if you install globally using the root user, `drush` will only work properly as `root` or when using `sudo`.
3662
3763
### Variables used for source install (Git).
3864

39-
drush_install_path: /usr/local/share/drush
65+
You can also install Drush from source if you need a bleeding-edge release, or if you need a specific version which can't be installed via Composer.
66+
67+
drush_install_from_source: no
68+
69+
Set to `yes` (and set `drush_launcher_install` to `no`) if you want to install `drush` globally using the Drush source code.
70+
71+
drush_source_install_bin_path: /usr/local/bin/drush
72+
drush_source_install_path: /usr/local/share/drush
4073

4174
The location of the entire drush installation (includes all the supporting files, as well as the `drush` executable file.
4275

43-
drush_version: "master"
76+
drush_source_install_version: "8.x"
4477

45-
The version of Drush to install (examples: `"master"` for the bleeding edge, `"7.x"`, `"6.x"`, `"6.2.0"`). This should be a string as it refers to a git branch, tag, or commit hash.
78+
The version of Drush to install (examples: `"master"` for the bleeding edge, `"8.x"`, `"7.x"`, `"6.2.0"`). This should be a string as it refers to a git branch, tag, or commit hash.
4679

4780
drush_keep_updated: no
4881
drush_force_update: no
Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
---
2-
# Install from phar (faster, but less flexible).
3-
drush_version: "8.1.15"
4-
drush_phar_url: https://github.com/drush-ops/drush/releases/download/{{ drush_version }}/drush.phar
5-
drush_path: /usr/local/bin/drush
2+
# Install Drush Launcher.
3+
drush_launcher_install: yes
4+
drush_launcher_version: "0.5.1"
5+
drush_launcher_phar_url: https://github.com/drush-ops/drush-launcher/releases/download/{{ drush_launcher_version }}/drush.phar
6+
drush_launcher_path: /usr/local/bin/drush
7+
8+
# Install Drush via Composer globally.
9+
drush_composer_global_install: no
10+
drush_composer_version: "~9.0"
11+
drush_composer_update: no
12+
drush_composer_path: /usr/local/bin/drush
613

714
# Install from source (git clone + composer-based install).
815
drush_install_from_source: no
9-
drush_install_path: /usr/local/share/drush
10-
# drush_version: "master"
16+
drush_source_install_bin_path: /usr/local/bin/drush
17+
drush_source_install_path: /usr/local/share/drush
18+
drush_source_install_version: "8.x"
1119
drush_keep_updated: no
1220
drush_force_update: no
1321
drush_force_composer_install: no
14-
1522
drush_composer_cli_options: "--prefer-dist --no-interaction"
1623
drush_clone_depth: 1

0 commit comments

Comments
 (0)