By Clément Hurel, July 25, 2013
For the past few months we have been working on a module here at Therefore and it is about to emerge from Brocéliande. This is the story of how it came to be.
The Birth of Merlin.
My colleague Sean is a very conscientious guy. He loves creating technical documentation for a project before building anything. One day he asked me if I could do some magic with this documentation. This was the birth of the magician, Merlin.
Arthur’s crew, The Holy Grail and the vacuum
Imagine that Merlin (the magician) was born in our time and he is a website builder for Drupal and he works for a Drupal Shop. Let’s also imagine that his boss is Arthur, the Lady of the Lake is a kind of QA tester, and I guess Percival would be a digital producer.
As she is already a wizard herself, the Lady of the Lake uses Behat to automate testing sites. (If you don’t know about this magic you should really check it out : http://behat.org/
One day Arthur and Percival come to see our mage with plans to build a website for the search of the Holy Grail. What would Merlin do with his powers? After agreeing with Arthur and Percival on the architecture, here are some spells that he might cast:
-BUILD-THE-STUFFUM : With a flick of his wand he would create all site components (content types, fields, etc ...) without having to click once on anything.
-DOC-THE-STUFFUM : With another spell he would create documentation that is consistent with what he just built.
-TEST-THE-STUFFUM : With yet another spell he would create the Behat test suite for the components he previously created (because he always wants to please the Lady of the Lake).
-VACUUM-THE-MESSUM : With one last spell he would clean his house while creating the site. (again, because he always wants to please the Lady of the Lake).
The Merlin module is actually all of these spells combined together in a single Drupal module. Except for the last one unfortunately… Just an aside, I honestly think that if Merlin were alive today he would be a rockstar.
A little explanation of Merlin’s magic:
The module comes with a spreadsheet template. This spreadsheet is where you input your site architecture. In this way we can work out the links between the different components of your future site. This spreadsheet can be filled in quickly, in fact very quickly because we built a lot of shortcuts into the Merlin spreadsheet template to make it easier to build.
DOC-THE-STUFFUM: In addition to serving as a basis for building your website, this document will also serve as technical documentation for the project. Apparently we're not the only ones who think that a spreadsheet like this is REALLY useful (essential?) when architecting a Drupal site: Jody Lynn presented this concept at her session at DrupalCon Austin 2014 (http://youtu.be/kWeJ2lSFRjM?t=14m50s
); and Larry Garfield from Palantir originally posted about this in a blog post: http://www.palantir.net/blog/developing-drupal-sites-plan-or-perish
. For the record, Sean originally developed his spreadsheet completely unaware of the Larry Garfield blog post, and we just happened to be at DrupalCon when Jody Lynn presented her take on it. Further proof that great minds think alike!
Once completed, the spreadsheet just needs to be uploaded to Drupal via the module’s administration page. It will then generate a zip file with all your Behat scenarios.
BUILD-DAT-STUFFUM: The creation of your site components is combined in a single file (building.feature). If you give this file to Behat you should see it build every component of your site one by one. Magic! Don’t forget to configure Behat so that the components are built into the right site.
TEST-DAT-STUFFUM: You will also find a set of test components in the same zip file. Obviously the Lady of the Lake still have work to do on getting accurate BDD tests, but most of the grunt work is already done.
Compendium of future Merlin’s spells.
Unfortunately we are not all as smart as Merlin, but with a little imagination we can imagine some other spells that could really come in handy:
-REVERSE-DAT-STUFFUM: Merlin is able to create our site. Cool. But like any website we might change many things before putting it into production. Documentation is no longer up to date. Well with this spell we could recreate the original spreadsheet with the updated components from the website.
-DISTRIBUTE-DAT-STUFFUM: Create a Drupal distribution where the installation profile uses the spreadsheet to quickly create websites that are ready to go for rapid prototyping and user feedback testing.
In conclusion, Merlin associates Drupal best practices with a little magic. We save time on site building while investing it in information architecture. The result is a better thought-out site, that’s better built, with regression testing, and thorough documentation. Don’t waste time building your site, architect it and let Merlin build it for you!
For more Information
View Clément's presentation at Drupal Camp Toronto 2014 on Merlin - Merlin is a new module built for Drupal 7. From a template spreadsheet, you can automatically build an entire Drupal website. All the content types, fields and other components are built on the target website through an automation process. In addition, Merlin provides automated CRUD tests for all components it builds.
Merlin drupal module on drupal.org - At writing, the module is still in a sandbox environment. An application has been sent to have an official module space.