Created
February 21, 2017 14:52
-
-
Save frankcarey/2e5ff9633c56835b0da977df80198059 to your computer and use it in GitHub Desktop.
Drupal Wrapper for Ahoy+Docker+Drupal setup.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# DRUSH WRAPPER | |
# | |
# A wrapper script which launches the Drush that is in your project's /vendor | |
# directory. Copy it to the root of your project and edit as desired. | |
# You may rename this script to 'drush', if doing so does not cause a conflict | |
# (e.g. with a folder __ROOT__/drush). | |
# | |
# Below are options which you might want to add. More info at | |
# `drush topic core-global-options`: | |
# | |
# --local Only discover commandfiles/site aliases/config that are | |
# inside your project dir. | |
# --alias-path A list of directories where Drush will search for site | |
# alias files. | |
# --config A list of paths to config files | |
# --include A list of directories to search for commandfiles. | |
# | |
# Note that it is recommended to use --local when using a drush | |
# wrapper script. | |
# | |
# See the 'drush' script in the Drush installation root (../drush) for | |
# an explanation of the different 'drush' scripts. | |
# | |
# IMPORTANT: Modify the path below if your 'vendor' directory has been | |
# relocated to another location in your composer.json file. | |
# `../vendor/bin/drush.launcher --local $@` is a common variant for | |
# composer-managed Drupal sites. | |
# | |
WRAPPER_PATH="`dirname $0`" | |
# ../vendor/bin/drush.launcher --local "$@" | |
if [[ ${PHPIZE_DEPS:+1} ]]; then | |
#/root/.composer/vendor/drush/drush/drush.launcher --local -l 'http://google.com' -r docroot "$@" | |
# If we're inside the cli container, use the drush launcher from within it. | |
# Copy the $@ array since we can't seem to edit it directly. | |
# IMPORTANT! : ALWAYS USE "$@" to properly expand the parameters. | |
args=("$@") | |
# TO TEST: drush php-eval 'print_r(array(1));' --xdebug | |
#echo "ALL PARAMS: ${#args[@]}" | |
for i in ${!args[@]}; do | |
#echo "TEST PARAM ${args[$i]}" | |
if [ "${args[$i]}" == "--xdebug" ]; then # Call a "show_help" function to display a synopsis, then exit. | |
# Unset the --xdebug argument so it doesn't get passed to drush. | |
unset args[$i] | |
#echo args[@] | |
PHP_OPTIONS="$PHP_OPTIONS -d zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so" | |
fi | |
#echo $i | |
done | |
# RESET the $@ array and reindex. | |
set -- "${args[@]}" | |
#printf "$#" | |
#printf '%s\n' "$@" | |
PHP_OPTIONS="$PHP_OPTIONS" /root/.composer/vendor/drush/drush/drush.launcher --local --config=./.ahoy/drushrc.php "$@" | |
else | |
# We're local, so first trigger drush with ahoy. | |
ahoy drush -- "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment