Following some issues to integrate drush and making civicrm upgrade process accessible from script, I started looking at drush on how we can take advantage of it for civicrm, and was surprised with the ease I was able to reuse drush code to add few utilities for civicrm. Some of the utilities currently implemented are:
All civicrm-sql-* utilities reuse the drush code, making most of drupal sql-* utilities also available for civicrm. Update-cfg and upgrade-* methods use civicrm BAOs to do their job. A detailed help can be seen just as any other "drush help $command" -
For a quick view of how upgrade works with the script -
As you would have noticed currently it requires --tarfile option, an improved version could be, automatically downloading the latest tarfile when no option is provided. Another related improvment i can think of is adding civicrm-restore utility which would restore the codebase and database to the specified restore point. So a command to restore would look like:
drush civicrm-restore --restore-point=/var/www/drupal-6.16/../backup/modules/20100308134039 Another set of commands like civicrm-cache-clear and civicrm-api will soon make there way in. Check http://wiki.civicrm.org/confluence/display/CRMDOC/Drush+CiviCRM+proof+of+concept for more details (thanks to Kasper Souren). Since the initialization process is already in, it would now be easier to experiment and add new utilities to the list (and submit patches). If you have already done any work on civicrm-drush, and would like to share / contribute, let me know. civicrm.drush.inc file for now is part of the Drupal repository. To avoid any problems with the script during civicrm-upgrade keep the latest copy of civicrm.drush.inc out of codebase since process involves removing (after backup) and adding codebase. I always keep it in my .drush folder. Check example.drush.inc for other options.
For those who are not familiar with drush or don't know where to start - 1. Install and read about drush from http://drupal.org/project/drush. 2. Screencasts on above link should make you even more comfortable. 3. Download / checkout civicrm.drush.inc file from svn - https://github.com/civicrm/civicrm-drupal/blob/7.x-master/drush/civicrm.... 4. Place civicrm.drush.inc file inside your ~/.drush directory. And you are ready to play.