DrupalCon Portland 2013

Las novedades de Drush 6

Moshe Weitzman, Mark Sonnabaum, Jonathan Hedstrom, Owen Barton  · 


PDF (pincha para descargar)



Extracto de la transcripción automática del vídeo realizada por YouTube.

welcome everyone the dress maintainer czar happy to talk to you guys about what's new Ford rush six little introductions my name is mush Weitzman I'm a longtime drupal developer currently the director of research and development at aquia want to introduce

to co-presenters jonathan Hedstrom further away from me is the director of engineering at open sorcery and the maintainer of drush make closer here Owen Barton director of engineering at Civic civic actions and maintainer of a bunch of different pieces you'll

hear about completion drush completion or bash completion and site set and different other pieces that Owen has worked on so the first major feature in drush 6 is called output formats alright so just about all of the commands and rush are now able to be formatted

as you wish the output from there can be formatted with Jason or CSV or I and I lots of different formats yamo those are the four matters that we ship with in addition you're welcome to write your own plugins with other for matters ok so the way that manifests

is that you run a command let's say it's p.m. dash list which lists out which of your modules are enabled and which aren't and what version they're at and all of that sort of thing you can say dash dash format equals CSV dash list and then

you're going to get a CSV listing ok this is really handy when you're taking data out of your drupal site and you're reusing it in a script you can now get it in just the way that's useful for you okay if you are authoring drush commands all

you really have to do you have to do two things you remove the part of your command where you print out to your data and instead just return that data back in your command callback drush will then take care of taking that data and presenting it to the user

the way the user asked for it ok so it's it's removing a line from your command callback the other thing you have to do is in your command definition I'll show you in a second you have to add a little section to the array that tells drush which

formats you support and what your default format is if you want to learn more about output formats we have a topic and rush if you guys haven't explored the topic command it's really useful there's a ton of great documentation about drush there

you don't have to like Google all over the place to find out things just run drush topic when you run drush topic it tells you all of the topics that the authors have written and it's a little bit like man really useful so if you want to go directly

to the topic about output formats you can see it at the end of the slide there dress topic docs dash output formats okay so here's an excerpt of the command definition for the version command this command is super simple it just tells you what version

your dress is okay in addition to saying what arguments and options your command supports you have a new array key called output formats it has two elements inside of it the default and the pipe format okay default tells you if someone doesn't specify

a format here's how dress should output the data in this case it's in a key value format and if someone passionate passes dash dash pipe this instructs drush to format it as just a string okay dash dash pipe is it exists on most of our commands and

it's kind of like a handy way to get machine readable output without having to think about what format you want it in it's just give it to me in a format that makes sense that's what dash dash pipe about it would be in the in this case a version

would be the equivalent of passing dash dash format equal string okay so let's give you a little demo of output formats can you guys see that okay oh is it it's too low i see it just looks good for me ok alright so the command i typed you can see it

down there at the bottom p m dash list and I gave it a format okay if I do it without a dash dash format I get it in its standard table presentation okay so that's an example of passing format getting it back in the format you need whoa so that's a

big Jason array ok so that's output formats let's see if I can get the google example going that I had before ok so this command that I just did is going to be a little hard for you to read because there's a lot of stuff there I use the command

sequel q okay which means execute this query against my drupal site and drush takes care of how to connect to the database for this site and so forth and I passed some instructions dash dash extra to my sequel that said I wanted tab-delimited were formatting

for my sequel query alright the query I sent was simply give me the names and email addresses of the users from the users table and then i went ahead and save that to a temporary file and then upload that file to Google Spreadsheets alright and so I love it

Ezra your yeah so there was a question to see the command again let's do it like this there so you'll see the sequel qu q at the beginning then a query and then aight saves to tempt tab file and then there's ampersand ampersand and then the command

Google Docs upload of that file this command Google comes from an open source project called Google CL and it seems to work I started using yesterday and it looks pretty cool ok alright thanks now you can mostly get it right okay I'm on it ok so there's

only one user in my users table but there is that user ok now you can clap Ezra this works for other commands I guess we can try one more after I narrow my terminal okay so what I did was I ran p.m. dash list again which is that listing of modules and what

their status is on this website this is a Drupal 7 site and I redirected that to a file and sent it to Google command to be uploaded hmm I think it didn't like that tab delimited it should have done I uploaded it with the dot tab instead of a dot CSV file

name so that wasn't perfect but there is a document here alright next feature that's new in drush 6 we had a bunch of user commands in drush 5 we added a full set of role commands ok what you can do with the roles is you can create update list elite

four roles and you can also add and remove permissions from those roles and like you've had for a little while you can add and remove users from roles so there's really a good set of role related stuff here and i'll just give you a quick demo of

that ooh bummer is it still silted up spelled wrong add ministry is that singular oh good okay the error handling could be better there so what I typed dr rap which is short for role dash a dash permission you take the role that you want to operate on authenticate

a user is the role and the permission is access administration pages so I've just added the permission to the role this is a local site so doing something silly like this doesn't make any difference and if you want to remove it I think it's rmp

yeah remove access administration's pages permission from the authenticated user role alright alright so dress six is the first version to start supporting Drupal 8 we built in pretty nice support for the cmi subsystem the configuration management subsystem

alright so i'm going to show you one command out of a suite of commands that have to do with config let's see this terminal window doesn't meet spec I have my drush command alias to just dr that's why that's working alright so i entered

the command see edit which is short for config dash edit what this does is it takes any config file in your site and brings it up in your editor you can go ahead and change it and then it saves it back into Drupal this is actually like a fairly convoluted

process in cmi you need to use the staging directory to stage your file change a manifest and import it into Drupal drush handles all of that for you so this is actually quite a time savings to go ahead and do this one second i'm just going to keep going

okay so if you pass see edit without any arguments it offers you a listing of files that you might want to edit my drupal site has 134 files config files so we can just pick one let's say i'll pick the last one which is the tracker view all right views

is in Drupal 8 for people who didn't hear all views are stored in the configuration system there's cmi files so instead of going to that nice UI you can go to your editor so let's check it out i typed in number 134 I want to just edit this view

[ ... ]

Nota: se han omitido las otras 4.199 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.