Drupal installation profiles are fine for setting up a new site, but don't work on existing sites. It would be nice to be able to enable new modules during the Capistrano deploy process, and to select a new theme.

It would also be nice to be able to control the versions of modules explicitly, and include modules and themes from local repositories without a lot of command line work.

We'll stick all this sort of configuration in the drupal_config directory under the site's Capistrano development directory:

drupal_config/
├── default_theme.txt
├── disabled_modules.txt
├── do_make.sh
├── enabled_modules.txt
├── local.make
└── update_enabled_modules_list.sh

Configuration Data Files

default_theme.txt - machine name of the theme you want to use when you deploy
disabled_modules.txt - blank delimited list of modules to disable after the site is deployed
enabled_modules.txt - blank delimited list of modules to enable after the site is deployed
local.make - drush make file for the site (see drush help generate-makefile)

Configuration Scripts

do_make.sh - runs the make file to build the site in place (without updating core)

#!/bin/bash
# do_make.sh - run the local.make to make the drupal site in place
BASEDIR=$(dirname $0)
cd $BASEDIR
cd ../public
drush make --no-core --contrib-destination=sites/all ../drupal_config/local.make

update_enabled_modules_list.sh - builds enabled_modules.txt based on current configuration of site

#!/bin/bash
# update_enabled_modules_list.sh - put a list of the currently enabled modules in config/enabled_modules.txt
BASEDIR=$(dirname $0)
cd $BASEDIR
cd ../public
echo `drush pm-list | grep Enabled | grep -o '(.\+)' | grep -o '[^()]\+' | tr '\n' ' ' && echo ""` > ../drupal_config/enabled_modules.txt
echo `drush vget theme_default | grep -o '".*"' | tr -d '"'` > ../drupal_config/default_theme.txt
  • No labels