01230fa6e29c54294800c06ac8a4249d5bddf2dd
- Author
- Marc Cornellà <hello@mcornella.com>
- Committer
- Marc Cornellà <hello@mcornella.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/drush/README.md b/plugins/drush/README.md
2index df7b82bddb11e1c2a6cceedd9b83b3e3ff8914ab..dfd1eaf82ce7cd16e0841d2324c9b8aeb860a7f8 100644
3--- a/plugins/drush/README.md
4+++ b/plugins/drush/README.md
5@@ -1,83 +1,60 @@
6 # Drush
7
8-## Description
9-This plugin offers aliases and functions to make the work with drush easier and more productive.
10+This plugin adds aliases and functions for [Drush](https://www.drush.org), a command-line shell
11+and Unix scripting interface for Drupal. It also adds completion for the `drush` command.
12
13-To enable it, add the `drush` to your `plugins` array in `~/.zshrc`:
14+To enable it, add `drush` to the plugins array in zshrc file:
15
16-```
17+```zsh
18 plugins=(... drush)
19 ```
20
21 ## Aliases
22-| Alias | Description | Command |
23-|-------|-----------------------------------------------------------------------|-----------------------------|
24-| dr | Display drush help | drush |
25-| drca | Clear all drupal caches. | drush cc all |
26-| drcb | Clear block cache. | drush cc block |
27-| drcg | Clear registry cache. | drush cc registry |
28-| drcj | Clear css-js cache. | drush cc css-js |
29-| drcm | Clear menu cache. | drush cc menu |
30-| drcml | Clear module-list cache. | drush cc module-list |
31-| drcr | Run all cron hooks in all active modules for specified site. | drush core-cron |
32-| drct | Clear theme-registry cache. | drush cc theme-registry |
33-| drcv | Clear views cache. (Make sure that the views module is enabled) | drush cc views |
34-| drdmp | Backup database in a new dump.sql file | drush drush sql-dump --ordered-dump --result-file=dump.sql|
35-| drf | Display features status | drush features |
36-| drfr | Revert a feature module on your site. | drush features-revert -y |
37-| drfu | Update a feature module on your site. | drush features-update -y |
38-| drfra | Revert all enabled feature module on your site. | drush features-revert-all |
39-| drif | Flush all derived images. | drush image-flush --all |
40-| drpm | Show a list of available modules. | drush pm-list --type=module |
41-| drst | Provides a birds-eye view of the current Drupal installation, if any. | drush core-status |
42-| drup | Apply any database updates required (as with running update.php). | drush updatedb |
43-| drups | List any pending database updates. | drush updatedb-status |
44-| drv | Show drush version. | drush version |
45-| drvd | Delete a variable. | drush variable-del |
46-| drvg | Get a list of some or all site variables and values. | drush variable-get |
47-| drvs | Set a variable. | drush variable-set |
48-
49-## Functions
50
51-### dren
52-Download and enable one or more extensions (modules or themes).
53-Must be invoked with one or more parameters. e.g.:
54-`dren devel` or `dren devel module_filter views`
55+| Alias | Command | Description |
56+| ------- | ------------------------------------------------------------ | --------------------------------------------------------------------- |
57+| `dr` | `drush` | Display drush help |
58+| `drca` | `drush cc all` | _(Deprecated in Drush 8)_ Clear all drupal caches. |
59+| `drcb` | `drush cc block` | _(Deprecated in Drush 8)_ Clear block cache. |
60+| `drcg` | `drush cc registry` | _(Deprecated in Drush 8)_ Clear registry cache. |
61+| `drcj` | `drush cc css-js` | Clear css-js cache. |
62+| `drcm` | `drush cc menu` | Clear menu cache. |
63+| `drcml` | `drush cc module-list` | Clear module-list cache. |
64+| `drcr` | `drush core-cron` | Run all cron hooks in all active modules for specified site. |
65+| `drct` | `drush cc theme-registry` | Clear theme-registry cache. |
66+| `drcv` | `drush cc views` | Clear views cache. (Make sure that the views module is enabled) |
67+| `drdmp` | `drush drush sql-dump --ordered-dump --result-file=dump.sql` | Backup database in a new dump.sql file |
68+| `drf` | `drush features` | Display features status |
69+| `drfr` | `drush features-revert -y` | Revert a feature module on your site. |
70+| `drfra` | `drush features-revert-all` | Revert all enabled feature module on your site. |
71+| `drfu` | `drush features-update -y` | Update a feature module on your site. |
72+| `drif` | `drush image-flush --all` | Flush all derived images. |
73+| `drpm` | `drush pm-list --type=module` | Show a list of available modules. |
74+| `drst` | `drush core-status` | Provides a birds-eye view of the current Drupal installation, if any. |
75+| `drup` | `drush updatedb` | Apply any database updates required (as with running update.php). |
76+| `drups` | `drush updatedb-status` | List any pending database updates. |
77+| `drv` | `drush version` | Show drush version. |
78+| `drvd` | `drush variable-del` | Delete a variable. |
79+| `drvg` | `drush variable-get` | Get a list of some or all site variables and values. |
80+| `drvs` | `drush variable-set` | Set a variable. |
81
82-### drf
83-Edit drushrc, site alias, and Drupal settings.php files.
84-Can be invoked with one or without parameters. e.g.:
85-`drf 1`
86+## Functions
87
88-### dris
89-Disable one or more extensions (modules or themes)
90-Must be invoked with one or more parameters. e.g.:
91-`dris devel` or `dris devel module_filter views`
92+- `dren`: download and enable one or more extensions (modules or themes). Must be
93+ invoked with one or more parameters, e.g.: `dren devel` or `dren devel module_filter views`.
94
95-### drpu
96-Uninstall one or more modules.
97-Must be invoked with one or more parameters. e.g.:
98-`drpu devel` or `drpu devel module_filter views`
99+- `drf`: edit drushrc, site alias, and Drupal settings.php files.
100+ Can be invoked with one or without parameters, e.g.: `drf 1`.
101
102-### drnew
103-Creates a brand new drupal website.
104-Note: As soon as the installation is complete, drush will print a username and a random password into the terminal:
105diff --git a/plugins/drush/drush.plugin.zsh b/plugins/drush/drush.plugin.zsh
106index 8a20d79f268e59423771c9553ef88365ff073b81..fbf9656e6c003c01e3418e1eb447a1dd8b4c1c6c 100644
107--- a/plugins/drush/drush.plugin.zsh
108+++ b/plugins/drush/drush.plugin.zsh
109@@ -1,19 +1,18 @@
110-# Drush support.
111-
112+# Functions
113 function dren() {
114- drush en $@ -y
115+ drush en "$@" -y
116 }
117
118 function dris() {
119- drush pm-disable $@ -y
120+ drush pm-disable "$@" -y
121 }
122
123 function drpu() {
124- drush pm-uninstall $@ -y
125+ drush pm-uninstall "$@" -y
126 }
127
128 function drf() {
129- if [[ $1 == "" ]] then
130+ if [[ -z "$1" ]] then
131 drush core-config
132 else
133 drush core-config --choice=$1
134@@ -21,58 +20,56 @@ function drf() {
135 }
136
137 function drfi() {
138- if [[ $1 == "fields" ]]; then
139- drush field-info fields
140- elif [[ $1 == "types" ]]; then
141- drush field-info types
142- else
143- drush field-info
144- fi
145+ case "$1" in
146+ fields) drush field-info fields ;;
147+ types) drush field-info types ;;
148+ *) drush field-info ;;
149+ esac
150 }
151
152 function drnew() {
153+ (
154+ cd
155+ echo "Website's name: "
156+ read WEBSITE_NAME
157
158- cd ~
159- echo "Website's name: "
160- read WEBSITE_NAME
161+ HOST=http://$(hostname -i)/
162
163- HOST=http://$(hostname -i)/
164+ if [[ $WEBSITE_NAME == "" ]] then
165+ MINUTES=$(date +%M:%S)
166+ WEBSITE_NAME="Drupal-$MINUTES"
167+ echo "Your website will be named: $WEBSITE_NAME"
168+ fi
169
170- if [[ $WEBSITE_NAME == "" ]] then
171- MINUTES=$(date +%M:%S)
172- WEBSITE_NAME="Drupal-$MINUTES"
173- echo "Your website will be named: $WEBSITE_NAME"
174- fi
175+ drush dl drupal --drupal-project-rename=$WEBSITE_NAME
176
177- drush dl drupal --drupal-project-rename=$WEBSITE_NAME
178+ echo "Type your localhost directory: (Leave empty for /var/www/html/)"
179+ read DIRECTORY
180
181- echo "Type your localhost directory: (Leave empty for /var/www/html/)"
182- read DIRECTORY
183+ if [[ $DIRECTORY == "" ]] then
184+ DIRECTORY="/var/www/html/"
185+ fi
186
187- if [[ $DIRECTORY == "" ]] then
188- DIRECTORY="/var/www/html/"
189- fi
190+ echo "Moving to $DIRECTORY$WEBSITE_NAME"
191+ sudo mv $WEBSITE_NAME $DIRECTORY
192+ cd $DIRECTORY$WEBSITE_NAME
193
194- echo "Moving to $DIRECTORY$WEBSITE_NAME"
195- sudo mv $WEBSITE_NAME $DIRECTORY
196- cd $DIRECTORY$WEBSITE_NAME
197+ echo "Database's user: "
198+ read DATABASE_USR
199+ echo "Database's password: "
200+ read -s DATABASE_PWD
201+ echo "Database's name for your project: "
202+ read DATABASE
203
204- echo "Database's user: "
205- read DATABASE_USR
206- echo "Database's password: "
207- read -s DATABASE_PWD
208- echo "Database's name for your project: "