Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1 from palantirnet/drush-alias
Browse files Browse the repository at this point in the history
Alias drush
  • Loading branch information
becw committed Mar 23, 2016
2 parents 5dd5789 + 6212f10 commit 2ad9c0a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions conf/vagrant/provisioning/drupal8-skeleton.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
- { role: common }
- { role: php }
- { role: drupal }
- { role: drush }
26 changes: 26 additions & 0 deletions conf/vagrant/provisioning/roles/drush/bin/drush
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#
# This script wraps drush. It allows you to transparently use a project-local
# drush and drushrc.php, if they are available, but falls back to the system
# drush.
#
# To use it, add a line like this to your ~/.profile:
# alias drush=/var/www/PROJECT_NAME.local/bin/drush
#
# Then, try `drush status` from your home directory, and again from the project
# root.

THE_DRUSH="/usr/bin/drush"
DRUSH_FLAGS=""

REPO=$(git rev-parse --show-toplevel 2> /dev/null)

if [ $REPO ] && [ -e $REPO/vendor/bin/drush ]; then
THE_DRUSH="$REPO/vendor/bin/drush"
fi

if [ $REPO ] && [ -e $REPO/conf/drushrc.php ]; then
DRUSH_FLAGS="-c $REPO/conf/drushrc.php"
fi

$THE_DRUSH $DRUSH_FLAGS $@
8 changes: 8 additions & 0 deletions conf/vagrant/provisioning/roles/drush/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Drush wrapper | Copy drush wrapper
copy: src=../bin dest=/home/vagrant mode=u+rwx
tags: drush

- name: Drush wrapper | Configure drush wrapper
lineinfile: dest=/home/vagrant/.profile state=present line='export PATH="$PATH:$HOME/bin"'
tags: drush

0 comments on commit 2ad9c0a

Please sign in to comment.