Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
171449e
Fix 8.4.x
webflo Jun 22, 2017
51242c3
Update .travis.yml
webflo Jun 22, 2017
ab93678
Update .travis.yml
webflo Jun 22, 2017
6b59ee5
Update .travis.yml
webflo Jun 22, 2017
b7024ff
Fix symfony version in 8.4.x (#285)
webflo Jun 22, 2017
217da1c
Issue #287: Fix dead link to Drush make
webflo Jul 2, 2017
f7e99e0
Update composer.json (#293)
webflo Aug 8, 2017
7c4120c
Update .travis.yml (#296)
webflo Aug 12, 2017
6b9e0fd
Update drupal/console (#301)
webflo Aug 22, 2017
16a2a2d
Fix whitespace
webflo Aug 28, 2017
678d415
Add support for Drush 9 and Drupal 8.4
pfrenssen Sep 4, 2017
4487b2e
Update .travis.yml
webflo Sep 4, 2017
e861d65
Update .travis.yml
webflo Sep 4, 2017
8ebc3e1
Added composer validate to CI.
thom8 Sep 25, 2017
7ddc4ee
Declare compatibility with versions of Drush and CSS selector that ar…
pfrenssen Oct 11, 2017
ed6b7c2
Merge pull request #309 from thom8/composer_validate
pfrenssen Oct 11, 2017
6418a08
Merge pull request #304 from pfrenssen/patch-1
pfrenssen Oct 17, 2017
89a6e99
Update composer dependencies (#325)
webflo Nov 1, 2017
9646b71
Update README.md (#334)
Nov 13, 2017
c5f0d69
Run tests with 8.5.x (#329)
webflo Dec 8, 2017
f1d0d87
Replace GPL-2.0+ by GPL-2.0-or-later
webflo Jan 21, 2018
918efcc
Bump drush version
webflo Jan 24, 2018
ffbdbf1
Replace require-dev with webflo/drupal-core-require-dev (#348)
webflo Jan 30, 2018
902fa86
Update /drush dir for Drush9
weitzman Feb 9, 2018
527cd79
Revert "Update /drush dir for Drush9"
weitzman Feb 9, 2018
e34719c
Update /drush dir for Drush9 (#350)
weitzman Mar 6, 2018
6d886d9
Add platform version to FAQ to help user specifying PHP version, fixe…
tostinni Mar 7, 2018
d0568a8
Update to Drupal 8.5
webflo Mar 7, 2018
c08d188
Run tests with 8.6.x
webflo Mar 8, 2018
5693600
Improve update instructions (#366)
alexpott Mar 8, 2018
1665375
Honor .env files and suggest usage (#351)
weitzman Mar 16, 2018
6be94f4
Remove extra whitespace (#371)
zaporylie Mar 27, 2018
9e90e4f
Updated argument name
Mar 28, 2018
9167252
Bump minimal version
webflo Mar 28, 2018
7b0f5c5
Merge pull request #376 from morenstrat/patch-1
weitzman Mar 28, 2018
24ab11d
Bump minimal version to 8.5.3
webflo Apr 26, 2018
4a35beb
Fix installer path for drush commandfiles.
weitzman May 25, 2018
f28a782
Merge pull request #394 from drupal-composer/commandfiles
weitzman May 26, 2018
04138e3
Update drupal-composer/drupal-scaffold
webflo May 29, 2018
dc7e438
Fix tests on Travis CI (#405)
webflo Jun 26, 2018
3be2be5
Copy the editor config and gitattributes from drupal to the root. (#404)
rodrigoaguilera Jun 26, 2018
b0c4ce8
Remove "drupal-scaffold" from scripts (#275)
webflo Jun 26, 2018
2b9d84a
Fix typo in README.md
webflo Jun 26, 2018
24f29be
Remove unused use statement. (#406)
Jun 28, 2018
96f02b3
Adjust default core patch level to -p2. (#418)
milkovsky Aug 16, 2018
970d307
Bump minimum required composer-patches version to support default pat…
mxr576 Aug 16, 2018
c1e2b6e
Update composer.json to require latest stable version of Drupal (#424)
grasmash Sep 6, 2018
21698cf
Require zaporylie/composer-drupal-optimizations (#442)
andypost Jan 26, 2019
4a664d2
Issue #408: Bump minimum PHP version to 5.6
webflo Jan 26, 2019
4eb9750
Removing redundant "--stability dev" from installation command (#450)
hansfn Jan 26, 2019
f2b83dc
Added "composer-exit-on-patch-failure": true option to composer.json …
MPParsley Jan 26, 2019
4229ace
Sync new lines at the end of the files (#453)
petk Jan 31, 2019
85d302e
Quote wildcards to avoid issues in some shells (#456)
gagarine Mar 13, 2019
d8ee4b4
Add PHP 7.3 to Travis CI (#476)
petk Apr 8, 2019
9e036f0
Change createRequiredFiles messages to reflect what occured (#467)
foxtrotcharlie Apr 9, 2019
e55e401
Drop PHP 5.6 testing (#489)
webflo May 2, 2019
0bc7270
Bump minimum version to 8.7.0 (#488)
webflo May 2, 2019
ec0f411
Update .travis.yml
webflo May 2, 2019
5085410
Deprecate PHP 7.0 and 7.1 (#518)
MPParsley Sep 20, 2019
4de4379
Revert "Deprecate PHP 7.1" (#521)
webflo Sep 20, 2019
a49e205
Issue #518: Bump minimum php version to 7.0.8
webflo Sep 21, 2019
ee5bf36
Update CI to Ubuntu 18.04 (#520)
webflo Sep 21, 2019
309e83c
Revert "Update CI to Ubuntu 18.04" (#526)
webflo Sep 26, 2019
bdaa8fd
Add 'contrib' to Drush commandfile installer path (#525)
greg-1-anderson Sep 26, 2019
53f6910
Prefer usage of && operator instead of "and" (#530)
paulvandenburg Nov 8, 2019
d2e7410
Use scaffold plugin and composer packages from Drupal core 8.8.0 (#522)
greg-1-anderson Dec 5, 2019
04a3fe0
Issue #539: Remove deprecated CONFIG_SYNC_DIRECTORY
webflo Dec 18, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Copy and rename this file to .env at root of this project.
#

# A common use case is to supply database creds via the environment. Edit settings.php
# like so:
#
# $databases['default']['default'] = [
# 'database' => getenv('MYSQL_DATABASE'),
# 'driver' => 'mysql',
# 'host' => getenv('MYSQL_HOSTNAME'),
# 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
# 'password' => getenv('MYSQL_PASSWORD'),
# 'port' => getenv('MYSQL_PORT'),
# 'prefix' => '',
# 'username' => getenv('MYSQL_USER'),
# ];
#
# Uncomment and populate as needed.
# MYSQL_DATABASE=
# MYSQL_HOSTNAME=
# MYSQL_PASSWORD=
# MYSQL_PORT=
# MYSQL_USER=

# Another common use case is to set Drush's --uri via environment.
# DRUSH_OPTIONS_URI=http://example.com
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@

# Ignore files generated by PhpStorm
/.idea/

# Ignore .env files as they are personal
/.env
20 changes: 10 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ dist: trusty
sudo: false

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3

env:
global:
Expand All @@ -23,18 +24,17 @@ before_install:
- composer --version

install:
- composer --verbose validate
- composer --verbose install

script:
- if [[ $RELEASE = dev ]]; then composer --verbose remove --no-update drupal/console; fi;
- if [[ $RELEASE = dev ]]; then composer --verbose require --no-update drupal/core:8.4.x-dev drush/drush:9.0.x-dev; fi;
- if [[ $RELEASE = dev ]]; then composer --verbose require --no-update drupal/core:8.8.x-dev; composer --verbose require --no-update --dev drupal/core-dev:8.8.x-dev; fi;
- if [[ $RELEASE = dev ]]; then composer --verbose update; fi;
- cd $TRAVIS_BUILD_DIR/web
- ./../vendor/bin/drush site-install --verbose --yes --db-url=sqlite://tmp/site.sqlite
- ./../vendor/bin/drush runserver $SIMPLETEST_BASE_URL &
- ./vendor/bin/drush site-install --verbose --yes --db-url=sqlite://tmp/site.sqlite
- ./vendor/bin/drush runserver $SIMPLETEST_BASE_URL &
- until curl -s $SIMPLETEST_BASE_URL; do true; done > /dev/null
# Skip core/tests/Drupal/Tests/ComposerIntegrationTest.php because web/ has no composer.json
# Ignore PageCache group temporarily, @see https://www.drupal.org/node/2770673
- ./../vendor/bin/phpunit -c core --testsuite unit --exclude-group Composer,DependencyInjection,PageCache
- ./../vendor/bin/drush
- if [[ $RELEASE = stable ]]; then ./../vendor/bin/drupal; fi;
# Run a single unit test to verfiy the testing setup.
- ./vendor/bin/phpunit -c ./web/core ./web/core/modules/system/tests/src/Unit/SystemRequirementsTest.php
- ./vendor/bin/drush
- if [[ $RELEASE = stable ]]; then ./vendor/bin/drupal; fi;
74 changes: 44 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,37 @@

[![Build Status](https://travis-ci.org/drupal-composer/drupal-project.svg?branch=8.x)](https://travis-ci.org/drupal-composer/drupal-project)

This project template should provide a kickstart for managing your site
This project template provides a starter kit for managing your site
dependencies with [Composer](https://getcomposer.org/).

If you want to know how to use it as replacement for
[Drush Make](https://github.com/drush-ops/drush/blob/master/docs/make.md) visit
[Drush Make](https://github.com/drush-ops/drush/blob/8.x/docs/make.md) visit
the [Documentation on drupal.org](https://www.drupal.org/node/2471553).

## Usage

First you need to [install composer](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).

> Note: The instructions below refer to the [global composer installation](https://getcomposer.org/doc/00-intro.md#globally).
You might need to replace `composer` with `php composer.phar` (or similar)
You might need to replace `composer` with `php composer.phar` (or similar)
for your setup.

After that you can create the project:

```
composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
composer create-project drupal-composer/drupal-project:8.x-dev some-dir --no-interaction
```

With `composer require ...` you can download new dependencies to your
With `composer require ...` you can download new dependencies to your
installation.

```
cd some-dir
composer require drupal/devel:~1.0
```

The `composer create-project` command passes ownership of all files to the
project that is created. You should create a new git repository, and commit
The `composer create-project` command passes ownership of all files to the
project that is created. You should create a new git repository, and commit
all files not excluded by the .gitignore file.

## What does the template do?
Expand All @@ -49,29 +49,30 @@ When installing the given `composer.json` some tasks are taken care of:
* Creates `web/sites/default/files`-directory.
* Latest version of drush is installed locally for use at `vendor/bin/drush`.
* Latest version of DrupalConsole is installed locally for use at `vendor/bin/drupal`.
* Creates environment variables based on your .env file. See [.env.example](.env.example).

## Updating Drupal Core

This project will attempt to keep all of your Drupal Core files up-to-date; the
project [drupal-composer/drupal-scaffold](https://github.com/drupal-composer/drupal-scaffold)
is used to ensure that your scaffold files are updated every time drupal/core is
updated. If you customize any of the "scaffolding" files (commonly .htaccess),
you may need to merge conflicts if any of your modified files are updated in a
This project will attempt to keep all of your Drupal Core files up-to-date; the
project [drupal/core-composer-scaffold](https://github.com/drupal/core-composer-scaffold)
is used to ensure that your scaffold files are updated every time drupal/core is
updated. If you customize any of the "scaffolding" files (commonly .htaccess),
you may need to merge conflicts if any of your modified files are updated in a
new release of Drupal core.

Follow the steps below to update your core files.

1. Run `composer update drupal/core --with-dependencies` to update Drupal Core and its dependencies.
1. Run `git diff` to determine if any of the scaffolding files have changed.
Review the files for any changes and restore any customizations to
1. Run `composer update drupal/core drupal/core-dev --with-dependencies` to update Drupal Core and its dependencies.
2. Run `git diff` to determine if any of the scaffolding files have changed.
Review the files for any changes and restore any customizations to
`.htaccess` or `robots.txt`.
1. Commit everything all together in a single commit, so `web` will remain in
sync with the `core` when checking out branches or running `git bisect`.
1. In the event that there are non-trivial conflicts in step 2, you may wish
to perform these steps on a branch, and use `git merge` to combine the
updated core files with your customized files. This facilitates the use
of a [three-way merge tool such as kdiff3](http://www.gitshah.com/2010/12/how-to-setup-kdiff-as-diff-tool-for-git.html). This setup is not necessary if your changes are simple;
keeping all of your modifications at the beginning or end of the file is a
1. In the event that there are non-trivial conflicts in step 2, you may wish
to perform these steps on a branch, and use `git merge` to combine the
updated core files with your customized files. This facilitates the use
of a [three-way merge tool such as kdiff3](http://www.gitshah.com/2010/12/how-to-setup-kdiff-as-diff-tool-for-git.html). This setup is not necessary if your changes are simple;
keeping all of your modifications at the beginning or end of the file is a
good strategy to keep merges easy.

## Generate composer.json from existing project
Expand All @@ -85,47 +86,60 @@ that the generated `composer.json` might differ from this project's file.

### Should I commit the contrib modules I download?

Composer recommends **no**. They provide [argumentation against but also
Composer recommends **no**. They provide [argumentation against but also
workrounds if a project decides to do it anyway](https://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md).

### Should I commit the scaffolding files?

The [drupal-scaffold](https://github.com/drupal-composer/drupal-scaffold) plugin can download the scaffold files (like
The [Drupal Composer Scaffold](https://github.com/drupal/core-composer-scaffold) plugin can download the scaffold files (like
index.php, update.php, …) to the web/ directory of your project. If you have not customized those files you could choose
to not check them into your version control system (e.g. git). If that is the case for your project it might be
convenient to automatically run the drupal-scaffold plugin after every install or update of your project. You can
achieve that by registering `@drupal-scaffold` as post-install and post-update command in your composer.json:
achieve that by registering `@composer drupal:scaffold` as post-install and post-update command in your composer.json:

```json
"scripts": {
"drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
"post-install-cmd": [
"@drupal-scaffold",
"@composer drupal:scaffold",
"..."
],
"post-update-cmd": [
"@drupal-scaffold",
"@composer drupal:scaffold",
"..."
]
},
```
### How can I apply patches to downloaded modules?

If you need to apply patches (depending on the project being modified, a pull
request is often a better solution), you can do so with the
If you need to apply patches (depending on the project being modified, a pull
request is often a better solution), you can do so with the
[composer-patches](https://github.com/cweagans/composer-patches) plugin.

To add a patch to drupal module foobar insert the patches section in the extra
To add a patch to drupal module foobar insert the patches section in the extra
section of composer.json:
```json
"extra": {
"patches": {
"drupal/foobar": {
"Patch description": "URL to patch"
"Patch description": "URL or local path to patch"
}
}
}
```
### How do I switch from packagist.drupal-composer.org to packages.drupal.org?

Follow the instructions in the [documentation on drupal.org](https://www.drupal.org/docs/develop/using-composer/using-packagesdrupalorg).

### How do I specify a PHP version ?

This project supports PHP 7.0 as minimum version (see [Drupal 8 PHP requirements](https://www.drupal.org/docs/8/system-requirements/drupal-8-php-requirements)), however it's possible that a `composer update` will upgrade some package that will then require PHP 7+.

To prevent this you can add this code to specify the PHP version you want to use in the `config` section of `composer.json`:
```json
"config": {
"sort-packages": true,
"platform": {
"php": "7.0.33"
}
},
```
43 changes: 24 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "drupal-composer/drupal-project",
"description": "Project template for Drupal 8 projects with composer",
"type": "project",
"license": "GPL-2.0+",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "",
Expand All @@ -16,39 +16,35 @@
}
],
"require": {
"php": ">=7.0.8",
"composer/installers": "^1.2",
"cweagans/composer-patches": "^1.6",
"drupal-composer/drupal-scaffold": "^2.2",
"drupal/console": "~1.0",
"drupal/core": "~8.0",
"drush/drush": "~8.0",
"webflo/drupal-finder": "^0.3.0",
"webmozart/path-util": "^2.3"
"cweagans/composer-patches": "^1.6.5",
"drupal/console": "^1.0.2",
"drupal/core": "^8.8.0",
"drupal/core-composer-scaffold": "^8.8.0",
"drush/drush": "^9.7.1 | ^10.0.0",
"vlucas/phpdotenv": "^4.0",
"webflo/drupal-finder": "^1.0.0",
"zaporylie/composer-drupal-optimizations": "^1.0"
},
"require-dev": {
"behat/mink": "~1.7",
"behat/mink-goutte-driver": "~1.2",
"jcalderonzumba/gastonjs": "~1.0.2",
"jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
"mikey179/vfsstream": "~1.2",
"phpunit/phpunit": ">=4.8.28 <5",
"symfony/css-selector": "~2.8"
"drupal/core-dev": "^8.8.0"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
"sort-packages": true
},
"autoload": {
"classmap": [
"scripts/composer/ScriptHandler.php"
]
],
"files": ["load.environment.php"]
},
"scripts": {
"drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
"pre-install-cmd": [
"DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
],
Expand All @@ -63,13 +59,22 @@
]
},
"extra": {
"composer-exit-on-patch-failure": true,
"patchLevel": {
"drupal/core": "-p2"
},
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
},
"installer-paths": {
"web/core": ["type:drupal-core"],
"web/libraries/{$name}": ["type:drupal-library"],
"web/modules/contrib/{$name}": ["type:drupal-module"],
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
"web/themes/contrib/{$name}": ["type:drupal-theme"],
"drush/contrib/{$name}": ["type:drupal-drush"]
"drush/Commands/contrib/{$name}": ["type:drupal-drush"]
}
}
}
38 changes: 38 additions & 0 deletions drush/Commands/PolicyCommands.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

namespace Drush\Commands;

use Consolidation\AnnotatedCommand\CommandData;

/**
* Edit this file to reflect your organization's needs.
*/
class PolicyCommands extends DrushCommands {

/**
* Prevent catastrophic braino. Note that this file has to be local to the
* machine that initiates the sql:sync command.
*
* @hook validate sql:sync
*
* @throws \Exception
*/
public function sqlSyncValidate(CommandData $commandData) {
if ($commandData->input()->getArgument('target') == '@prod') {
throw new \Exception(dt('Per !file, you may never overwrite the production database.', ['!file' => __FILE__]));
}
}

/**
* Limit rsync operations to production site.
*
* @hook validate core:rsync
*
* @throws \Exception
*/
public function rsyncValidate(CommandData $commandData) {
if (preg_match("/^@prod/", $commandData->input()->getArgument('target'))) {
throw new \Exception(dt('Per !file, you may never rsync to the production site.', ['!file' => __FILE__]));
}
}
}
6 changes: 6 additions & 0 deletions drush/drush.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# A Drush configuration file
#
# Docs at https://github.com/drush-ops/drush/blob/master/examples/example.drush.yml
#
# Edit or remove this file as needed.
Loading