Anda di halaman 1dari 18

Drush:

The ubercool Drupal module

By :-
Aradhana (@arraysaq)
Shashank (@shashtra)
Srijan Technologies Pvt. Ltd.
“Drush is a command line shell and Unix scripting
interface for Drupal, a veritable Swiss Army knife
designed to make life easier for those of us who spend
some of our working hours hacking away at the
command prompt.”
--Drush Project Page

Srijan Technologies Pvt. Ltd.


Drush Installation
(On Ubuntu)

Srijan Technologies Pvt. Ltd.


The Install

The Easy Way The not-so-easy way


(but not that hard
too!)
sudo apt-get install
drush
➔ untar the package
from drupal.org
➔ put it in “home” folder
➔ and create symlink in
usr/bin

Srijan Technologies Pvt. Ltd.


But why do I need to use Drush ?
(yes!! its a valid question)

Srijan Technologies Pvt. Ltd.


Drush – Time Saver

Typical Way to Drupal :


Go to site page, look for required version and download.
Install and add necessary modules and themes etc.

Drush Way to Drupal :


drush dl drupal (it installs Drupal directly)
drush dl module1 module2 theme1 theme2 module3

For a specific drupal/module version, use:


drush dl drupal-6.x-1.0-beta3

Srijan Technologies Pvt. Ltd.


Useful Drush commands
• enable/disable/uninstall
• status
• help
• cron
• dl
• info
• cache
• watchdog show
• update – update, updatecode, updatedb
• search status
• search-reindex
• search-index

Srijan Technologies Pvt. Ltd.


Not only this, but more..

(coz Drush is extensible)

Integrates with most commonly used modules and lets you do


the configurations.

Example Backup and Migrate module:

bam backup – to backup the site's db


bam restore – to restore the site db
bam backups – to get the list of all backups stored.

Srijan Technologies Pvt. Ltd.


Some other modules that integrate with
Drush ;)
• Devel
• Node Export
• Apache Solr
• Provision
• XML Sitemap
• Views Bulk Operations
• Recommender API

And many more


• http://drupal.org/projects_with_drush

Srijan Technologies Pvt. Ltd.


• It does not just let us work with modules but
build the whole projects too. And that too very
rapidly.

• One of the most loved features of Drush is


Drush Make.

Srijan Technologies Pvt. Ltd.


Drush Make

“Drush make is an extension to drush that can create a


ready-to-use drupal site, pulling sources from various
locations. ”
--Drush Project Page

Srijan Technologies Pvt. Ltd.


.Make file

.make file – Adheres to .info standards and is a flat text


file.

drush make example.make example

Srijan Technologies Pvt. Ltd.


How does the example.make file looks like
core = 6.x
projects[] = drupal
projects[] = views
projects[cck] = 2.6
projects[ctools][version] = 1.3
projects[data][type] = module
projects[data][download][type] = cvs
projects[data][download][module] = contributions/modules/data
projects[data][download][revision] = DRUPAL-6--1
projects[tao][type] = theme
projects[tao][download][type] = git
projects[tao][download][url] = git://github.com/developmentseed/tao.git
projects[admin_menu][subdir] = custom

Srijan Technologies Pvt. Ltd.


.Make file demo

Ad-libbing of people when you are being shown


live example.

Srijan Technologies Pvt. Ltd.


Installation Profile

• Installation Profiles traditionally have been a piece of PHP


code that tells Drupal what to do when the site is installed.
• When one used to download that install profile, they would
just get that file.
• Drupal.org, using Drush Make as a backend, now allows
modules and themes to come with profiles, all in the same
file.

Srijan Technologies Pvt. Ltd.


.Make file for search installation profile

core = "6.x"
api = 2
projects[] = "drupal"
projects[] = "acquia_connector"
projects[apachesolr][download][type] = "cvs"
projects[apachesolr][download][module] = "contributions/modules/apachesolr"
projects[apachesolr][download][revision] = "DRUPAL-6--2"
projects[acquia_search][type] = "module"
projects[acquia_search][download][type] = "svn"
projects[acquia_search][download][url] = "https://svn.acquia.com/drupal/branches/1.x-
6.x/modules/acquia/acquia_search/"
libraries[SolrPhpClient][download][type] = "get"
libraries[SolrPhpClient][download][url] = "http://solr-php-
client.googlecode.com/files/SolrPhpClient.r22.2009-11-09.tgz"
libraries[SolrPhpClient][destination] = "modules/apachesolr"

Srijan Technologies Pvt. Ltd.


Is Drush the future of how Drupal can be
used?

• Most certainly

• But we would need to standardize some practices.

• Sync and re-sync is another area that we might want to


explore.

Questions to ourselves.

• Can we incorporate such a practice?

• What about the Windows people? (NO you cant outcast


them!!)
Srijan Technologies Pvt. Ltd.
Thank You

Srijan Technologies Pvt. Ltd.