drush.plugin.zsh 2.3 KB
Newer Older
Lucas A. Rodrigues's avatar
Lucas A. Rodrigues committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Drush support.

function dren() {
  drush en $@ -y
}

function dris() {
  drush pm-disable $@ -y
}

function drpu() {
  drush pm-uninstall $@ -y
}

function drf() {
  if [[ $1 == "" ]] then
    drush core-config
  else
    drush core-config --choice=$1
  fi
}

function drfi() {
  if [[ $1 == "fields" ]]; then
    drush field-info fields
  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 "Type your localhost directory: (Leave empty for /var/www/html/)"
  read DIRECTORY

  if [[ $DIRECTORY == "" ]] then
    DIRECTORY="/var/www/html/"
  fi

  echo "Moving to $DIRECTORY$WEBSITE_NAME"
  sudo mv $WEBSITE_NAME $DIRECTORY
  cd $DIRECTORY$WEBSITE_NAME

  echo "Database's user: "
  read DATABASE_USR
  echo "Database's password: "
  read -s DATABASE_PWD
  echo "Database's name for your project: "
  read DATABASE

  DB_URL="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE"
  drush site-install standard --db-url=$DB_URL --site-name=$WEBSITE_NAME

  open_command $HOST$WEBSITE_NAME
  echo "Done"

}

# Aliases, sorted alphabetically.
alias dr="drush"
alias drca="drush cc all" # Deprecated for Drush 8
alias drcb="drush cc block" # 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"
alias drcr="drush core-cron"
alias drct="drush cc theme-registry"
alias drcv="drush cc views"
alias drdmp="drush sql-dump --ordered-dump --result-file=dump.sql"
alias drf="drush features"
alias drfr="drush features-revert -y"
alias drfu="drush features-update -y"
alias drfra="drush features-revert-all"
alias drif="drush image-flush --all"
alias drpm="drush pm-list --type=module"
alias drst="drush core-status"
alias drup="drush updatedb"
alias drups="drush updatedb-status"
alias drv="drush version"
alias drvd="drush variable-del"
alias drvg="drush variable-get"
alias drvs="drush variable-set"

# Enable drush autocomplete support
source $(dirname $0)/drush.complete.sh