Nuvole: How to maintain Drush commands for Drush 8 and 9 and Drupal console with the same code base.

Planet Drupal - 13 October 2017 - 1:48am
Config Split treats all the cli the same.

Drupal 8.4 and its upgrade to Symfony 3 has made the compatibility of the global Drush 8 a bit more challenging. Drush 9 works with Drupal 8.4 but it is not stable yet and the format of how third party Drush commands are made has changed significantly.

While Drush 9 comes with a command that helps porting Drush 8 commands you will still end up maintaining very similar code in two places one with calls to drush_confirm('...') and one with $this->io()->confirm('...'). If you decide to also provide your commands for Drupal console you now have three times the burden.

Because we tried to provide the commands for Config Split for both Drush and Drupal console early on we faced this problem already more than a year ago. And now it has paid off because porting the commands to Drush 9 was very quick.

The solution is actually really simple and brings the added benefit of being able to test the business logic of the commands in the absence of Drush or Drupal console. It is all about separating the command discovery from the command logic. Drush 8, 9 and Drupal console all have a bit different ways to discover and invoke commands, but the business logic you want to implement is the same so all we have to do is to extract a common "interface" our custom service can implement and then make the command definitions wrap that and keep things DRY.

The CliService

Config Split defines a config_split.cli service with the class ConfigSplitCliService with all its dependencies injected. It has the methods \Drupal\config_split\ConfigSplitCliService::ioExport and \Drupal\config_split\ConfigSplitCliService::ioImport that implement all the commands logic and delegate the actual importing and exporting to specific methods.

The method signature for both the export and import method are more or less the same: CliService::ioMethod($arguments, $io, callable $t).

  • $arguments: The arguments passed to the command.
  • $io: This is an object that interacts with the command line, in Drush 9 and Drupal console this comes from the Symfony console component, for Drush 8 we created a custom wrapper around drush_confirm and drush_log called ConfigSplitDrush8Io.
  • $t: This is essentially a t function akin to how Drupal translates strings. Because Drupal console translates things differently we had to be a bit creative with that by adding a t method to the command.
Commands wrap the service

The Drush 8 command is essentially:

function drush_config_split_export($split = NULL) {
  // Make the magic happen.
  \Drupal::service('config_split.cli')->ioExport($split, new ConfigSplitDrush8Io(), 'dt');

For Drush 9 we can use dependency injection and the Drush 9 command becomes essentially:

class ConfigSplitCommands extends DrushCommands {
  public function splitExport($split = NULL) {
    $this->cliService->ioExport($split, $this->io(), 'dt');

And very similar the Drupal console command:

class ExportCommand extends SplitCommandBase {
  protected function execute(InputInterface $input, OutputInterface $output) {
    $this->setupIo($input, $output);
    // Make the magic happen.
    $this->cliService->ioExport($input->getOption('split'), $this->getIo(), [$this, 't']);
?> Testing

The ConfigSplitCliServiceTest is a KernelTest which asserts that the export works as expected by exporting to a virtual file system. The test coverage is not 100% (patches welcome) but the most important aspects for the complete and conditional splitting (blacklist/graylist) is thoroughly tested. There are no limitations on what or how you can test your CliService since it is self contained in your module and does not depend on Drush or the Drupal console. For example one could write a unit test with a mocked $io object that asserts that the messages printed to the cli are correct.

Tags: Drupal 8Drupal PlanetDrush
Categories: Drupal

InternetDevels: More profits & less effort with Drupal multisite functionality

Planet Drupal - 13 October 2017 - 1:27am

Here is another recipe for success. You can have a whole team of websites playing for you, and they don’t have to be created from scratch or managed separately. The secret lies in Drupal’s well-developed multisite functionality. Thanks to this, Drupal will not only let you leave your competitors behind, but also multiply this effect by many times.

Read more
Categories: Drupal

The Elements of a Good One-Shot

Gnome Stew - 13 October 2017 - 12:00am

GenCon, Masks, where they ended the beat the bad guy Guardians of the Galaxy style… by holding hands…

I’m doing things a tad bit backwards here. This week’s GnomeCast was Matt, JT and myself rambling about the elements of a good one-shot game. It was a hastily thrown together episode due to how busy I’ve been, but Matt jumped in and did some research on the Stew’s archives and noted that, other than an article where I talked about one-shot characters, we haven’t had a focused one-shot article since Martin posted some way back in the day. So for today’s article, I’m reversing the streams and following the GnomeCast up with an article.

If you’ve read any of my articles, you might realize I attend quite a few conventions. I think this year my total will end up being ten. These vary in scale between barely surviving college cons, thriving college cons, medium sized and growing cons, to the monsters of the summer—Origins and Gen Con. Some of my favorites are what a co-worker calls my ‘bespoke artisanal cons’, basically private get-togethers of folks who still game like crazy for a weekend.

Anyway, as a result of my frequent con attendance, I end up running quite a few one-shots throughout the year. Some cons I only ran one game. At Gen Con, I ran four different games. I’m not a workhorse GM like some because I rather enjoy being a player, but I still want to do what I can to bring games to conventions. While I never think of myself as an expert, my experience with the subject at least gives me room to talk about the subject.

Now, just to clarify, not every one-shot needs to be run at a convention. Home groups rely on them too; in between campaigns, when the regular GM can’t make it, when the group is missing key people for the next session, or because they want to try out a new game. Even if a group is super dedicated to a particular campaign, there can still be opportunities for the occasional one-shot and the elements of what makes a good one remain the same.

Here are some of my thoughts on what makes a one-shot successful:

They’re Self-Contained

Origins, D&D. Brett from Gaming & BS’s Avalon game. Only two hours, but incredibly memorable.

Because you need to start and finish during the same session, it’s key to know how to pace a game. Regardless of the type of prep a GM brings to the table, they need to give their players a good opening scene and a satisfying conclusion to the game. What happens in the middle should be plug-and-play as needed. Some groups will speed through a game and need everything the GM has prepped or ready to throw at them. Other groups will fixate on a particular aspect of the game and may not need any middle encounters before they get to the finale of the game.

Speaking of the finale, make sure you have one for your one-shot. If you don’t give your players some kind of conclusion at the end of the game, it’s not going to feel like a very satisfying game. You don’t need to wrap up every loose end, but any major plot points of events should be explained and wrapped up.

As a side note, I will argue that a well done cliffhanger can serve as a good conclusion, even for a one-shot. Take a look at how Empire Strikes Back ends. There’s a climactic fight at the end and there’s no question on how that shakes out. Just because you’re left with some burning questions at the end doesn’t mean the ending wasn’t satisfying. It may make the players ask you to run it again at some point, but you still gave them a solid game experience. In one Monster of the Week one-shot I ran, there was a big, emotional revelation at the end of the climactic fight. The logical conclusion was for one player to break her sacred weapon and walk off into the night. The players still talk about that ending. Use cliffhangers sparingly and make sure it’s suitable for the game as it’s wrapping up, but they can be quite effective.

Get the Players Invested Quickly

In one-shots, you don’t have time for your players to build a slow, organic connection to their characters or the game itself. You need them invested right away. If you’re going to make a habit of running one-shots, it’s good to develop a few different techniques for this. During the GnomeCast episode, Matt and I discussed how we have different things we value in games. I am far more into the story and the characters, while he’s more interested in the tactics and problems to solve that the game presents. The players you get at the table may also vary like this, so you may not be able to please everyone, but having a handful of techniques you can use to get them involved right away will help.

I’ve rambled on about how to create characters for one-shots, so you can read about that over here. For pre-gens, keep the backgrounds interesting and relevant to the game, but also succinct. I know I have a tendency to write a book, so I always have to go back and edit my backgrounds down. If you give your players a book, many players will tune out from the tl;dr (too long; didn’t read) and important bits of background can get missed. I also enjoy creating hooks between the pregens, so I’ll always weave connections into the characters to help establish some roleplaying hooks right away.

Origins, Bubblegumshoe, they followed the clues with their own style, but still solved the mystery. 

Every character at the table should have something to do in the game ahead. Do not include characters that don’t have a place in the adventure you have planned or expect to run. You don’t have to specifically plan encounters for each individual character, but you should have in mind a way that each character can be useful. One convention failure I played in included two very social characters among the pregens, but the adventure the GM had planned sidelined both characters quite thoroughly by sending them off into the wilderness to an abandoned mine. Good players will make their characters integral to the game, but there’s only so much they can do when their character’s skill set is completely unnecessary to the game’s scenario.

With many indie games (including PbtA games that I love to run), the players should be creating their characters at the table. These games usually don’t encourage pre-planned scenarios, but the same rules apply. The GM should make sure all the characters created have a role to play in the game ahead. Pay special attention to the things that players are calling out in their characters because they’re essentially telling you what they want to see come into play.

Beyond the characters, have an interesting and engaging opening scene. Don’t dawdle getting them the hooks for the adventure. If the game is about finding a missing person, they should know in the first ten or fifteen minutes who that missing person is. Get to the action! Make sure that introductions happen so everyone knows who is playing who (table tents can really help here), but you don’t want to drag the opening out too long before they start getting involved in the game world.

In Medias Res can be a good tool to use, but handle it carefully. The players should have an understanding of why they’re in the scene as it starts. I’ve seen too many GMs try and use this type of opening without giving their players a working understanding of why they would be in that situation and why they would be working with the other PCs. Establish that information first, then dive right in.

Manage Time Mindfully

By their very nature, one-shots have a set time limit. At cons, it’s often four hours, though they can range from two to six hours as well. Regardless, they all have a deadline they need to be finished by. Make no mistake, it is incredibly disrespectful to your players to assume they can stay longer for YOUR game. It’s one thing if it’s your regular crew playing in your dining room and you ask if they can stay later. At a convention, your players have people and places they need to go see. If I run into a GM at a convention that runs over their time slot, they get put into a ‘do not play with again’ list.

Keep some sort of time-keeping device nearby. I usually have my phone on the table where I can quickly glance at what the time is. This way I know when to let my players have a quick break, but also when I need to start moving towards a finale. As mentioned above, different groups will fixate on different things and move through the scenario at different speeds.

You absolutely do not want to railroad your players through the scenario, but feel free to nudge them along when they seem to be fixating on an unimportant aspect of the game. If you have to, move them along by external forces pushing them forward. Maybe the villain finds out their location and attacks them before they can finish planning their own attack. Either way, keep the game moving and get them to that finale.

So there are my thoughts on the important elements to a good one-shot. Did I miss anything? What do you feel are the most important things to keep in mind so your players have a good one-shot experience? I’d love to hear your thoughts.

Categories: Game Theory & Design

Appnovation Technologies: A Homeowner's Guide to Drupal Security

Planet Drupal - 13 October 2017 - 12:00am
A Homeowner's Guide to Drupal Security Working in our Managed Services department, we handle many Drupal 7 and 8 sites - all of which have one thing in common. Despite their different requirements, designs and content - they all need security updates applying and are all in need of some care and attention when it comes to securing them. If a Drupal site was a house: Securi...
Categories: Drupal

Views Reset

New Drupal Modules - 12 October 2017 - 11:55pm

Helps to add simple Reset button in views exposed forms.

Default views comes with reset button that will be standard HTML submit buttons. It will take bit more time to load the view when clicked as it will go through Drupal form submission process. However we just want to get the view loaded without any filtering applied or with just default filter. So, this module helps us to load that view without gong through complex form submission.

Categories: Drupal

Email scheduler

New Drupal Modules - 12 October 2017 - 9:10pm

# Email scheduler version 1.0 #

This modules allows the configure of email notifications based on user roles.

### How do I get this set up? ###

* Install and enable the module as normal
* Select the type that you need to config to send emails (/admin/config/email_scheduler)
* Go to user(/admin/people) or role (/admin/people/permissions/roles) to configure the settings

### Completed ###

Categories: Drupal

Battlelords Sci-Fi RPG Up On Kickstarter

Tabletop Gaming News - 12 October 2017 - 3:00pm
23rd Century Productions is looking to bring you a new edition of Battlelords, the sci-fi RPG set in a future full of intrigue and danger. This will be the 7th edition of the game, originally released in 1990. Be one of 15 different core races and deck your character out with a wide array of […]
Categories: Game Theory & Design

Rotten Plots Card Game Now Available

Tabletop Gaming News - 12 October 2017 - 2:00pm
Have you ever sat around with your friends, watching TV and seen an ad for a new movie that’s coming out and gone, “pfeh. That looks like garbage. I could come up with a better movie idea than that!”? Pretty much all of us have (or some variation of that scenario). Rotten Plots, a new […]
Categories: Game Theory & Design

New Wreck-Age Releases Available From Hyacinth Games

Tabletop Gaming News - 12 October 2017 - 1:00pm
The folks over at Hyacinth Games had their successful Kickstarter not too long ago. Well, they’ve gotten their backer’s minis shipped out, and so now it’s time for the rest of us to get in on the action. You can head over to their webshop now and pick them up. Get your crew on the […]
Categories: Game Theory & Design

Epic Games sues alleged Fortnite cheaters over EULA violations

Social/Online Games - Gamasutra - 12 October 2017 - 12:37pm

One of the two had been previously banned as many as nine times. ...

Categories: Game Theory & Design

Content Access Booster

New Drupal Modules - 12 October 2017 - 12:31pm

Boost large websites using content_access (eventually combined with other access modules like node access node reference or node access user reference

Categories: Drupal


New Drupal Modules - 12 October 2017 - 12:06pm
Categories: Drupal

Corvus Belli Previews Actions in Aristeia

Tabletop Gaming News - 12 October 2017 - 12:00pm
You know, you can’t really have an action-packed game without actions. And Aristeia, the new game coming from Corvus Belli, is said to be action-packed. So, let’s take a look at what type of actions you’ll be packing in there. From the preview: After talking about how rolls work in Aristeia!, the new table top […]
Categories: Game Theory & Design

Menu Formatter

New Drupal Modules - 12 October 2017 - 11:13am


If you would like to render a menu in an entity reference field, this is the module for you!


You must have the menu_ui and entity_reference core modules installed.


* Install as usual as per

-- USAGE --

Categories: Drupal

Thursday Terrain Corner

Tabletop Gaming News - 12 October 2017 - 11:00am
This shortened week is coming to a close. Well, eventually, anyway. Did yesterday seem to take 2 days to anyone else? It started out with, “Woo! It’s Wednesday!” and ended with, “… wait, it’s still Wednesday?!” Ah well, the day did, eventually, end. So now we’re in Thursday. I’ve got my Thursday shirts on to […]
Categories: Game Theory & Design

Fortnite's free-to-play battle royale mode passes 10M players

Social/Online Games - Gamasutra - 12 October 2017 - 10:57am

Epic says it hit 3.7 million daily active users with 525,000 peak concurrent players over the weekend as well. ...

Categories: Game Theory & Design

Discord adds verification for game developer-led servers

Social/Online Games - Gamasutra - 12 October 2017 - 10:22am

The popular chat app now offers developers the option of setting up verified servers to better connect with their communities. ...

Categories: Game Theory & Design

Dungeon Hustle Now Available From WizKids

Tabletop Gaming News - 12 October 2017 - 10:00am
For a while there, it seemed like WizKids had a new game announcement every day. Well, now we’re getting the other half of that, as they’ve got them hitting store shelves. This time around it’s Dungeon Hustle. In the game, players will take on iconic dungeon-delving characters such as fighters, rogues, clerics, or mages and […]
Categories: Game Theory & Design

Texas Creative: Drupal and Wordpress and Joomla, Oh My!

Planet Drupal - 12 October 2017 - 9:32am

Not all CMS are created equal. Before building your next website, here are a few tips on why your CMS choice matters. (Plot twist: as told by an Account Manager.)

Read More
Categories: Drupal

Iocasta Now Available For Arena Rex

Tabletop Gaming News - 12 October 2017 - 9:00am
The gladiator pits are equal-opportunity. Man, woman, beast, all can take to the pits and fight for supremacy. Iocasta left her whole tribe and their way of life in pursuit of something more. What she found was joy in hearing her name shouted while she fights in the arenas. Now, you can add her to […]
Categories: Game Theory & Design


Subscribe to As If Productions aggregator