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

Commit 1c53c9b

Browse files
committed
Add docs on how to patch Drupal VM [ci skip]
1 parent d2b6c9a commit 1c53c9b

File tree

3 files changed

+41
-0
lines changed

3 files changed

+41
-0
lines changed

docs/deployment/composer-dependency.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,7 @@ _Note that `drupal_core_path` needs to match your `composer.json` configuration.
3232
If you placed the `config.yml` file in a subdirectory, tell Drupal VM where by adding the location to your `composer.json`. If not, Drupal VM will look for all configuration files in the root of your project.
3333

3434
composer config extra.drupalvm.config_dir 'vm'
35+
36+
## Patching Drupal VM
37+
38+
If you need to patch something in Drupal VM that you're otherwise unable to configure, you can do so with the help of the `composer-patches` plugin. Read the [documentation on how to create and apply patches](../extending/patching.md).

docs/extending/patching.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
If you're using Drupal VM as a Composer dependency and need to patch something that you're otherwise unable to configure, you can do so with the help of the [`composer-patches` plugin](https://github.com/cweagans/composer-patches).
2+
3+
Grab a clone of the Drupal VM version your project is using:
4+
5+
git clone https://github.com/geerlingguy/drupal-vm.git drupal-vm
6+
cd drupal-vm
7+
git checkout 5.0.0
8+
9+
Make the changes you need and create a patch using `git diff`:
10+
11+
git diff --cached > custom-roles.patch
12+
13+
Move this file to your project somewhere, eg. `vm/patches/custom-roles.patch`.
14+
15+
Require the [`composer-patches` plugin](https://github.com/cweagans/composer-patches) as a dependency to your project unless you already have it:
16+
17+
composer require cweagans/composer-patches
18+
19+
Add the patch to the `extra`-field in your `composer.json`:
20+
21+
{
22+
"extra": {
23+
"patches": {
24+
"geerlingguy/drupal-vm": {
25+
"Include custom Drupal VM roles": "vm/patches/custom-roles.patch"
26+
}
27+
}
28+
}
29+
}
30+
31+
Re-install the Drupal VM package to apply the patch:
32+
33+
composer remove --dev geerlingguy/drupal-vm
34+
composer require --dev geerlingguy/drupal-vm:5.0.0
35+
36+
Your Drupal VM version is now been patched!

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pages:
6464
- 'Adding Vagrant plugins Vagrantfile.local': 'extending/vagrantfile.md'
6565
- 'Passing on CLI arguments to ansible': 'extending/ansible-args.md'
6666
- 'Pre- and Post-Provision Scripts': 'extending/scripts.md'
67+
- 'Patching Drupal VM': 'extending/patching.md'
6768
- Other Information:
6869
- 'Networking Notes': 'other/networking.md'
6970
- 'Vagrant and VirtualBox': 'other/vagrant-virtualbox.md'

0 commit comments

Comments
 (0)