Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a102931

Browse files
committed
Standardize Drush usage
1. Add a new installer-path to composer.json so that drush projects installed via composer are automatically saved to the correct directory. 2. Add a new drush top level directory and 3. subdirectories for storing project specific config, aliases, and commands. 3. During post-install, create a wrapper script called 'dr' which launches drush and points to our new subdirs and skips loading from global locations.
1 parent 02f9ce3 commit a102931

File tree

6 files changed

+13
-1
lines changed

6 files changed

+13
-1
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"web/core": ["type:drupal-core"],
3939
"web/modules/contrib/{$name}": ["type:drupal-module"],
4040
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
41-
"web/themes/contrib/{$name}": ["type:drupal-theme"]
41+
"web/themes/contrib/{$name}": ["type:drupal-theme"],
42+
"drush/commands/{$name}": ["type:drupal-drush"]
4243
}
4344
}
4445
}

drush/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
The three subdirectories here hold project-specific commandfiles, site aliases, and configuration for Drush. These will all be included automatically when you use the ./dr wrapper script that should be in your project root directory. The dr script intentionally skips loading commands/aliases/config from the typical global locations in order to ensure that all team members have same Drush environment.
2+
3+
See http://packages.drush.org/ for a directory of Drush commands installable via Composer.

drush/commands/.gitkeep

Whitespace-only changes.

drush/config/.gitkeep

Whitespace-only changes.

drush/site-aliases/.gitkeep

Whitespace-only changes.

scripts/composer/post-install.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,11 @@ if [ ! -d web/sites/default/files ]
1919
then
2020
mkdir -m777 web/sites/default/files
2121
fi
22+
23+
# Add wrapper script for launching drush with project specific config/aliases/commands.
24+
if [ ! -d dr ]
25+
then
26+
echo "#!/usr/bin/env sh
27+
vendor/bin/drush --local --alias-path=drush/site-aliases --config=drush/config --include=drush/commands $@" > dr
28+
chmod +x dr
29+
fi

0 commit comments

Comments
 (0)