SlideShare a Scribd company logo
Intro to Drush
  July 13, 2012
David Watson

    Rensselaer Polytechnic Institute
       −   Web Developer
           Experimental Media and
           Performing Arts Center (EMPAC)
       −   Adjunct Professor
           Web Systems Development

    Drupal Consultant
       −   ~3 years in the community
       −   Specialized Generalist
Development Problems

    Speed of performing tasks
        −   Site Installation
        −   Module Management
        −   Site Administration
        −   Feature Management
        −   Creating Test Content

    Ability to script tasks from the shell
        −   Shell scripts
        −   Integration with other systems/IDEs
Solution? Drush!

    Drupal Shell

    Command line utility intended for *nix-based
    environments
       −   Limited Windows support via cygwin

    Exposes common Drupal tasks via the
    command line

    Allows other modules to provide commands
       −   Devel
       −   Features
Drush Installation

    Drush is not like most other projects!

    Collection of local scripts, not a module you
    install on a site

    Up-to-date installation info can be found on
    the drush project page
        −   drupal.org/project/drush
Site Installation (normal)

    Open browser

    Visit drupal.org

    Download Drupal

    Decompress

    Run install.php from browser

    Choose install profile

    Configure site/database
Drupal Download (drush)

    cd /path/to/destination/dir

    drush dl
        −    Downloads the latest Drupal version when
             called with no arguments
        −    Can also be used to download projects
Quick Note...

    Most other commands that operate on a site
    must be run from within that site's root
    directory

    Running the command within a subdirectory is
    also acceptable, though supplied paths are
    generally relative to the Drupal root, not the
    working directory
Site Installation (drush)

    drush si [install_profile]
        −   Installs Drupal from scratch, flushing the
            database first
        −   Optionally accepts the machine name of an
            install profile
        −   Can supply database information via --db-url
            flag if necessary
Adding a Module (normal)

    Open the browser

    Visit module page on drupal.org

    Download the correct module version

    Decompress the module

    Move it into the appropriate directory
Adding a Module (drush)

    drush dl [module_name]
       −    Downloads a module with the given project
            shortname (the last part of the URL when
            you visit the project page)
       −    The latest and most stable will be retrieved
            by default, use --select to be prompted to
            choose
       −    Modules are downloaded to
            sites/default/files, use
            --destination=path/to/dest to specify (relative
            to Drupal root)
What About Themes?

    Themes and other projects are downloaded
    the exact same way

    Naturally, themes appear in
    sites/default/themes
Module Management (normal)

    Visit the module page

    Scroll through a (usually very) long list

    Select the module and confirm

    Confirm dependencies
Module Management (drush)

    drush en <module_name>
       −   Enables the module

    drush dis <module_name>
       −   Disables the module

    drush pm-uninstall <module_name>
       −   Uninstalls a disabled module completely
Module Management (drush)

    drush up [module_names]
       −   Checks for module updates
       −   Automatically runs update.php
       −   Will even update Drupal core minor releases
           if out of date!

    drush pmi <module_name>
       −   Retrieve more information than you could
           possibly need about a module
Administrative Tasks

    drush sql-dump --result-file=path/to/dest.sql
        −   Generate a SQL dump of the entire site

    drush uli <username>
        −   Provides a one-time login link for a user

    drush upwd <username>
        −   Set the password for a user

    drush u[u]blk <username>
        −   (un)blocks a given user
Features Integration

    drush fl
    −   Lists all features and their status

    drush fd <feature_name>
    −   Takes the diff between features exports in
        code and database
    −   Requires diff module
Features Integration

    drush fr <feature_name>
        −   Reverts a feature to code

    drush fra
        −   Reverts all features at once
Features Integration

    drush fu <feature_name>
       −   Updates a feature's code from the current
           database information, re-exporting it in place

    drush fe <feature_name>
    [component_name, ...]
       −   Exports a series of components to a new or
           existing feature
       −   Adding to an existing feature is “drush fa”
           before drush 5.x
Devel Integration

    drush fnv <function>
       −   Display source of a function

    drush hook <hook_name>
       −   List all hook implementations for examination
       −   The hook name should be without the
           “hook_” prefix
Devel Integration

    drush genc <nodes> <comments>
       −   Generate a set number of nodes and
           comments
       −   --types=types specifies which content types
           to use

    Similar command exist for users, taxonomy,
    etc.
All UI? Never Again!

    drush si -y empac_cms

    drush dl feeds

    drush en -y feeds

    # UI – oops; broke something!

    drush fra

    # UI – hack hack hack

    drush fe empac_cms_events feeds:events

    bzr commit -m “Added Feeds Importer”
This is just the start!

    drush help [command]
       −   Provides detailed help for a given command
       −   Command list and summary given with no
           arguments

    Other advanced features exist as well

    Other modules may provide additional drush
    integration
Questions?
Get in Touch!

    d.o – davidwatson

    e – dmw@davidwatson.name

    t - @caughtexception

    in – linkedin.com/in/davidmwatson

More Related Content

PDF
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
PDF
Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011
PDF
Dennis Povshedny.Mediamosa intro.DrupalCamp Kyiv 2011
PPT
Drush&drupal. administration
PPT
Drush. Why should it be used?
PPT
Drush and drupal. администрирование волчек михаил
KEY
Drupal in 30 Minutes
PPTX
TriDUG WebFM Presentation
Sergei Stryukov.Drush.Why it should be used.DrupalCamp Kyiv 2011
Pavlenko Sergey. Drush: using and creating custom commands. DrupalCamp Kyiv 2011
Dennis Povshedny.Mediamosa intro.DrupalCamp Kyiv 2011
Drush&drupal. administration
Drush. Why should it be used?
Drush and drupal. администрирование волчек михаил
Drupal in 30 Minutes
TriDUG WebFM Presentation

What's hot (20)

PDF
PPTX
Drush for drupal website builder
PDF
Improving your Drupal 8 development workflow DrupalCampLA
PDF
Introduction to Drupal - Installation, Anatomy, Terminologies
PDF
Speed up Drupal development with Drush
PDF
Integrating Files Into Drupal 7 Authoring Workflow
PDF
大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング
PPT
Local Drupal MultiSite Set-up
PPTX
PPTX
Hadoop installation on windows
DOCX
Hadoop installation
PDF
Help! I inherited a Drupal Site! - DrupalCamp Atlanta 2016
PDF
Improving Domino Designer ICON UK
PPTX
DOCX
Drupal module development training delhi
ODP
Drupal 7x Installation - Introduction to Drupal Concepts
KEY
Drupal on your laptop
PDF
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
PDF
Get Started With Drupal
Drush for drupal website builder
Improving your Drupal 8 development workflow DrupalCampLA
Introduction to Drupal - Installation, Anatomy, Terminologies
Speed up Drupal development with Drush
Integrating Files Into Drupal 7 Authoring Workflow
大規模サイトにおけるユーザーレベルのキャッシュ活用によるパフォーマンスチューニング
Local Drupal MultiSite Set-up
Hadoop installation on windows
Hadoop installation
Help! I inherited a Drupal Site! - DrupalCamp Atlanta 2016
Improving Domino Designer ICON UK
Drupal module development training delhi
Drupal 7x Installation - Introduction to Drupal Concepts
Drupal on your laptop
PuppetConf. 2016: Puppet Best Practices: Roles & Profiles – Gary Larizza, Puppet
Get Started With Drupal
Ad

Viewers also liked (6)

ODP
Features & Installation Profiles
PPT
CFU Business Plan
DOC
VNP Resume
PDF
SoCal Newsletter September 2012
PPT
Undine: Turnkey Drupal Development Environments
PDF
April 2012 SoCal Newsletter
Features & Installation Profiles
CFU Business Plan
VNP Resume
SoCal Newsletter September 2012
Undine: Turnkey Drupal Development Environments
April 2012 SoCal Newsletter
Ad

Similar to Intro to Drush (20)

PPT
Drush and drupal. администрирование. Волчек Михаил
ODP
Drush A beginners guide to a advanced tool.
PDF
Drush to simplify Drupalers work - Sivaji
PDF
DevOps: Cooking Drupal Deployment
PDF
drush_multi @ DrupalDevDays 2010
PDF
A Drush Primer - DrupalCamp Chattanooga 2013
ODP
Drush Presentation
PPTX
Intro to Drush
PDF
Drush 5.0 (DrupalCamp LA 2012) - Chris Charlton
PDF
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
PDF
Hong Kong Drupal User Group - Introduction of Drush
KEY
Automating Drupal Development: Makefiles, features and beyond
KEY
Intro to Drush
PDF
Drush und Multisite: drush_multi
PPTX
Drupal Overview For Techies
ZIP
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
PDF
Face your fears: Drush and Aegir
PPTX
ODP
Drush - More Beer, Less Effort
PDF
Devel for Drupal 8
Drush and drupal. администрирование. Волчек Михаил
Drush A beginners guide to a advanced tool.
Drush to simplify Drupalers work - Sivaji
DevOps: Cooking Drupal Deployment
drush_multi @ DrupalDevDays 2010
A Drush Primer - DrupalCamp Chattanooga 2013
Drush Presentation
Intro to Drush
Drush 5.0 (DrupalCamp LA 2012) - Chris Charlton
Drupal Day 2012 - Automating Drupal Development: Make!les, Features and Beyond
Hong Kong Drupal User Group - Introduction of Drush
Automating Drupal Development: Makefiles, features and beyond
Intro to Drush
Drush und Multisite: drush_multi
Drupal Overview For Techies
Building a Drupal Distribution using Features, Drush Make, Installation Profi...
Face your fears: Drush and Aegir
Drush - More Beer, Less Effort
Devel for Drupal 8

Recently uploaded (20)

PPTX
22 Bindushree Sahu.pptxmadam curie life and achievements
PPTX
Military history & Evolution of Armed Forces of the Philippines
PDF
the saint and devil who dominated the outcasts
PPTX
CPRC-SOCIAL-STUDIES-FINAL-COACHING-DAY-1.pptx
PPTX
Green and Orange Illustration Understanding Climate Change Presentation.pptx
PDF
Close Enough S3 E7 "Bridgette the Brain"
PPTX
Socio ch 1 characteristics characteristics
PPTX
SlideEgg_21518-Company Presentation.pptx
PPTX
E8 Q1 020ssssssssssssssssssssssssssssss2 PS.pptx
PPTX
65bc3704-6ed1-4724-977d-a70f145d40da.pptx
PDF
Love & Romance in Every Sparkle_ Discover the Magic of Diamond Painting.pdf
PPTX
CMU-PPT-LACHICA-DEFENSE FOR RESEARCH PRESENTATION
PPTX
A slideshow about aesthetic value in arts
PPTX
Visual-Arts.pptx power point elements of art the line, shape, form
PPTX
Technical-Codes-presentation-G-12Student
PDF
waiting, Queuing, best time an event cab be done at a time .pdf
PPSX
Multiple scenes in a single painting.ppsx
PPTX
CPAR-ELEMENTS AND PRINCIPLE OF ARTS.pptx
PPTX
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
VAD - Acute and chronic disorders of mesenteric.pptx
22 Bindushree Sahu.pptxmadam curie life and achievements
Military history & Evolution of Armed Forces of the Philippines
the saint and devil who dominated the outcasts
CPRC-SOCIAL-STUDIES-FINAL-COACHING-DAY-1.pptx
Green and Orange Illustration Understanding Climate Change Presentation.pptx
Close Enough S3 E7 "Bridgette the Brain"
Socio ch 1 characteristics characteristics
SlideEgg_21518-Company Presentation.pptx
E8 Q1 020ssssssssssssssssssssssssssssss2 PS.pptx
65bc3704-6ed1-4724-977d-a70f145d40da.pptx
Love & Romance in Every Sparkle_ Discover the Magic of Diamond Painting.pdf
CMU-PPT-LACHICA-DEFENSE FOR RESEARCH PRESENTATION
A slideshow about aesthetic value in arts
Visual-Arts.pptx power point elements of art the line, shape, form
Technical-Codes-presentation-G-12Student
waiting, Queuing, best time an event cab be done at a time .pdf
Multiple scenes in a single painting.ppsx
CPAR-ELEMENTS AND PRINCIPLE OF ARTS.pptx
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
VAD - Acute and chronic disorders of mesenteric.pptx

Intro to Drush

  • 1. Intro to Drush July 13, 2012
  • 2. David Watson  Rensselaer Polytechnic Institute − Web Developer Experimental Media and Performing Arts Center (EMPAC) − Adjunct Professor Web Systems Development  Drupal Consultant − ~3 years in the community − Specialized Generalist
  • 3. Development Problems  Speed of performing tasks − Site Installation − Module Management − Site Administration − Feature Management − Creating Test Content  Ability to script tasks from the shell − Shell scripts − Integration with other systems/IDEs
  • 4. Solution? Drush!  Drupal Shell  Command line utility intended for *nix-based environments − Limited Windows support via cygwin  Exposes common Drupal tasks via the command line  Allows other modules to provide commands − Devel − Features
  • 5. Drush Installation  Drush is not like most other projects!  Collection of local scripts, not a module you install on a site  Up-to-date installation info can be found on the drush project page − drupal.org/project/drush
  • 6. Site Installation (normal)  Open browser  Visit drupal.org  Download Drupal  Decompress  Run install.php from browser  Choose install profile  Configure site/database
  • 7. Drupal Download (drush)  cd /path/to/destination/dir  drush dl − Downloads the latest Drupal version when called with no arguments − Can also be used to download projects
  • 8. Quick Note...  Most other commands that operate on a site must be run from within that site's root directory  Running the command within a subdirectory is also acceptable, though supplied paths are generally relative to the Drupal root, not the working directory
  • 9. Site Installation (drush)  drush si [install_profile] − Installs Drupal from scratch, flushing the database first − Optionally accepts the machine name of an install profile − Can supply database information via --db-url flag if necessary
  • 10. Adding a Module (normal)  Open the browser  Visit module page on drupal.org  Download the correct module version  Decompress the module  Move it into the appropriate directory
  • 11. Adding a Module (drush)  drush dl [module_name] − Downloads a module with the given project shortname (the last part of the URL when you visit the project page) − The latest and most stable will be retrieved by default, use --select to be prompted to choose − Modules are downloaded to sites/default/files, use --destination=path/to/dest to specify (relative to Drupal root)
  • 12. What About Themes?  Themes and other projects are downloaded the exact same way  Naturally, themes appear in sites/default/themes
  • 13. Module Management (normal)  Visit the module page  Scroll through a (usually very) long list  Select the module and confirm  Confirm dependencies
  • 14. Module Management (drush)  drush en <module_name> − Enables the module  drush dis <module_name> − Disables the module  drush pm-uninstall <module_name> − Uninstalls a disabled module completely
  • 15. Module Management (drush)  drush up [module_names] − Checks for module updates − Automatically runs update.php − Will even update Drupal core minor releases if out of date!  drush pmi <module_name> − Retrieve more information than you could possibly need about a module
  • 16. Administrative Tasks  drush sql-dump --result-file=path/to/dest.sql − Generate a SQL dump of the entire site  drush uli <username> − Provides a one-time login link for a user  drush upwd <username> − Set the password for a user  drush u[u]blk <username> − (un)blocks a given user
  • 17. Features Integration  drush fl − Lists all features and their status  drush fd <feature_name> − Takes the diff between features exports in code and database − Requires diff module
  • 18. Features Integration  drush fr <feature_name> − Reverts a feature to code  drush fra − Reverts all features at once
  • 19. Features Integration  drush fu <feature_name> − Updates a feature's code from the current database information, re-exporting it in place  drush fe <feature_name> [component_name, ...] − Exports a series of components to a new or existing feature − Adding to an existing feature is “drush fa” before drush 5.x
  • 20. Devel Integration  drush fnv <function> − Display source of a function  drush hook <hook_name> − List all hook implementations for examination − The hook name should be without the “hook_” prefix
  • 21. Devel Integration  drush genc <nodes> <comments> − Generate a set number of nodes and comments − --types=types specifies which content types to use  Similar command exist for users, taxonomy, etc.
  • 22. All UI? Never Again!  drush si -y empac_cms  drush dl feeds  drush en -y feeds  # UI – oops; broke something!  drush fra  # UI – hack hack hack  drush fe empac_cms_events feeds:events  bzr commit -m “Added Feeds Importer”
  • 23. This is just the start!  drush help [command] − Provides detailed help for a given command − Command list and summary given with no arguments  Other advanced features exist as well  Other modules may provide additional drush integration
  • 25. Get in Touch!  d.o – davidwatson  e – dmw@davidwatson.name  t - @caughtexception  in – linkedin.com/in/davidmwatson