 All right. Hi, everyone. It's a full house here My name is Moshe Weitzman. I'm a longtime Drupal developer now a member of Acquia We have a few members of the Drush team here. We have a great group of maintainers Maintaining this project. I think maybe You guys introduce yourselves as you come up. How about let's do it that way So we're gonna talk today about Drush 5 Drush 5 is going to be released today right after this conference Awesome. Thank you there's a lot of exciting new stuff in Drush 5 and We're just gonna show some of that to you today All right, so let's get right into it so one new feature is something called Drush Shell aliases, okay, and These are little Aliases you can make to Drush commands. All right So the first one you you see here has the key of non-core and On the right hand side PM dash list and the option no core. All right, so This is an example of Making your own alias for something that you type all the time. Okay? So, you know, I happen to not want to see the core modules when I run PM dash list for the most part so I made a little shortcut for myself non-core you run Drush non-core and One of the first things that Drush does is translate that into PM dash list dash dash no core. All right The second example here is an example of running a Little bash fragment straight out of Drush. Okay, so here We're running git pull and if that succeeds we're running drush update DB Okay, so this doesn't just work for drush commands It's any bit of bash that you want to put in this right hand side You can make it a you know accessible as if it was a drush command. Okay? In order to use these you just open up your drush RC file and Go ahead and edit. Okay I'm going to show you that now Remember that that drush RC files are available to you personally in your home directory In addition, they can live inside of a site a Drupal site That would be the sites slash all slash drush directory. Okay, that's a new feature of drush 5 as we have a Dedicated place to put your drush command files That go along with the site And of course drush RC files can be in Server-wide locations And so that way everyone on your development team who uses that server has access to these shell is is okay So you're promoting Common practices safe practices by using shell aliases. All right. All right, so This is the example drush RC dot PHP file You'll find that in the examples directory copy that out to your home directory or to a server-wide directory and Drush will read it and honor it So in order to start using the shell aliases that we provide as examples you can go ahead and start on commenting these things Those are the those are two or two out of three that I just talked about and Go ahead and add drone. Okay If these look familiar to some people this is Pretty much exactly what get does with its get aliases in its dot get config file. All right Very handy feature All right one nice thing that we added here. We added a lot to The command line environment so that issuing commands is more comfortable A new thing in drush 5 is that an unrecognized option will give an error immediately It will not let you proceed and basically ignore that option. All right. This is also similar to how get works So just to see that in action Okay, so that foo doesn't exist You know more to the point if I misspell the word the dash dash help option Drush isn't going to try to guess or proceed It's going to say you need to clarify yourself and I think that's you know an example of drush coming with proper You know seat belts And so that's a nice thing Okay, so what I've done here is I've show I'm looking at the help for the sequel dash dump command All right, and One new feature is that this option DB Earl Has an example value here my sequel database URL And in addition it's in Angle brackets. All right result file is In square brackets So this is a hint to you as a help reader that a result file optionally takes a value That's what the the square brackets are about and DB URL has a mandatory value Okay, so you'll see in drush core that we were pretty good about Specifying if you know which ones took values and if they were required or not and giving you nice examples Okay, I encourage all of you who write drush commands of your own Go ahead and use the additional features when you declare your options so that you say What the example value is and if it's required or not, okay? That will be a real help to everyone who uses your commands All right, so we did a lot of work on Windows in this drush 5 release We had Sponsorship for Microsoft which I'm very thankful for To get drush working well on that platform. All right They sponsored a Windows installer And this is just like any other app on Windows. It's an MSI installer for drush Arguably, it's easier to install drush on Windows than any other platform It puts all of the prerequisites for drush right in your path. Okay and You can download that there's a link on our project page to go out to drush.org and download that We worked hard on the unit tests so that we know that the commands work on drush Work on Windows We didn't quite get to a hundred percent passing but we got really close And the you know in general the fails are because the tests aren't compatible not because drush doesn't work So all you Windows users, please go ahead and use the installer And report back bugs as you find them All right drush 5 has optional usage tracking so if you go to that same drush RC dot PHP file and you Uncomment a couple lines drush we'll keep a local text file of all of the commands that you run and It's anonymized so that the values that you put into your options and your arguments are stripped out and Every so often drush can optionally send that up to mongo lab to our mongo lab account where we can run some queries and figure out what commands people are using what options people are using and You know publish some research for people to do there So I really encourage you guys when you install drush 5 to go ahead and uncomment those lines so that we can get data All right For those who are curious. There's two commands that go along with usage tracking So you can just see what? drush is logging and You can see you can control when it gets sent If you're you know working for a large organization and you want to see how your organization uses drush You can actually change the endpoint so that it collects up to one of your Data aggregation points instead of our mongo lab. All right. All right, so It's a super simple text file There's a drush command to go view it. You can see that I use site alias a fair amount archive dump core status Here my p.m. Download. I have my git information all here But you can also see that like my get username has been stripped out of the logging all right So it's completely anonymized quite ready for the end slide. Okay, so we'll take Jonathan or yeah Hi, I'm Jonathan headstrom. I work for a web development shop called open sorcery in Portland, Oregon And I'm going to talk about drush make how many people here have heard of drush make How many people here use drush make Awesome So for those of you that haven't heard of it drush make is essentially a package manager for your Drupal sites You can think of it as a shopping list for you You write down You know what you need specific versions of projects modules themes and libraries and Then you run drush make and it goes out and fetches all these specific versions Builds them into your Drupal site exactly where you need them to be whether it's in sites all or you know a specific sites directory Or in a profile directory It can handle patching. So if there's a you know bug in a particular module that hasn't been committed yet You can specify a specific version of that module and then tell it to You know go out and actually download This is the node stream make file by the way So here you can see specify patches and it will actually dynamically patch those as it processes the make file The good news drush make's been around for a long time drush make is now in drush core proper So when drush 5 is released you He will automatically have drush make at your disposal I can't I'm not really going to go into all the really cool things you can do with drush I encourage people with drush make I encourage people to use it for their projects, it's a really Really good way to sort of see or get a get a quick overview of what's going on in In a particular Drupal project and if you go all the way and stop actually committing Individual can trip modules to your get repo and just use drush make then it's a lot easier to do code reviews Because you're not seeing somebody commit custom code at the same time. They're updating, you know 40 modules You can you can pick out commits a lot easier On custom code and things like that. I'm going to go a little bit into the details of what's improved since we've brought it in to drush core Drush make used to have its own concept of tests. They were a homegrown solution that just processed some internal commands and checked In MD5 some we've ported those old tests over to drush's PHP unit and Added quite a few new tests and quite a few unit tests So drush make is now a lot better tested So we can be confident when we're adding new functionality that we're not breaking things It's been refactored internally to use p.m. Download, which is another internal drush command For the most basic download. So if you're not using SVN or get it's going to use p.m. Download to actually Grab the do the processing of the download One benefit of that is that it it uses Drush's cache. So if you're repeatedly running a make file downloading a hundred modules once you've run that once locally As long as you're not running with the no cache option. You're going to see that make file process almost instantly It also uses caching for get checkouts if you're not using the working copy command Working copy essentially does it get clone and leaves a functional get repository for each project, but if you're not running that then It'll it'll use what's called a get reference and on subsequent builds It will pull that locally and pull any updates instead of a completely new clone. So that speeds things up quite a bit And then it also caches Normal file downloads. So, you know, if like library tar balls and things like that get cached locally and then the the last big change is Projects are now processed concurrently the default is for so you're and you can change that from the command line So you're really only limited by your Bandwidth at that point. So things process a lot faster, especially large large make files And those are those are the big changes since it's come into core So I'm gonna leave it at that Hi, so My name is Owen Barton. I'm a that director of engineering at civic actions and I'm gonna be showing three new bits of functionality. We added to Drush 5 The first is auto complete auto completion If you used to the command line, you should be familiar with this if you're you know using Alice, for example, you can hit tab If you hit twice you get a list of options if you start putting your letters you can press tab and it's automatically filtered by the Characters you've entered so far. So here you can see I press tab I'm just seeing the options that begin with R So we've added the same functionality to drush. So Now I can type drush and I can hit tab tab if you don't have anything in there you have to do it twice I've got a lot of options here So these are these are all the completions I could choose from If you look you'll see there's Site aliases in here. There's commands. There's shell aliases So I can go and and if I start typing a site alias So if I do ampersand C Means I want to site alias begins with C. I hit tab I've got multiple. Oh Something with that specific site I think But it completed to that site. I'll just do it self. So I think that works. So So if I'm if I'm within a particular site I can I can complete and I'll this will show me the commands within this site. So it's kind of contextual So if you have commands installed on your site In the code base, it'll show you those commands as well on the completion command line so I can type again, make sure I've got a D for example I press tab I get all the commands that start with D I can type deep. Let me find Or E. I mean, it's probably a more useful example. So I can do is the cursor not used to this So he actually the e-commands so you can you can go through the list of options available to you at any point in time. So Here I'm I'm adding it. This is the enable command if I press a I get a list of the Modules that are available that I could enable So I could do Ten modules This is interesting Okay Okay, so you can see what I did that so I halfway through typing fo. I Hit tab and it completed to forum. So we've got on Probably the majority of commands in Drush core Have completion for arguments So you in your in your in your own commands, you can provide this as a hook Complete and you essentially provide an array of all the options that are available on on the site So you can if you need to you can bootstrap the site and You know, you could look at content types. You could look at fields Whatever it is your command deals with those arguments You can prove you can provide back in that hook and it will complete Also options are available so There's two kinds of options in Drush There's global options which apply everywhere and then there's command specific options So Drush actually doesn't care where the options are In the command line, but to keep things simpler rather than present the global options all the time It's a little bit overwhelming. So what we decided is if you are on the Before the command it will show you global options if you're after the command it will show you command specific options. So Let me just make sure I've got a command that has some options I can use So global options if I just press tap on here I can see all the global options the rapping is a little funky, but So I'm completing here, I'm just pressing tab so you see I didn't have to type interactive I just typed int and tab Then if I type a command It's a DL Now if I do tab tab, that's right hyphen hyphen now I'm looking at the Options just for the download command so I can type something like des And it completes to destination So this You know it's definitely makes it a lot quicker to get around Drush everything's cash So even if you have to bootstrap a site and it typically you know responds really quickly And yeah, so you know you can complete commands site aliases Shell aliases global options command specific options and arguments for commands which are provided by the command itself To set this up There's a couple of different options I'm not sure what the where it most keeps his drush directory, but the which drush which drush Okay, so if I'm in the drush directory This file here drush.complete.sh This is the file that Makes a bash aware of the auto completion So you'll need to copy this If you have root access if you're setting it up on a server, this is the you know the simplest way There's a directory at C That's bash For sure if I'll have access. I don't think I have access, but it's basch underscore completion dot D so you can just copy that file into that directory as root and Drush will be able to you know pull in the completions on your command line the other way of doing it is That's probably something you don't want to do in your You know your personal user. You don't want it necessarily applying to all users on the system is there's a Example bash RC file. So this actually includes the completion and it includes a whole bunch of other kind of shell related tricks If you just look at the file, it's just a text file. The instructions are at the top here You need to include a little That little snippet of code in your in your bash RC Your dot bash RC in your home directory and that's this is a file Let's run every time you start a new terminal. So it means that This file will run and it will set up Set up a number of aliases for Different commands so rather than typing Drush you can type DR rather than typing Drush PHP eval you can just type EV directly on the command line so I can do Something Something like that and As you can see it it ran that That script so it's you know the most common commands you could just type directly you can also do aliases so it creates Bash aliases for your site aliases so you can do So I hear you see I'm not typing drush This is something that's been added to my my shell environment so that my shell environment is populated with my aliases and when I When I call it it will run drush behind the scenes So it's a bunch of little tricks. I'm not going to go through them all now But they're really fun and useful if you use if you use drush a lot The other things okay, I'm gonna have to go back to the director who's up before Okay, so I Was getting quite frustrated I worked with a lot of different sites civic actions kind of helping out all over the place and I was getting frustrated having to manage patchy configuration You know sitting up v-host for each side or altering v-host or you know I tried doing special wild card v-host and that kind of works, but it was also kind of a hassle and broke stuff so So I was like well, maybe drush could have its own built-in web server a little like Django or Rails and I've played with those and it's really handy and And I decided that was crazy and then I waited a while and I got more frustrated and I decided I was gonna try and do it anyway, so The drush 5 has its own built-in web server It's called run server RS for short. I'm just gonna use the alias RS the shortcut I'm inside a site here. You can also use it with an alias If I just type drush RS, I think I must do it. Do we have another terminal somewhere? Okay, okay So if I type drush RS this Okay, I'm gonna choose a different port here. So this is brought up a built-in PHP based web server I Port 889 so I can I can go to this address and I can actually If I just hit control C to close the web for run server if I put a path on the end It will open the site for me in So it's really fun. There's a couple of prerequisites Actually has two built-in to two web servers it can it can work with There's a built-in one that that drush comes with that Uses PHP CGI, so it's the PHP CGI binary if you should be able to type PHP CGI dash V and get something back It needs PHP 5.3 and it needs Sockets built in which is very common We do that some some Installations don't include PHP CGI especially if you've got it built to just build an Apache module most of the kind of more popular Distributions and kind of map type things do come with CGI. I think The other option is PHP 5.4 also comes with a built-in web server written in PHP and Drush knows about that and is able to Start that web server up as well. So you can have two different options depending on depending where you're at As you can see it's listing a little log in the terminal This will also include includes watchdog messages. So if you log in log out you do a DSM call It will output in your terminal So it's passing those back. There's also some tricks Can exit this? There's an option dash dash user So you can specify a user to log in with I think I might already be logged into the site, but No, maybe not. I Don't know if this is that latest Maybe we're working on this yesterday. So but it will it will log on to the The site for you as an admin user. So you don't have to log on you don't have to do, you know Go to the password reset URL or anything like that Let's go show the help very briefly here in the time So You can choose the server it will it will try and decide what serve you to use based on what's available You can specify what IP you want the server to come up on on the but by default it will it will only show up on your On your local machine, and I think there's a point I should have raised earlier This is a development web server. This is not something that should be used for production or even really sharing with people You don't trust it's not designed for you know running any kind of site for any length of time. It's something Specifically to get around the problem of having to maintain a bunch of V-hosts for development sites so you could just go to a site bring up a server and have a play with it right away So it's built for convenience rather than You know performance or security or anything like that. So if you need to run a production site Use a use a production web server. This is a development So yeah, so that the It's kind of like a URL like Schema for specifying that the address and the port and the path That you want the web browser to open open in so you can change the port you can have different sites come up on different ports If you want so you could actually have multiple terminals running different web servers at the same time if you like You can you can also pass in variables to the running to the site, so let me just show this And that didn't work it I think this is another thing we added a couple of days ago The So that and that this doesn't set the variables It didn't change the variables It just passes them into the running site and injects them into the comp So typically you would include this in your dress RC And it's really useful if you for example use develop module locally You can have all your devalued configuration for example or you know disable CSI like aggregation or whatever else you like to do on your development environment You can have it always apply that those variables to your site without having to even touch the database It's having having done this we I wanted to have a little bit more fun. So I worked on Another another command that essentially just changed together a bunch of what drush does or together and the use case here is If you're a your core developer or you develop lots of modules or you want to you want to work on some module And you're not really working on it in a you know in a client site or a particular project, you know You just Have something interesting in that module you want to do some work on that specific module or you want to do some work on core It's a lot of it's a lot of overhead to like bring up an entirely new Drupal site drush makes a lot easier But you've got you know download Drupal you're going to create your database You're going to you know add your patch configuration if you're using that you've got to do your site install command Which has a bunch of arguments? You could download your module you've got to enable your modules And then when you're all done, you know, you try your patch. It doesn't work You're like I don't have time for this now. I'll just forget it Then it's a whole bunch of work to undo it you left with you know a database in the database you left with a patchy v-host And I wanted something that just brings kind of a throw away site up So I can just bring something up when I'm done with it. I blow it away. It's gone forever I don't have any databases left over so This is command called quick Drupal or essentially core quick Drupal And the nice thing about this is you can actually just run it the aliases QD if I just run drush QD In fact, I'm going to put a Y on the end. So I don't like the questions and it will so what this is doing It's going to download Drupal. It's going to install Drupal using sequel light So it creates a sequel light database. So it's just a file in a directory. The whole thing is contained in one directory and It won't work because I've got the ports ready in use. I'm not sure what happens there and It will it will bring up a web server and start your browser in the in the site Let's just see if we can find this other Run server command that's hiding away somewhere Shall we found it? Well, it looks like it looks like it should go. Let's try again So this this command actually inherits all the options that are available for all the commands that it uses So you have all the options available for there we go So you have all the options available for download site and store So you can see it's pretty fun. It's really nice You just want to show Drupal to someone. It's like two letters That's it. I don't think you can get simple in that It's like and you don't you don't you need a patchy installed You don't even need my SQL installed if you have you know a reasonable PHP install It will do all of this with nothing else. Just you need the sequel light extension Drupal 7 and then PHP CGI for the runs ever if you use that I want to add one thing Owen And so the example so far has been Drupal core In the standard install profile But if you look in the examples you can actually do this for other distributions of Drupal and other install profiles, so The directory we're in was made with a drush quick Drupal commerce kickstart All right So it went and got the whole quick start distribution from Drupal.org and installed it with the commerce kickstart profile So this is quite a flexible command. I could show that running, but Do you have any history? Do you know? Yes Okay, I'll just show that So this I think command this command probably wins the the award for the command drush command with the most options Yeah, yeah, I'm really good So I'm not gonna go through the options. These are the same options you will familiar with if you use to the DL command site install I just wanted to point at the the examples so this example here The first the first argument is the name of the site So this is essentially just the name of the directory. Otherwise, it just creates a timestamp directory So it's useful if you want to come back to it later The additional argument to the names of any other projects you want installed so it could be modules You could just put deval on the end you could put a theme or a whole series of modules If there's a module that has the same name as the project it will be enabled automatically And then this example shows you Downloading a specific core so a specific distribution from Drupal.org and then installing a specific Install profile. So this will get to the site. We were looking at earlier. It's like a fully functional Drupal commerce instance with just Yeah one command You can run it against it. You can you can use an existing course. You'd run drush make first And then you could you could kind of use this to bootstrap it a little bit It's it's really designed as a very lightweight thing. It's not they can't replace drush make with just arguments So but it's really handy if you just wanted to do something quickly I got hand over I'm good thank you and Couple of things I'm going to show you and we're going to show you use the new q commands in Drush who here has used the qapi and triple seven about what I thought So for all you guys who haven't the qapi is actually one of the coolest things that are it that's in Drupal 7 but no one talks about it There's a couple issues with it But one one thing one thing that's wrong is there's actually no like default runner when you declare a queue I'm just gonna assume that everyone knows that a queue is I don't have time for that but When you declare a queue you use hook queue or hook cron queue info And it's basically you set up your queue and give it the call back and it runs in cron But there's no way to actually There's no way to actually run Run that queue without being in cron and one of the great things about queues is you have this big list of work to do and You want to queue you could potentially have multiple queue runners all running simultaneously Doing all this work and running the queue down if it's in cron that's kind of hard to do So there's a couple things we added a default queue runner to drush and also a Small command to list your queues So two or two modules that use queues. I think it's aggregator and feeds So I enabled those Yeah, so here you can see it'll show you what the queues are named that are declared How many items are in them and the class it's using and so you can see here One of them is actually using the Redis queue as a back end So all of these queue commands are compatible with any queue back end So they'll work with the Redis beanstalk whatever Some of this if you've used beanstalk, which I don't know maybe now some of this is kind of stolen from those like everything I took everything that was good about all the queue modules and just put them into one central key runner And so say if I just want to run that one queue I can just do And what that's gonna do that's going to look up the It's gonna look up the the queue callback and then run the queue callback Just like what would happen in cron, but now it's not in cron And if I do queue list again, yeah, it has no more items left so the other thing this does is a It supports a queue hook that was originally defined by the queue UI module, which is just hook queue info Where it lets you define a callback that is not pulled in by cron And so that's the other piece of it and hopefully that that hook is is will look more like what we end up with in Drupal 8 So this commander cool, but still you should be using queues if they're awesome The other thing I want to show you is who here who here works on multi sites regularly How many of you get annoyed when you want to use one site and run a drush command, but it actually runs on default So you don't have to do that anymore And it will again you usually you CD to that site directory and then all the all the commands work But that's really obnoxious. So now we have persistent site setting So for example, one of these actually I'll just go to one of my One of my sites here, let's do drush Site set Hey, and yeah, so it's telling me that's my site now One thing that's broken. Actually we offer I need to fix this for release. We offer a drush ps1 Bash function that comes with the autocomplete stuff And so usually that site would show up in my little ps1 here in my prompts So I could know that I was working on it similar to how get prompts work But yeah, I think we recently changed the path to do something that broke that'll be fixed And so now if I do drush status You can see that I'm using that database in that site and that'll persist for that entire session so and then if you want to get rid of that you should rush site reset and Now I get a crazy message because this is Drupal Gardens and we have a Crazy message if you try to do default, but otherwise it would just say default So yeah, that's what I'm showing you Time for questions. I think All right, everyone who has a question. Could you just go up to the microphone? We'd be happy to answer This is a drush make related question Whoever wants to answer I'm a heavy user of drush make files for Distribution-based deployments And one thing I've found when I'm actually creating a distribution is that When I want to test a rebuild of that make file I have to commit it upstream Then build another version and compare across make sure everything has came down correctly Is there any possible way that you could? Build a registry of everything that has been pulled down when you build to that site and then have a drush make rebuild So there's there's currently an issue that has not been fixed that I think addresses a rebuild If you're if I understand your question Where and you could instead of using PM update you would update your make file and then run rebuild on an existing site then there's also two new commands or options rather that have been committed and Those would let you if you edit your make file and don't want to rebuild the whole thing you can you can do dash dash I Forget the exact syntax, but it's in the help It's something like dash dash libraries and then a comma separated list of just the parts you want to update And you can also do that with projects Thank you Yeah, so the question was do you need to run the MSI installer if you run dresch on windows You do not need to you can certainly set up the environment on your own We are pretty careful to use Power shell or command prompt. You don't need sig win for example to run dresch on windows But you do need a bunch of things on your path. That's really it Right, okay First of all awesome work. Everything looks amazing Question about the queue the queue API stuff Is there and maybe I just don't understand the queue API enough to know but like as far as memory handling and stuff like that Do does it does it handle the issue where you know if eventually you get to Reach the PHP memory limit. Does it does it handle any sort of like? Forking the process or anything like that Yeah, so it doesn't I think that's that's more of an issue when you have like long-running queues and if you're using like beanstalker Redis with like the In like the blocking mode where you have like a long-earning dresch process. That's like listening to that You can definitely run into issues like that Waiting queue is still the preferred queue runner for long-running queues and it does do that I have I haven't ever run into that situation not on a long-running queue, but I Would be open to adding that if that was the case awesome. Thank you Is there is there a way to use a make file without specifying a specific version number like just have it grab the most recent release Yeah, the default if the the minimum line you need is you would say projects and then bracket empty bracket equals Views and it would just grab the latest version of views for whatever version of core you're building your make file All right. Well, thanks for coming and you know, we'll see you on the command line Please fill out the survey on the Drupal con site. Thanks