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

Commit

Permalink
revert to default drupal_core_path and add example.drupal.composer.json
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyc committed Jun 4, 2016
1 parent f7f36c3 commit 95bed67
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ env:
global:
- CONFIG: tests/config.yml
MAKEFILE: example.drupal.make.yml
COMPOSERFILE: example.drupal.composer.json
HOSTNAME: drupalvm.dev
MACHINE_NAME: drupalvm
IP: 192.168.88.88
Expand Down Expand Up @@ -57,6 +58,7 @@ script:
# Copy configuration files into place.
- 'sudo docker exec "$(cat ${container_id})" cp ${DRUPALVM_DIR}/${CONFIG} ${config_dir:-$DRUPALVM_DIR}/config.yml'
- 'sudo docker exec "$(cat ${container_id})" cp ${DRUPALVM_DIR}/${MAKEFILE} ${config_dir:-$DRUPALVM_DIR}/drupal.make.yml'
- 'sudo docker exec "$(cat ${container_id})" cp ${DRUPALVM_DIR}/${COMPOSERFILE} ${config_dir:-$DRUPALVM_DIR}/drupal.composer.json'

# Override configuration variables.
- '[[ ! -z "${local_config}" ]] && sudo docker exec "$(cat ${container_id})" bash -c "cp ${DRUPALVM_DIR}/${local_config} ${config_dir:-$DRUPALVM_DIR}/local.config.yml" || true'
Expand Down
2 changes: 1 addition & 1 deletion default.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ install_site: true

# Settings for installing a Drupal site (if 'install_site:' is 'true').
drupal_major_version: 8
drupal_core_path: "{{ drupal_composer_install_dir }}/docroot"
drupal_core_path: "{{ drupal_composer_install_dir }}"
drupal_domain: "{{ vagrant_hostname }}"
drupal_site_name: "Drupal"
drupal_install_profile: standard
Expand Down
8 changes: 6 additions & 2 deletions docs/deployment/composer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ Drupal VM is configured to use [Drush make](drush-make.md) by default but suppor

## Using composer.json

Add a `drupal.composer.json` next to your `config.yml` and switch the build system by setting `build_makefile: false` and `build_composer: true` in your `config.yml`. By default Drupal VM expects the Drupal code to be installed within a `docroot/` directory, if you use a different webroot directory, you need to adjust `drupal_core_path`.
1. Copy `example.drupal.composer.json` to `drupal.composer.json` and modify it to your liking.
2. Switch the build system by setting `build_makefile: false` and `build_composer: true` in your `config.yml`.
3. Configure `drupal_core_path` to point to the webroot directory: `drupal_core_path: {{ drupal_composer_install_dir }}/docroot`

```yaml
build_makefile: false
build_composer: true
drupal_core_path: "{{ drupal_composer_install_dir }}/docroot"
```
_The file set in `drupal_composer_path` (which defaults to `drupal.composer.json`) will be copied from your host computer into the VM's `drupal_composer_install_dir` and renamed `composer.json`. If you already have a composer.json within that directory, you can set `drupal_composer_path: false`._
Expand All @@ -20,6 +23,7 @@ build_makefile: false
build_composer: true
drupal_composer_path: false
drupal_composer_install_dir: "/var/www/drupalvm"
drupal_core_path: "{{ drupal_composer_install_dir }}/docroot"
```

## Creating a project from a composer package: `composer create-project`
Expand All @@ -29,7 +33,7 @@ There's a couple of things you need to configure in your `config.yml`:
- Switch the build system by setting `build_makefile: false`, `build_composer: false` and `build_composer_project: true`.
- Configure the composer package in `drupal_composer_project_package`.
- Additionally you can adjust the create-project CLI options in `drupal_composer_project_options` as well as add additional dependencies in `drupal_composer_dependencies`.
- Ensure that the webroot configured in the composer package matches the one set in `drupal_core_path`. The default is `docroot/`.
- Ensure that the webroot configured in the composer package matches the one set in `drupal_core_path`.

With [drupal-composer/drupal-project](https://github.com/drupal-composer/drupal-project) as an example your `config.yml` overrides would be:

Expand Down
6 changes: 4 additions & 2 deletions tests/composer.json → example.drupal.composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "drupal-vm/travis-test",
"name": "custom-project/drupal-vm",
"description": "",
"type": "project",
"license": "MIT",
Expand All @@ -18,7 +18,8 @@
"require": {
"composer/installers": "^1.0.20",
"drupal-composer/drupal-scaffold": "^2.0.1",
"drupal/core": "~8.0"
"drupal/core": "~8.0",
"drupal/devel": "8.*"
},
"minimum-stability": "dev",
"prefer-stable": true,
Expand All @@ -32,3 +33,4 @@
}
}
}

2 changes: 1 addition & 1 deletion tests/ubuntu-16-nginx.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ drupalvm_webserver: nginx
# Test composer based installation.
build_makefile: false
build_composer: true
drupal_composer_path: "{{ config_dir }}/../tests/composer.json"
drupal_core_path: "{{ drupal_composer_install_dir }}/docroot"

0 comments on commit 95bed67

Please sign in to comment.