Slides for April 2009 ASU Drupal Users Group

Attached below are the slides for the April, 2009 ASU Drupal Users Group presentation I gave on maintaining sites using a combination of CVS (to checkout Drupal core and contrib modules) and Subversion (for backing up your site's code base and integrating with locally maintained modules and themes).

Here's a quick rundown of links mentioned in the presentation:

Read on after the break for code samples.

A quick reference for the shell scripts we created (OS X):

Create or update ~/.bash_profile


export PATH=$PATH:/usr/local/bin

Bash script for checking out Drupal core

Create the shortcut command, drcvs_core in /usr/local/bin/:

#!/bin/bash
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -d $1 -r DRUPAL-$2 drupal

Make the file executable:

chmod ugo+x /usr/local/bin/drcvs_core

Bash script for checking out Drupal modules

Note: Be sure to make the bash script executable (see above).

Create the shortcut command, drcvs_module in /usr/local/bin/:

#!/bin/bash
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-$2 -d $1 contributions/modules/$1

Bash script for checking out Drupal themes

Note: Be sure to make the bash script executable (see above).

Create the shortcut command, drcvs_theme in /usr/local/bin/:

#!/bin/bash
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -r DRUPAL-$2 -d $1 contributions/themes/$1

Bash script for cleaning up for Subversion after a CVS update

Note: Be sure to make the bash script executable (see above).

Create the shortcut command, drcvs_cleanup in /usr/local/bin/:

#!/bin/bash
for FILE in `svn status $1 | grep '?'`; do svn add $FILE; done;

for FILE in `svn status $1 | grep '!'`; do svn rm $FILE; done;

Sample usage

Checkout Drupal core from CVS and commit to Subversion


cd /path/to/subversion/branches/folder

drcvs_core cvs-demo 6-9
svn add cvs-demo

svn commit -m "Adding drupal core for cvs demo site"

Checkout modules from CVS and add to Subversion


cd sites/all/modules

drcvs_module cck 6--2-2

drcvs_module views 6--2-4

drcvs_module cvs_deploy 6--1-0
svn add *

svn commit -m "Add CCK, Views and CVS Deploy modules"

Checkout a theme from CVS and add to Subversion


drcvs_theme zen 6--1-0
svn add zen

svn commit -m "Add Zen theme"

Updating Drupal core or modules from CVS


cd /path/to/drupal

cvs up -dP -r DRUPAL-6-10

drcvs_cleanup .

svn commit -m "Update to Drupal 6.10"

cd /path/to/views

cvs up -dP -r DRUPAL-6--2-5

drcvs_cleanup .

svn commit -m "Update to Views 6.x-2.5"

Telling Subversion to ignore files


cd /path/to/sites/default

svn propedit svn:ignore .

# Add ‘settings.php’ to the first line of the file and save it

svn commit . -m "Ignore settings.php"

Referencing an external Subversion project


cd /path/to/themes

svn propedit svn:externals .

Add the following to new line(s) in the file



asuzen https://opensource.asu.edu/svn/asuzen/branches/asuzen-6.x/

Retrieve the external project and commit the change



svn up

svn commit -m "Add external reference to ASU Zen theme"

Tags: 

AttachmentSize
ASU DUG - SVN and CVS.pdf1.33 MB