Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!


Forgot your password?
Books Book Reviews

Book Review: Drush User's Guide 36

Michael Ross writes "With the advent of graphical user interfaces (GUIs) decades ago, most of the commercially-available software transitioned from command-line usage to point-and-click interfaces, with the majority of these applications completely phasing out all command-line capabilities, or never implementing them in the first place. But for programmers — most of whom are comfortable working on the command line — performing administrative actions within a GUI can become tedious and time-consuming, and there is a growing movement toward adding command-line support back to software development applications. An example of this is Drush, which is a command-line interface for the Drupal content management system. Drush, whose name is derived from "Drupal shell," was originally developed six years ago, and is seeing a resurgence within the Drupal community. However, what appears to be the primary information resource for Drush, the community documentation, currently has a status of "incomplete." Fortunately, there is now a book available that provides more extensive coverage, Drush User's Guide, authored by Requena Juan Pablo Novillo ("juampy"). The book was released by Packt Publishing on 10 April 2012, under the ISBN 978-1849517980. The publisher's page offers descriptions of the book, its table of contents, a brief author biography, the known errata, the example code used in the book, and a free sample chapter (the third one, "Customizing Drush"). This review is based upon a print copy kindly furnished by the publisher; an e-book version is also available." Read below for the rest of Michael's review.
Drush User's Guide
author Requena Juan Pablo Novillo
pages 125 pages
publisher Packt Publishing
rating 8/10
reviewer Michael J. Ross
ISBN 978-1849517980
summary A tutorial on Drupal's CLI.
The book comprises 125 pages, mostly grouped into four chapters, which cover how to install, use, customize, and extend Drush. The preface briefly summarizes those chapters, the software needed to use Drush, the target audience of the book, the styling conventions used in the text, and various publisher information. The author states that "Apache 2.0 or higher" is required to use Drush (page 2), but the project's README.txt does not mention this, and Drupal 7 itself runs fine on Apache 1.3; so this requirement is unclear. He also states that "Drush 4 does not support Windows" (page 13); Windows users are instructed to use Drush 5. This seems questionable, since a quick test revealed that Drush 4.5 runs on a Windows XP machine. Admittedly, it always elicits a warning: "Drush 4.x has significant limitations on Windows; it is not advisable to use on that platform. Substantial progress has been made towards supporing [sic] Windows on the 5.x branch; please upgrade."

The first chapter of the Drush User's Guide naturally begins with instructions on how to install Drush on Linux, Mac, and Windows systems. The book's examples use Drush 4.5, even though 5.1 was available at the time of the book's publication, and 5.0 was available a month earlier. Version 4.5 was the last 4.x release, and was probably the latest stable release when the book was being finalized. Throughout the book, all Windows instructions are specific to Windows 7, so any XP straggler will need to modify them as needed. In the "Manual installation" section, the subheads are almost identical in font size to the higher-level subheads, forcing the reader to check the table of contents hierarchy just to see where the manual installation instructions end. But the main problem is that the reader is not given recommendations as to which optional features should or should not be chosen. For instance, if you already have PHP installed on your system, should you decline to have the Drush installer try to add the "Php [sic] Required Runtime," even though it is enabled by default?

The author then shows how to set up a Drush-specific PHP configuration file, in order to bypass potential problems, such as memory limitations in the default configuration file. In the rest of the chapter, he demonstrates how to perform Drush commands (in general), define arguments and options for those commands, create command aliases, and specify which Drupal website any Drush command is supposed to operate upon.

In the second chapter, "Executing Drush Commands," the author shows the reader how to perform a fresh installation of Drupal 7 — including creation of the database and its tables — with just two commands. He introduces the music festival website that will be used throughout the rest of the book for demonstration purposes. At this point, some readers may hit a stumbling block: The "--drupal-project-rename" option used in the text fails on Windows machines (this is a known issue). Presumably the author did not test his suggested commands in a Windows environment. The bulk of the chapter is devoted to introducing numerous Drush commands, including those used to get and set variables, install modules, administer users, back up the database, and many more.

The author notes that "Drush is highly configurable," and in the third chapter he shows the reader how to create custom commands, include their help information in the output of the command "drush help," extend existing commands, run custom PHP scripts, and define site aliases. Readers new to Drupal may find these topics fairly advanced, as they necessitate familiarity with command namespaces, as well as Drupal's hook system, callbacks, and database API. Defining remote site aliases involves SSH and public keys. However, given the flexibility and power of custom Drush functionality, it is arguably worthwhile to make the effort to learn how to do it properly. At the end of the chapter, the reader learns how to use and configure the Drush command-line interface.

The fourth and final chapter, "Extending Drush," discusses how to utilize some of the modules that are integrated with Drush — specifically, Backup and Migrate, Devel, Features, Views, and Module Builder. The chapter concludes with a section on Drush Make, which packages the module information of a Drupal website so it can be re-created using Drush easily.

As with all of the Packt Publishing titles that I have reviewed, this one has a high number of errata relative to the total page count, aside from the seven already reported online (as of this writing): "command line interface" (page 1; "command line" should be hyphenated when used as an adjective), "book title through the subject" (same page; should be "book title in the subject"), "Clear cache" (page 7; should be "Clear all caches"), "follow [the] instructions" (page 13), "close [it] and open [it] again" (page 18), "try and" (page 21; should be "try to"), "change version by something" ("by" should be "to"), "parenthesis" (page 23, twice; should be "parentheses"), "within [the] sites subdirectory" (page 25), "execute commands towards" (page 26; "towards" should be "on"), "MySql's" (page 28; should be "MySQL database's"), "provided with it" (should be "provided it with"), "that resolves" (page 29; should be "resolves"), "First, of all" (page 33), "anoying" (page 48), "Imagine, that" (page 52), "lists [the] latest messages" (page 55), and "altering existing" (page 57; should be "alter existing"). At this point, not yet halfway through the book, I stopped recording errata. The Packt Publishing copyeditors should have spotted and fixed these obvious errors.

Although the author's meaning is invariably clear enough, the writing style is awkward in many places. For instance, "replace by" (page 4) should instead be "replace with," "take the chance to review" (page 41) should be "take the opportunity to review," and "of the flow" (page 55) should be "in the flow." The term "at" is used to indicate "in" a file — e.g., "at the Drush README.txt" (page 9); the same is true for MySQL tables — e.g., "stored at the variable table" (page 30). In addition, countless passages in the text would have benefited from a comma. Conversely, there are some extraneous commas (e.g., on page 43).

Yet the main flaw of the book is the neglect for readers who are using the Windows operating system for building and administering Drupal websites. The aforesaid "--drupal-project-rename" bug likely would have been caught had the Drush pm-download command been tested on a Windows computer. Another example is on page 48, where it is assumed that the command "firefox" will work as a link to the browser's executable on the reader's computer. Also, the ".drush" folder is critical for creating site aliases and other configuration settings; but where will the Windows user find this folder? This Linux partiality could result in Windows readers encountering — and possibly being frustrated by — confusing technical problems.

Nonetheless, the author does a fine job of explaining how to utilize the many Drush commands presented, as well as many of their arguments and options — oftentimes pointing out differences in their usage for Drupal 6 versus Drupal 7. Any Drupal developer interested in learning how to harness the power of a command-line interface for building and administering websites, should find Drush User's Guide a worthwhile tutorial.

Michael J. Ross is a freelance web developer and writer.

You can purchase Drush User's Guide from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
This discussion has been archived. No new comments can be posted.

Book Review: Drush User's Guide

Comments Filter:
  • Help complete the incomplete community documentation and sell your book?
  • A review of a book about Drush? How about a review of a book that more than .05% of the Slashdot community would find interesting or useful?
    • This is relevant to my interests. I don't work with Drupal, but it does occasionally happen that a man page is not explicit enough. This would probably be a resource-of-last-resort after the man pages, docs, and google, but more information isn't usually harmful.

      I do agree with you about the book reviews though -- I'll write one if you will.

      • by Tarlus ( 1000874 )

        This is relevant to my interests. I don't work with Drupal

        If you don't work with Drupal then how is this relevant to your interests?

    • What topics would you suggest?
  • by cultiv8 ( 1660093 ) on Thursday October 11, 2012 @04:27PM (#41623031) Homepage
    There are many ways to deploy drupal instances between staging environments, the simplest I've found is drush deploy [github.com], integrates with both svn and git, so I can run a command such as:

    drush-deploy TARGET=qa TAG=qa_test_012

    which would checkout to the qa environment and then run any additional commands (drush fr, drush cc all, drush rsync, etc) that I configure in my capfile. Very easy to use, built on top of Capistrano, automatic backups of environments, etc.

  • is piping drush into awk to create drush commands you can pipe to sh:

    drush pml --no-core --status=enabled --pipe|grep content_type_|awk '{print "drush fu " $1}'|sh

  • by Anonymous Coward

    MichaelJRoss as reviewer: Check.
    Book published by Packt: Check.
    Book is about Drupal: Check.
    8/10 or higher score despite pointing out major flaws in the book: Check.
    Receive check for Packt: Cha-ching!!!'

  • Future generations of digital archeologists are going to discover Slashdot, and they'll infer from reviews here that all of mankind's books were published by Packt Publishing. When you've absolutely, positively got to get your book reviewed on Slashdot, trust no one but Packt Publishing.
  • Druish... (Score:4, Funny)

    by harrkev ( 623093 ) <kfmsd@@@harrelsonfamily...org> on Thursday October 11, 2012 @04:53PM (#41623415) Homepage

    Funny. She doesn't look Druish.

  • Huh? (Score:3, Insightful)

    by Desler ( 1608317 ) on Thursday October 11, 2012 @04:53PM (#41623417)

    How can a book that has a ton of errata, poor writing and buggy examples possibly be given an 8 out of 10? What's the point of a 10 point scale when what sounds like a poorly written book gets 8 points? You might as well just make the scale just 8, 9 and 10 at that point.

    • Money, money, money
      Must be funny
      In the rich man's world
      Money, money, money
      Always sunny
      In the rich man's world

    • Money from Packt?
    • You might as well just make the scale just 8, 9 and 10 at that point.

      For the record, my book [slashdot.org] received the lowest book rating he's ever given on /., which was a 6. Glad I could help set the bar somewhere.

      • by Maow ( 620678 )

        You might as well just make the scale just 8, 9 and 10 at that point.

        For the record, my book [slashdot.org] received the lowest book rating he's ever given on /., which was a 6. Glad I could help set the bar somewhere.

        I just read that - was there anything unfair or inaccurate about the review?

        He was encouraging in the final paragraph, I'd hold on to that. Also, kudos for donations to Drupal Association!

      • by Desler ( 1608317 )

        Make sure your next book is published by Packt. Then you'll be guaranteed at least an 8/10 review from Michael Ross.

    • Logarithmic young man...logarithmic
  • Check (Score:4, Funny)

    by thePowerOfGrayskull ( 905905 ) <.marc.paradise. .at. .gmail.com.> on Thursday October 11, 2012 @05:28PM (#41623937) Homepage Journal

    Book from Packt Publishing? Check.
    Book irrelevant to most slashdotter's needs or interests? Check.
    Rating of 8/10? Check.
    Review content consists of synopsis with no real criticism? Check. (Seriously? It's "main flaw" was that it didn't address Windows users?)

    Hmm, could it be...

    Michael J Ross wrote this one?
    Why yes! Yes indeed!

"I prefer the blunted cudgels of the followers of the Serpent God." -- Sean Doran the Younger