OPC IT. Managed services and web development in Canberra.

Making the most of Drush

I love Drush
Date: 
23 October 2014
Authored by: 
Emma Lebel

Drush (Drupal shell) is a fantastic command line tool to manage your Drupal websites. But there’s way more to it than just drush up. Here are some resources from around the web to help you leverage its power!

Drush Commands

Drush Commands by Peter Brady is the ‘missing manual’ for Drush. It’s an easy-to-use quick reference tool to find the command you need and clear examples of how to use it.

As well as all the core Drush commands, it covers contrib Drush extensions and modules with Drush support like Registry Rebuild and Migrate.

Extensions

Wait – extensions? That’s right, Drush is just as extensible as Drupal is. Find a whole list of them over on the Drush d.o page. Here are some top picks.

Drush Recipes

You think Drush saves you a lot of time? Check out Drush Recipes. Drush Recipes is going to supercharge your Drush workflow. A Drush recipe is a series of Drush calls that can automate any Drupal development task you like.

Drush Recipes is hot out of the oven (that is, new, and still in beta), but I know it’s going to become one of my daily development tools.

Drush Fetcher

Drush Fetcher is a provisioning tool for Drupal. From the project page:

This includes setting up the Drupal root, fetching the code (generally from a VCS), creating a database for the site and a user with the necessary privileges to manage it, updating permissions, creating symlinks, setting up server configuration files like Apache’s virtual hosts, and generating drush alias files for your convenience. In addition, fetcher supports post installation tasks that can be run after a site is setup.

How good is that? Check out supporting extensions Fetcher Services and Fetcher Backups too.

Registry Rebuild

The first Drush extension you’re likely to meet is in the wild is Registry Rebuild. Registry Rebuild cleans up Drupal’s code registry when it gets stuck with stale classes – for example, after you’ve deleted an active module or moved it into another folder.

Drush make

Just getting into Drush and haven’t built your first makefile yet? You should – makefiles and profiles will save you time and money. You can use them to get Drupal sites up and running the way you want them, with all the bells and whistles already installed – really quickly.

There’s a great guide called Drush Make theory for happy profile development in the Drupal.org Community Documentation. It’s a good starting point for something very powerful.

If you have a Drupal installation already and you’d like to turn it into a reusable makefile, check out drush make-generate (and read about it on Drush Commands). See make-generate on the aforementioned Drush Commands for details.

If you’re not up to that yet, check out the Drush Make Generator. It’s a tool that lets you choose Drupal distributions, modules, and libraries from a list, then spits out a makefile for you. Magic!

Cheat sheet

Lab Fiftyfive made a neat Drush cheat sheet for you to print out and pin to your wall.

The end

I hope this has given you a few ideas about how powerful Drush can be for both development and maintenance.