- Added 'drnew' function.

- Readme file updated.
This commit is contained in:
Lucas A. Rodrigues 2016-01-10 15:58:56 -02:00
parent ac0e234c4a
commit 4ac43ac3d5
2 changed files with 48 additions and 6 deletions

View File

@ -5,7 +5,7 @@ This plugin offers aliases and functions to make the work with drush easier and
To enable it, add the `drush` to your `plugins` array in `~/.zshrc`:
```zsh
```
plugins=(... drush)
```
@ -51,6 +51,13 @@ Uninstall one or more modules.
Must be invoked with one or more parameters. e.g.:
`drpu devel` or `drpu devel module_filter views`
### drnew
Creates a brand new drupal website.
Note: As soon as the installation is complete, drush will print a username and a random password into the terminal:
```
Installation complete. User name: admin User password: cf7t8yqNEm
```
## Additional features
### Autocomplete

View File

@ -21,18 +21,53 @@ function drf() {
}
function drfi() {
if [[ $1 == 'fields' ]]; then
if [[ $1 == "fields" ]]; then
drush field-info fields
elif [[ $1 == 'types' ]]; then
elif [[ $1 == "types" ]]; then
drush field-info types
else
drush field-info
fi
}
function drnew() {
cd ~
echo "Website's name: "
read WEBSITE_NAME
HOST=http://$(hostname -i)/
if [[ $WEBSITE_NAME == "" ]] then
MINUTES=$(date +%M:%S)
WEBSITE_NAME="Drupal-$MINUTES"
echo "Your website will be named: $WEBSITE_NAME"
fi
drush dl drupal --drupal-project-rename=$WEBSITE_NAME
echo "Moving to /var/www"
mv $WEBSITE_NAME /var/www
cd /var/www/$WEBSITE_NAME
echo "Database's user: "
read DATABASE_USR
echo "Database's password: "
read -s DATABASE_PWD
echo "Database's name: "
read DATABASE
drush site-install standard --db-url="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE" --site-name=$WEBSITE_NAME
open_command $HOST$WEBSITE_NAME
echo "Done"
}
# Aliases, sorted alphabetically.
alias drcb="drush cc block"
alias drca="drush cc all"
alias drcg="drush cc registry"
alias drcb="drush cc block" # Deprecated for Drush 8
alias drca="drush cc all" # Deprecated for Drush 8
alias drcg="drush cc registry" # Deprecated for Drush 8
alias drcj="drush cc css-js"
alias drcm="drush cc menu"
alias drcml="drush cc module-list"