Intro to Drush
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Intro to Drush

on

  • 2,119 views

When I was introduced to drush, a command line shell and scripting interface for Drupal, I thought, “meh, I can do those tasks already in about the same time with no learning curve.” Now? “Omg ...

When I was introduced to drush, a command line shell and scripting interface for Drupal, I thought, “meh, I can do those tasks already in about the same time with no learning curve.” Now? “Omg omg, do you use drush? You gotta try drush! It’s awesome!”

Find out why drush has transformed me into a groupie. In this session, we’ll walk through installing a Drupal site using drush, enabling modules, and common tasks like running update hooks, cron, and clearing the cache.

Intimidated by the command line? We’ll cover the basics and show you how development tools like Coda enable you to use drush inside a visual environment.

Statistics

Views

Total Views
2,119
Views on SlideShare
2,119
Embed Views
0

Actions

Likes
3
Downloads
22
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

CC Attribution-ShareAlike LicenseCC Attribution-ShareAlike License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Intro to Drush Presentation Transcript

  • 1. Intro to drushDiana Montalion Dupuis : mooncougar diana: moon goddess + montalion: mountain lion diana@fourkitchens.comAaron Forsander : pifantastic forsander@fourkitchens.comCheat Sheet: http://www.fourkitchens.com Follow along with demonstrations.Four Kitchens : @fourkitchens
  • 2. DrushDrupalCamp Austin 2010
  • 3. Drush”Drush is a command line shell and Unix scriptinginterface for Drupal, a veritable Swiss Army knifedesigned to make life easier for those of us whospend some of our working hours hacking away atthe command prompt.”DrupalCamp Austin 2010
  • 4. Drush”Drush is a command line shell and Unix scriptinginterface for Drupal, a veritable Swiss Army knifedesigned to make life easier for those of us whospend some of our working hours hacking away atthe command prompt.”Know what that means? Me neither.DrupalCamp Austin 2010
  • 5. Drush is
  • 6. Drush isShortcuts.
  • 7. You should be here if
  • 8. You should be here if• You don’t know what drush does.
  • 9. You should be here if• You don’t know what drush does.• You know what drush does but havent used it,much.
  • 10. You should be here if• You don’t know what drush does.• You know what drush does but havent used it,much.• You dont break out in hives when someone says"command line".
  • 11. You should be here if• You don’t know what drush does.• You know what drush does but havent used it,much.• You dont break out in hives when someone says"command line".• You do break out in hives but must use it anyway.
  • 12. You should be here if• You don’t know what drush does.• You know what drush does but havent used it,much.• You dont break out in hives when someone says"command line".• You do break out in hives but must use it anyway.• Youve installed a Drupal site and added modules,like CCK or Views.
  • 13. You should be here if• You don’t know what drush does.• You know what drush does but havent used it,much.• You dont break out in hives when someone says"command line".• You do break out in hives but must use it anyway.• Youve installed a Drupal site and added modules,like CCK or Views.• You are a New England Patriots fan.
  • 14. You should not be here if
  • 15. You should not be here if• You know what “drush fu” means and when to typeit.
  • 16. You should not be here if• You know what “drush fu” means and when to typeit.• You use drush for many common tasks already.
  • 17. You should not be here if• You know what “drush fu” means and when to typeit.• You use drush for many common tasks already.• You heckle.
  • 18. You should not be here if• You know what “drush fu” means and when to typeit.• You use drush for many common tasks already.• You heckle.• You are a Colts fan.
  • 19. Why I rejected drush
  • 20. Why I rejected drush• I went to a presentation and thought, “I can do allof this already, without the learning curve.”
  • 21. Why I rejected drush• I went to a presentation and thought, “I can do allof this already, without the learning curve.”• I was intimidated by the setup process.
  • 22. Why I rejected drush• I went to a presentation and thought, “I can do allof this already, without the learning curve.”• I was intimidated by the setup process.• I wasn’t using the command line as much backthen. Unfortunately.
  • 23. Why I rejected drush• I went to a presentation and thought, “I can do allof this already, without the learning curve.”• I was intimidated by the setup process.• I wasn’t using the command line as much backthen. Unfortunately.• A few things were kinda cool but kinda cool is nota reason to adopt new technology.
  • 24. Why I rejected drush• I went to a presentation and thought, “I can do allof this already, without the learning curve.”• I was intimidated by the setup process.• I wasn’t using the command line as much backthen. Unfortunately.• A few things were kinda cool but kinda cool is nota reason to adopt new technology.• Really.
  • 25. Why I <3 drush now
  • 26. Why I <3 drush now• I worked in larger environments where doingthings administratively or with FTP wasn’t possible.Thus discovering the error of my ways.
  • 27. Why I <3 drush now• I worked in larger environments where doingthings administratively or with FTP wasn’t possible.Thus discovering the error of my ways.• I can admit when I’m wrong. Usually.
  • 28. Why I <3 drush now• I worked in larger environments where doingthings administratively or with FTP wasn’t possible.Thus discovering the error of my ways.• I can admit when I’m wrong. Usually.• I was trained by James Sansbury (g0rban) to use itmore skillfully.
  • 29. Why I <3 drush now• I worked in larger environments where doingthings administratively or with FTP wasn’t possible.Thus discovering the error of my ways.• I can admit when I’m wrong. Usually.• I was trained by James Sansbury (g0rban) to use itmore skillfully.• My team created custom drush commands - theproverbial straw.
  • 30. Why you should use it
  • 31. Why you should use it• It’s easier. And life is hard enough.
  • 32. Why you should use it• It’s easier. And life is hard enough.• It’s faster, which means more time for watchingfootball.
  • 33. Why you should use it• It’s easier. And life is hard enough.• It’s faster, which means more time for watchingfootball.• Better command-line skills == a better, moreconfident developer. Iow, it feels good.
  • 34. Why you should use it• It’s easier. And life is hard enough.• It’s faster, which means more time for watchingfootball.• Better command-line skills == a better, moreconfident developer. Iow, it feels good.• Command-line tasks are more repeatable and(many are) undoable - you have a history.
  • 35. Why you should use it• It’s easier. And life is hard enough.• It’s faster, which means more time for watchingfootball.• Better command-line skills == a better, moreconfident developer. Iow, it feels good.• Command-line tasks are more repeatable and(many are) undoable - you have a history.• You will (probably) have to know how to use itsomeday (soon). You will want to use drush 4.
  • 36. This quarterbackcomments his code andfollows best practices.
  • 37. This quarterback This quarterbackcomments his code and hacks core.follows best practices.
  • 38. Common drush tasks
  • 39. Common drush tasks• Install Drupal.
  • 40. Common drush tasks• Install Drupal.• Install, enable, and update modules and themes.
  • 41. Common drush tasks• Install Drupal.• Install, enable, and update modules and themes.• Run update.php.
  • 42. Common drush tasks• Install Drupal.• Install, enable, and update modules and themes.• Run update.php.• Clear the cache.
  • 43. Common drush tasks• Install Drupal.• Install, enable, and update modules and themes.• Run update.php.• Clear the cache.• Run cron.
  • 44. Common drush tasks• Install Drupal.• Install, enable, and update modules and themes.• Run update.php.• Clear the cache.• Run cron.• Disable and uninstall modules.
  • 45. Common drush tasks• Install Drupal.• Install, enable, and update modules and themes.• Run update.php.• Clear the cache.• Run cron.• Disable and uninstall modules.• Database tasks (sql-dump, sql-cli).
  • 46. Common drush tasks• Install Drupal.• Install, enable, and update modules and themes.• Run update.php.• Clear the cache.• Run cron.• Disable and uninstall modules.• Database tasks (sql-dump, sql-cli).• Set variables (vget, vset).
  • 47. Common drush tasks• Install Drupal.• Install, enable, and update modules and themes.• Run update.php.• Clear the cache.• Run cron.• Disable and uninstall modules.• Database tasks (sql-dump, sql-cli).• Set variables (vget, vset).• Revert or update features.
  • 48. Common drush tasks• Install Drupal.• Install, enable, and update modules and themes.• Run update.php.• Clear the cache.• Run cron.• Disable and uninstall modules.• Database tasks (sql-dump, sql-cli).• Set variables (vget, vset).• Revert or update features.• Create dummy content or users.
  • 49. Common drush tasks• Install Drupal.• Install, enable, and update modules and themes.• Run update.php.• Clear the cache.• Run cron.• Disable and uninstall modules.• Database tasks (sql-dump, sql-cli).• Set variables (vget, vset).• Revert or update features.• Create dummy content or users.• Makefiles (custom installation profiles).
  • 50. Common drush tasks• Install Drupal.• Install, enable, and update modules and themes.• Run update.php.• Clear the cache.• Run cron.• Disable and uninstall modules.• Database tasks (sql-dump, sql-cli).• Set variables (vget, vset).• Revert or update features.• Create dummy content or users.• Makefiles (custom installation profiles).• Custom tasks you create.
  • 51. Which drush
  • 52. Which drush• Drush is constantly evolving, so the version youinstall dictates what you can (and can not) do with it.
  • 53. Which drush• Drush is constantly evolving, so the version youinstall dictates what you can (and can not) do with it.• Not all commands work on all versions of Drupal.
  • 54. Which drush• Drush is constantly evolving, so the version youinstall dictates what you can (and can not) do with it.• Not all commands work on all versions of Drupal.• Drush requires PHP version 5.2 or better.
  • 55. Which drush• Drush is constantly evolving, so the version youinstall dictates what you can (and can not) do with it.• Not all commands work on all versions of Drupal.• Drush requires PHP version 5.2 or better.• We are installing drush 3.
  • 56. Which drush• Drush is constantly evolving, so the version youinstall dictates what you can (and can not) do with it.• Not all commands work on all versions of Drupal.• Drush requires PHP version 5.2 or better.• We are installing drush 3.• We are installing drush on a Linux server.  We <3Linux servers. Same procedure for Mac. Windowsinstructions are in the README.txt file.
  • 57. Essential Resourcehttp://drush.ws
  • 58. Terminal tools
  • 59. Terminal tools• On MacOS, you can just open a terminal window.
  • 60. Terminal tools• On MacOS, you can just open a terminal window.• We use Coda and it has a built-in terminal.
  • 61. Terminal tools• On MacOS, you can just open a terminal window.• We use Coda and it has a built-in terminal.• If you (must) use a PC, you can use cygwin orPuTTy (much better than cmd.exe and installing sshclient.)
  • 62. Terminal tools• On MacOS, you can just open a terminal window.• We use Coda and it has a built-in terminal.• If you (must) use a PC, you can use cygwin orPuTTy (much better than cmd.exe and installing sshclient.)• If you use Linux, you probably know how to do thisalready. 
  • 63. Common commands
  • 64. Common commands• Log in: ssh username@example.com
  • 65. Common commands• Log in: ssh username@example.com• (a note about keys)
  • 66. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls
  • 67. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls• Go into: cd  /directory
  • 68. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls• Go into: cd  /directory• Go up: cd ..
  • 69. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls• Go into: cd  /directory• Go up: cd ..• Let me do important stuff: sudo
  • 70. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls• Go into: cd  /directory• Go up: cd ..• Let me do important stuff: sudo• Get it: wget http://somewhere.com/file.tar.gz
  • 71. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls• Go into: cd  /directory• Go up: cd ..• Let me do important stuff: sudo• Get it: wget http://somewhere.com/file.tar.gz• Unpack it: tar xvf
  • 72. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls• Go into: cd  /directory• Go up: cd ..• Let me do important stuff: sudo• Get it: wget http://somewhere.com/file.tar.gz• Unpack it: tar xvf• Change permissions: chmod
  • 73. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls• Go into: cd  /directory• Go up: cd ..• Let me do important stuff: sudo• Get it: wget http://somewhere.com/file.tar.gz• Unpack it: tar xvf• Change permissions: chmod• Remove *caution*: rm
  • 74. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls• Go into: cd  /directory• Go up: cd ..• Let me do important stuff: sudo• Get it: wget http://somewhere.com/file.tar.gz• Unpack it: tar xvf• Change permissions: chmod• Remove *caution*: rm• Link it: ln -s
  • 75. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls• Go into: cd  /directory• Go up: cd ..• Let me do important stuff: sudo• Get it: wget http://somewhere.com/file.tar.gz• Unpack it: tar xvf• Change permissions: chmod• Remove *caution*: rm• Link it: ln -s• Move: mv and Copy: cp
  • 76. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls• Go into: cd  /directory• Go up: cd ..• Let me do important stuff: sudo• Get it: wget http://somewhere.com/file.tar.gz• Unpack it: tar xvf• Change permissions: chmod• Remove *caution*: rm• Link it: ln -s• Move: mv and Copy: cp• Complete file name: tab
  • 77. Common commands• Log in: ssh username@example.com• (a note about keys)• Look inside: ls• Go into: cd  /directory• Go up: cd ..• Let me do important stuff: sudo• Get it: wget http://somewhere.com/file.tar.gz• Unpack it: tar xvf• Change permissions: chmod• Remove *caution*: rm• Link it: ln -s• Move: mv and Copy: cp• Complete file name: tab
  • 78. This team contributesmodules and themes.
  • 79. This team contributes This team hacksmodules and themes. core.
  • 80. Installing drush
  • 81. Installing drush• Go to the directory you want drush to live in: cd /usr/local/share/
  • 82. Installing drush• Go to the directory you want drush to live in: cd /usr/local/share/• Get drush: [sudo] wget http://ftp.drupal.org/files/projects/drush-6.x-3.3.tar.gz
  • 83. Installing drush• Go to the directory you want drush to live in: cd /usr/local/share/• Get drush: [sudo] wget http://ftp.drupal.org/files/projects/drush-6.x-3.3.tar.gz• Unpack it: tar xvf drush-6.x-3.3.tar.gz
  • 84. Installing drush• Go to the directory you want drush to live in: cd /usr/local/share/• Get drush: [sudo] wget http://ftp.drupal.org/files/projects/drush-6.x-3.3.tar.gz• Unpack it: tar xvf drush-6.x-3.3.tar.gz• Remove the package: rm drush-6.x-3.3.tar.gz
  • 85. Installing drush• Go to the directory you want drush to live in: cd /usr/local/share/• Get drush: [sudo] wget http://ftp.drupal.org/files/projects/drush-6.x-3.3.tar.gz• Unpack it: tar xvf drush-6.x-3.3.tar.gz• Remove the package: rm drush-6.x-3.3.tar.gz• Change permissions: chmod u+x drush
  • 86. Installing drush• Go to the directory you want drush to live in: cd /usr/local/share/• Get drush: [sudo] wget http://ftp.drupal.org/files/projects/drush-6.x-3.3.tar.gz• Unpack it: tar xvf drush-6.x-3.3.tar.gz• Remove the package: rm drush-6.x-3.3.tar.gz• Change permissions: chmod u+x drush• Create a link: ln -s /usr/local/share/drush/drush /usr/local/bin/drush
  • 87. Installing drush• Go to the directory you want drush to live in: cd /usr/local/share/• Get drush: [sudo] wget http://ftp.drupal.org/files/projects/drush-6.x-3.3.tar.gz• Unpack it: tar xvf drush-6.x-3.3.tar.gz• Remove the package: rm drush-6.x-3.3.tar.gz• Change permissions: chmod u+x drush• Create a link: ln -s /usr/local/share/drush/drush /usr/local/bin/drush• Run drush: [sudo] drush
  • 88. Installing Drupal
  • 89. Installing Drupal• Create a database in your usual way.
  • 90. Installing Drupal• Create a database in your usual way.• cd path/to/webroot (often this is www)
  • 91. Installing Drupal• Create a database in your usual way.• cd path/to/webroot (often this is www)• drush dl
  • 92. Installing Drupal• Create a database in your usual way.• cd path/to/webroot (often this is www)• drush dl• mv drupal-6.XX drupal
  • 93. Installing Drupal• Create a database in your usual way.• cd path/to/webroot (often this is www)• drush dl• mv drupal-6.XX drupal• (notes on where to put files)
  • 94. Installing Drupal• Create a database in your usual way.• cd path/to/webroot (often this is www)• drush dl• mv drupal-6.XX drupal• (notes on where to put files)• drush site-install --db-url=mysql://root:pass@localhost:port/dbname
  • 95. Installing Drupal• Create a database in your usual way.• cd path/to/webroot (often this is www)• drush dl• mv drupal-6.XX drupal• (notes on where to put files)• drush site-install --db-url=mysql://root:pass@localhost:port/dbname• Unfortunately, that only works in Drupal 7.
  • 96. Installing Views and CCK
  • 97. Installing Views and CCK• cd into your drupal directory
  • 98. Installing Views and CCK• cd into your drupal directory• drush dl cck views
  • 99. Installing Views and CCK• cd into your drupal directory• drush dl cck views• drush en views content
  • 100. Installing Views and CCK• cd into your drupal directory• drush dl cck views• drush en views content• Brilliant drush will put them in your sites/all/modules directory.
  • 101. Installing Views and CCK• cd into your drupal directory• drush dl cck views• drush en views content• Brilliant drush will put them in your sites/all/modules directory.• Let’s watch Aaron do it.
  • 102. This coach sends hisplayers to Drupalcon.
  • 103. This coach sends his This coach hacks core.players to Drupalcon.
  • 104. Uninstall Views
  • 105. Uninstall Views• drush dis views
  • 106. Uninstall Views• drush dis views• drush uninstall views
  • 107. Run update.php
  • 108. Run update.php• drush updatedb
  • 109. Clear the cache
  • 110. Clear the cache• drush cc
  • 111. Run cron
  • 112. Run cron• drush cron
  • 113. Run cron• drush cron• You’ll see more messages that don’t show up onthe regular cron page.
  • 114. Save kittens - go Pats!