Custom Drush Commands - Drupal Yorkshire

56 %
44 %
Information about Custom Drush Commands - Drupal Yorkshire

Published on August 14, 2013

Author: digital006

Source: slideshare.net

CUSTOM DRUSH COMMANDS HOW TO BUILD YOUR OWN CUSTOM DRUSH COMMANDS Created by /Mike Bell @mikebell_

WHO? Mike Bell Twitter - Drupal.org - Where - CTI Digital - Drupal Technical Architect @mikebell_ digital006

WHAT IS DRUSH? Command line utility for Drupal Used by most Drupal developers, an insanely powerful tool drupal.org/project/drush

ALIAS UP THE PROBLEM: Updating aliases across multiple multiple dev machines without the user having to go out of their way. THE SOLUTION: Drush command to keep aliases in sync. Prompt user for download when using Drush.

CAVEAT Insecure, Demo, Use at own risk!

THE TOOLS Drush... Composer Symfony YAML

COMPOSER WHAT IS IT? Dependency manager for PHP. WHY? Used for grabbing Symfony components and creating an autoloader for them.

COMPOSER EXAMPLE { "name": "drush/alias_up", "description": "Provide a method to automatically upgrade a user's aliases. "license": "GPL-2.0+", "require": { "symfony/yaml": "2.3.*" } }

SYMFONY/YAML Used for parsing Yaml files into arrays. Also used in Drupal 8 core for all config files.

EXAMPLE CONFIG FILE type: git (git/http/https) source: http://mikebell.io/alias.php updatefreq: 1 (days)

THE HOOKS Symfony Autoload hook_drush_help() hook_drush_command() aliasup_init() aliasup() aliasup_download() hook_drush_init() aliasup_uninstall()

SYMFONY AUTOLOAD Auto load the YAML component require 'vendor/autoload.php'; use SymfonyComponentYamlYaml;

HOOK_DRUSH_HELP() Define standard help for the command

HOOK_DRUSH_COMMAND() Define your command and the short commands for running $items['aliasup'] = array( 'description' => 'Update aliases from central server', 'callback' => 'aliasup', 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, 'examples' => array( 'drush aliasup' => 'Update aliases' ), 'aliases' => array('au') );

INSTALL 1. Clone Repository 2. composer.phar install 3. cp example.config.yml ../aliasup.config.yml 4. Configure 5. Create aliases.drush.php 6. drush aui 7. drush sa --table

USAGE drush au Updates the alias file from the remote server

UNINSTALL drush auuni Removes all the code from the install.

LIVE DEMO What could go wrong?

ANY QUESTIONS?

RESOURCES Presentation resources: - Used for presentation - HTML shorthand Drush API File Drupal Answers Reveal.js Zen Coding Reveal and Zen Coding Blog Post

Add a comment

Related pages

Drush commands reference | Drupal Groups

Drush commands reference. ... Drush Make. make Makes a drupal site out of a makefile. ... an array or CSV string of nids (e.g. "custom_get_my_nids();").
Read more

Drupal Yorkshire 13th August 2013 - Mike Bell - Drush ...

... who presented his talk Creating Drush Commands. ... Drupal Yorkshire 13th August 2013 ... #1 Creating a Drupal 7 custom theme from an ...
Read more

commands | Drupal Groups

Enhancing Nagios to monitor Drupal using Drush commands . ... about your drupal site? Consider using drush to ... commands, custom, Drupal, drush, ...
Read more

DRUSH Navaja Suiza DRUPAL - Documents

DRUPAL Notas Técnicas Intro a DRUSH ­ La navaja ... list of paths to search for drush commands ... Custom Drush Commands - Drupal Yorkshire.
Read more

Getting Started: Recommended Modules | Drupal.org

Getting Started: Recommended Modules; ... Helpful Drush Commands; ... Drupal’s online documentation is © 2000-2016 by the individual contributors and ...
Read more

Most Viewed Cheat Sheets - Cheatography.com: Cheat Sheets ...

Most Viewed Cheat Sheets. Cheat Sheets. Sort: Magic. Magic; Rating; ... Commands (10) Eclipse (10) Economics (10) ... Custom (1) Cv (1) Cvim (1) Cyber (1)
Read more

Peter Brady | LinkedIn

View Peter Brady’s professional profile on LinkedIn. LinkedIn is the world's largest business network, ... Freelance Drupal Developer; Drush Commands;
Read more

getvids.me - EsBuzz

Las 10 frases que nunca debes decir a una amiga que está triste Cuántas veces nos encontramos ante la situación de tener que consolar a una ...
Read more