You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-25Lines changed: 27 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,7 @@
1
-
[](https://github.com/ddev/ddev-drupal-contrib/actions/workflows/tests.yml)
@@ -11,27 +14,22 @@ DDEV integration for developing Drupal contrib projects. As a general philosophy
11
14
2.`git clone` your contrib module
12
15
3. cd [contrib module directory]
13
16
4. Configure DDEV for Drupal using `ddev config --project-type=drupal --docroot=web --php-version=8.3 --corepack-enable --project-name=[module]` or select these options when prompted using `ddev config`
14
-
- Remove underscores in the project name, or replace with hyphens. (DDEV will do this for you in v1.23.5+)
17
+
- Remove underscores in the project name, or replace with hyphens. (DDEV will do this for you.)
15
18
- See [Misc](#misc) for help on using alternate versions of Drupal core.
16
-
5. Run `ddev add-on get ddev/ddev-drupal-contrib` (or `ddev get ddev/ddev-drupal-contrib` if your DDEV version is older than 1.23.5)
19
+
5. Run `ddev add-on get ddev/ddev-drupal-contrib`
17
20
6. Run `ddev start`
18
21
7. Run `ddev poser`
19
22
8. Run `ddev symlink-project`
20
23
9.`ddev config --update` to detect expected Drupal and PHP versions.
21
24
10.`ddev restart`
22
25
23
-
## Update
26
+
After installation, make sure to commit the `.ddev` directory to version control.
24
27
25
-
For DDEV v1.23.5 or above run
28
+
## Update
26
29
27
-
```sh
30
+
```bash
28
31
ddev add-on get ddev/ddev-drupal-contrib
29
-
```
30
-
31
-
For earlier versions of DDEV run
32
-
33
-
```sh
34
-
ddev get ddev/ddev-drupal-contrib
32
+
ddev restart
35
33
```
36
34
37
35
## Commands
@@ -73,24 +71,26 @@ Run tests on the `web/modules/custom` directory:
73
71
74
72
## Changing defaults
75
73
76
-
Override any environment variable value from [.ddev/config.contrib.yaml](config.contrib.yaml) by creating a `.ddev/config.local.yaml` (or [any filename lexicographically following config.contrib.yaml](https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#extending-configyaml-with-custom-configyaml-files)) file which has the same structure as [.ddev/config.contrib.yaml](config.contrib.yaml). Add your overrides under `web_environment`.
74
+
Override any environment variable value from [.ddev/config.contrib.yaml](config.contrib.yaml) by creating a `.ddev/config.local.yaml` (or [any filename lexicographically following config.contrib.yaml](https://ddev.readthedocs.io/en/stable/users/extend/customization-extendibility/#extending-configyaml-with-custom-configyaml-files)) file which has the same structure as [.ddev/config.contrib.yaml](config.contrib.yaml). Add your overrides under `web_environment`.
77
75
78
76
### Changing the Drupal core version
79
77
80
78
In `.ddev/config.local.yaml` set the Drupal core version:
81
-
```
79
+
80
+
```yaml
82
81
web_environment:
83
82
- DRUPAL_CORE=^11
84
83
```
85
84
86
85
Then run `ddev restart` and then `ddev poser` to update the Drupal core version.
87
86
88
-
If Drupal core cannot be changed because the project is using an unsupported version of PHP, `ddev poser` will show a `composer` error. In that case, open `.ddev/config.yaml` and change the `PHP_VERSION` to a supported version; then run `ddev restart` and `ddev poser` again. Note that the project PHP version is set in `.ddev/config.yaml`, while the core version to use is set in `.ddev/config.local.yaml`.
87
+
If Drupal core cannot be changed because the project is using an unsupported version of PHP, `ddev poser` will show a `composer` error. In that case, open `.ddev/config.yaml` and change the `PHP_VERSION` to a supported version; then run `ddev restart` and `ddev poser` again. Note that the project PHP version is set in `.ddev/config.yaml`, while the core version to use is set in `.ddev/config.local.yaml`.
89
88
90
89
### Changing the symlink location
91
90
92
91
In `.ddev/config.local.yaml` set the location relative to webroot (which usually is `web/`). Defaults to `modules/custom`
93
-
```
92
+
93
+
```yaml
94
94
web_environment:
95
95
- ...
96
96
- DRUPAL_PROJECTS_PATH=modules
@@ -127,7 +127,7 @@ You can set up a pre-commit hook that runs phpcbf:
127
127
2. Add the following lines to the `pre-commit` file:
128
128
129
129
```bash
130
-
#!/bin/bash
130
+
#!/usr/bin/env bash
131
131
132
132
ddev phpcbf -q
133
133
```
@@ -136,31 +136,31 @@ ddev phpcbf -q
136
136
137
137
## Add-on tests
138
138
139
-
Tests are done with Bats. It is a testing framework that uses Bash.
139
+
Tests are done with Bats. It is a testing framework that uses Bash.
140
140
141
-
To run tests locally you need to first install bats' git submodules with:
141
+
To run tests locally you need to first install bats' git submodules with:
142
142
143
-
```sh
143
+
```bash
144
144
git submodule update --init
145
145
```
146
146
147
147
Then you can run within the root of this project:
148
148
149
-
```sh
149
+
```bash
150
150
./tests/bats/bin/bats ./tests
151
151
```
152
152
153
-
Tests will be run using the default drupal core of the contrib. To test against a different Drupal core version, update the `TEST_DRUPAL_CORE` environment
153
+
Tests will be run using the default drupal core of the contrib. To test against a different Drupal core version, update the `TEST_DRUPAL_CORE` environment
154
154
variable.
155
155
156
156
i.e. `TEST_DRUPAL_CORE=11 ./tests/bats/bin/bats ./tests`.
157
157
158
-
Tests are triggered automatically on every push to the
158
+
Tests are triggered automatically on every push to the
159
159
repository, and periodically each night. The automated tests are agains all of
160
160
the supported Drupal core versions.
161
161
162
-
Please make sure to attend to test failures when they happen. Others will be
163
-
depending on you.
162
+
Please make sure to attend to test failures when they happen. Others will be
163
+
depending on you.
164
164
165
165
Also, consider adding tests to test for bugs or new features on your PR.
166
166
@@ -180,4 +180,6 @@ type: drupal
180
180
181
181
Don't forget to run `ddev restart` if `.ddev/config.yaml` has been updated.
182
182
183
+
## Credits
184
+
183
185
**Contributed and maintained by [@weitzman](https://github.com/weitzman)**
0 commit comments