Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 106 lines (86 sloc) 2.28 KB
#!/bin/bash
# Configurations...
# Modules to enable.
# Suggestions listed are a bit much :)
CONTRIB_MODULES="admin_menu devel module_builder dba drupalforfirebug simpletest" # Admin/Dev Tools
CONTRIB_MODULES+=" coder grammar_parser_lib grammar_parser secure_code_review libraries" # Code Review
CONTRIB_MODULES+=" features backup_migrate" # Environment Tools
# Evironment details.
INSTALL_BASE="$HOME/Sites"
DRUSH_LOCATION="/usr/local/bin/drush/drush.php"
PHP_LOCATION="/Applications/MAMP/bin/php/php5.3.6/bin/php"
MYSQL_URL="mysql://root:root@127.0.0.1:3306"
# ...end configurations.
# Be explicit about Drush.
DRUSH="$PHP_LOCATION $DRUSH_LOCATION"
# GetOpts How To
# http://rsalveti.wordpress.com/2007/04/03/bash-parsing-arguments-with-getopts/
# Collect options...
DRUPAL=
CONTRIB=
VERBOSE=
while getopts "d:m:v" OPTION
do
case $OPTION in
d)
DRUPAL=$OPTARG
;;
m)
CONTRIB=$OPTARG
;;
v)
VERBOSE=1
;;
esac
done
# Set specific Drupal version via args.
if [[ $DRUPAL ]]; then
if [ ${#DRUPAL} == 1 ]; then
DRUPAL="drupal-$DRUPAL.x"
else
DRUPAL="drupal-$DRUPAL"
fi
else
DRUPAL='drupal'
fi
# Add in extra modules via args.
if [[ $CONTRIB ]]
then
CONTRIB_MODULES+=" $CONTRIB"
fi
# Make Drush loud.
if [[ $VERBOSE ]]; then
DRUSH+="$DRUSH -v"
fi
# Grab the date for each unique spin up.
DATE=`date "+%Y_%m_%d_%H_%M"`
NAMESPACE="drupal_$DATE"
# Put Drupal in a unique folder.
cd $INSTALL_BASE
echo "
Getting Drupal...
"
$DRUSH dl $DRUPAL --drupal-project-rename="$NAMESPACE"
cd $INSTALL_BASE/$NAMESPACE
# Get the site running.
echo "
Setting Up Drupal...
"
NEW_DIRS="sites/default/files sites/all/modules/contrib sites/all/modules/custom sites/all/modules/admin"
DB_URL="$MYSQL_URL/$NAMESPACE"
mkdir -v $NEW_DIRS
cp -v sites/default/default.settings.php sites/default/settings.php
$DRUSH site-install standard -y --db-url=$DB_URL
# Update permissions.
chmod 777 "sites/default/files"
echo "
Setting Up Contrib Modules...
"
# Download/install contrib modules
$DRUSH -y dl $CONTRIB_MODULES
#$DRUSH -y en $CONTRIB_MODULES
echo "
* * * * * * * * * * * * * * * * * * * * * *
* Your site is ready with this namespace: * $NAMESPACE
* * * * * * * * * * * * * * * * * * * * * *
"
Something went wrong with that request. Please try again.