Skip to content

Instantly share code, notes, and snippets.

@saki007ster
Created March 7, 2016 00:49
Show Gist options
  • Select an option

  • Save saki007ster/7bf775a4f5a27756faec to your computer and use it in GitHub Desktop.

Select an option

Save saki007ster/7bf775a4f5a27756faec to your computer and use it in GitHub Desktop.
drupal instance generator
# This function is for scaffolding of drupal project.
# Note : DB must be already created before entering it.
function dsi() {
httpDir=/Applications/MAMP/htdocs
echo -n "Enter the name of Root Directory : "
read rootDir
echo -n "Enter the Site Name : "
read siteName
echo -n "Enter the Site Slogan : "
read siteSlogan
echo -n "Enter the name of database [ must already exist ] : "
read dbName
dbHost="localhost"
dbUser="root"
dbPassword="admin"
AdminUsername="admin"
AdminPassword="admin"
adminEmail="admin@local.com"
drush dl -y --destination=$httpDir --drupal-project-rename=$rootDir;
cd $httpDir/$rootDir;
drush site-install -y standard --account-mail=$adminEmail --account-name=$AdminUsername --account-pass=$AdminPassword --site-name=$siteName --site-mail=$adminEmail --db-url=mysql://$dbUser:$dbPassword@$dbHost/$dbName;
echo -n "Do you want to configure commonly used modules and themes(zen) to your site [y/n] : "
read moduleConfirmation;
if [ $moduleConfirmation == 'y' ]; then
# Download modules and themes
##########################################################
drush -y dl ctools views token fences metatag module_filter redirect globalredirect entity panels mini_panels page_manager views_bulk_operations features strongarm boost field_group menu_block devel httprl xmlsitemap pathauto admin_menu google_analytics backup_migrate jquery_update webform zen;
# Disable some core modules
##########################################################
drush -y dis color toolbar shortcut;
# Enable modules
##########################################################
drush -y en views views_ui token fences metatag module_filter redirect features strongarm panels mini_panels page_manager globalredirect views_bulk_operations entity devel field_group devel_generate xmlsitemap pathauto admin_menu backup_migrate jquery_update webform googleanalytics admin_menu admin_menu_toolbar menu_block zen;
# Pre configure settings
##########################################################
# disable user pictures
drush vset -y user_pictures 0;
# allow only admins to register users
drush vset -y user_register 0;
# set site slogan
drush vset -y site_slogan $siteSlogan;
# Configure JQuery update
drush vset -y jquery_update_compression_type "min";
drush vset -y jquery_update_jquery_cdn "google";
drush -y eval "variable_set('jquery_update_jquery_version', strval(1.7));"
echo -e "////////////////////////////////////////////////////"
echo -e "// Install Completed"
echo -e "////////////////////////////////////////////////////"
else
echo -e "////////////////////////////////////////////////////"
echo -e "// Install Completed"
echo -e "////////////////////////////////////////////////////"
fi;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment