Slashdot: News for Nerds


Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Book Review: Drush User's Guide

samzenpus posted about 2 years ago | from the read-all-about-it dept.

Books 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.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 Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

cancel ×


why not (1)

wbr1 (2538558) | about 2 years ago | (#41622933)

Help complete the incomplete community documentation and sell your book?

Re:why not (-1)

Anonymous Coward | about 2 years ago | (#41623409)

Author: Requena Juan Pablo Novillo

I know the Author's daughter, Pinche Lupita la Puta Negra. She's quite a looker.

Re:why not (1)

rubikscubejunkie (2664793) | about 2 years ago | (#41656983)

David Pogue created a whole industry around that with his set of 'Missing Manual' books.

Really? (2)

ogar572 (531320) | about 2 years ago | (#41622987)

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?

Re:Really? (-1)

Anonymous Coward | about 2 years ago | (#41623011)

Yeah... more like Douche amirite!?

Re:Really? (-1)

Anonymous Coward | about 2 years ago | (#41623325)

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?

How about a book that more than .05% of the Drupal community would find interesting or useful?

It's freaking drush. If you can't figure it out by looking at drush --help, someone needs to take away your shell access before you hurt yourself.

Re:Really? (0)

Anonymous Coward | about 2 years ago | (#41627355)

I don't get why this is modded down.. he's right. Anybody in need of a book on a particular command line tool would be better off investing into hiring a proper sysop. If, on the other hand, the reader's aim was to understand command lines, he ahould really buy a more general book. Drush does tend to fail - the worst case I encountered was one where it deleted all my modules. Knowledge of the rest of the command line world is imperative to resolving such problems.

Re:Really? (1)

Tenebrousedge (1226584) | about 2 years ago | (#41631531)

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.

Re:Really? (1)

Tarlus (1000874) | about 2 years ago | (#41631715)

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?

Re:Really? (0)

Anonymous Coward | about 2 years ago | (#41632321)

$deity forbid one might ever want to learn a new technology.

Re:Really? (1)

rubikscubejunkie (2664793) | about 2 years ago | (#41656995)

What topics would you suggest?

Drush Deploy (2)

cultiv8 (1660093) | about 2 years ago | (#41623031)

There are many ways to deploy drupal instances between staging environments, the simplest I've found is drush deploy [] , 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.

More drupal? (0)

Anonymous Coward | about 2 years ago | (#41623171)

Am I wrong, or are 9 out of 10 book reviews posted to Slashdot related to Drupal?

Re:More drupal? (2)

turkeyfeathers (843622) | about 2 years ago | (#41623261)

You're wrong... 9 out of 10 book reviews posted to Slashdot are related to Packt Publishing.

Re:More drupal? (1)

M0j0_j0j0 (1250800) | about 2 years ago | (#41623507)

Maybe, but what if you could buy them with bitcoins!! that would be nice!

Real drush fun... (1)

cleetus (123553) | about 2 years ago | (#41623225)

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

Bring back Packt! (2)

Anonymous Coward | about 2 years ago | (#41623239)

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!!!'

Packt... the only publisher in the world (2)

turkeyfeathers (843622) | about 2 years ago | (#41623293)

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.

Shells are handy when GUIs are bad (0)

Anonymous Coward | about 2 years ago | (#41623339)

A well written GUI can do just as much, just as easily, as a shell can. Shells tend to be easier to prep during development, so the appeal is natural, but to say that shells are inherently better for some reason is analogous to saying that sitting on your couch wins out over going for a walk; yes the former requires less effort but the latter will get you places in the long run.

Posting anon because slashdot hates GUIs.

Shells scripts are inherently better .. (1)

dgharmon (2564621) | about 2 years ago | (#41628313)

> A well written GUI can do just as much, just as easily, as a shell can ..

With shell scripts, you can automate the task, go for your walk, and when you get back, the task is done ...

Re:Shells scripts are inherently better .. (1)

Desler (1608317) | about 2 years ago | (#41630487)

And a well-written UI allows you to do batch processing and automation.

Re:Shells scripts are inherently better .. (0)

Anonymous Coward | about 2 years ago | (#41630559)

A GUI should be able to do the same thing. The reason you prefer a script is because a suitable use case wasnt built around your behavior, such that a gui could be built. Linux (and by extension Drupal) users are great at thinking up things noone has thought of before, which makes rapid prototyping at the command line very appealing, but that sort of behavior is also extremely restrictive because it doesn't allow for the process to be taken to the next level.

Re:Shells are handy when GUIs are bad (1)

toriver (11308) | about 2 years ago | (#41634083)

It is far easier to add new functionality to a CLI interface than to add it to a GUI, since you do not need to add the fluff around it (like distinct icon, interactions etc.)

Try SharePoint sometime: You quickly run into the situation where "sorry, you cannot do that in any of the web interfaces, you need to run a PowerShell command". Like "Add-SPSolution -LiteralPath D:\temp\SomeFarmSolution.wsp -Force"

Druish... (3, Funny)

harrkev (623093) | about 2 years ago | (#41623415)

Funny. She doesn't look Druish.

Re:Druish... (0)

Anonymous Coward | about 2 years ago | (#41625043)

I came in here looking for that comment and you delivered. Thank you.

Huh? (3, Insightful)

Desler (1608317) | about 2 years ago | (#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.

Re:Huh? (1)

M0j0_j0j0 (1250800) | about 2 years ago | (#41623531)

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

Re:Huh? (1)

turkeyfeathers (843622) | about 2 years ago | (#41623903)

Money from Packt?

Re:Huh? (2)

cultiv8 (1660093) | about 2 years ago | (#41626009)

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

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

Re:Huh? (1)

Maow (620678) | about 2 years ago | (#41626675)

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

For the record, my book [] 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!

Re:Huh? (1)

Desler (1608317) | about 2 years ago | (#41630465)

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

Re:Huh? (0)

Anonymous Coward | about 2 years ago | (#41630759)

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


If you give too many books low scores, they just won't send you any more books to review.

Re:Huh? (1)

rubikscubejunkie (2664793) | about 2 years ago | (#41657035)

Logarithmic young man...logarithmic

For WordPress... (-1)

Anonymous Coward | about 2 years ago | (#41623757)

For those who want to administrate multiple WordPress sites from the command-line, there's WordShell - []

Disclosure: I'm the author!

Re:For WordPress... (1)

Anonymous Coward | about 2 years ago | (#41623789)

Beware: this is spam for some payware product.

Check (3, Funny)

thePowerOfGrayskull (905905) | about 2 years ago | (#41623937)

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!

Check for New Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Create a Slashdot Account