Developing the Promet Way: Part II
Part I highlighted the challenges of deployments, defined good deployments, and introduced the tools for developing the Promet way. If you haven’t already, you should probably read Part I now.
Part II covers the tools used to set up the framework for developing a Drupal site. These tools download modules, themes, and libraries, place all the pieces in the correct Drupal structure, and create a settings file based on the environment.
What is it?
Drupal Tangler uses Composer to manage dependencies and tangles all of the pieces into the Drupal structure.
Easier code review. Instead of committing module files and having to wade through those changes to find the implementation, adding a module with Drupal Tangler results in two changed files: composer.json and composer.lock. Additionally, only one line is necessary to add a dependency.
Explicit version information. One can see the version of a dependency (including the reference hash) by simply viewing a file in the project root. There is no need to bootstrap Drupal or navigate the module’s .info file to find the version.
Version constraints. Composer allows the setting of version constraints. For example, one can specify to use the latest minor release (e.g. >= 1.2.0 and < 1.3). If a package needs to be pinned to a specific version, this is explicit. Running updates subsequently accounts for version constraints programmatically, and there is no need to manage this manually for every single package when updates are performed.
Easier to update and track updates. Performing updates within defined constraints (see version constraints directly above) is now easy...significantly and amazingly easier than ever. There is no need to cross-reference notes to determine whether or not to update a specific package and no need to manually download a specific package version. Composer manages this. Furthermore, tracking the version changes of packages can be done by looking at the changes in one file; multiple files or notes no longer have to be checked to see which packages were updated.
Drupal Libraries Installer Plugin
What is it?
Drupal Libraries Installer Plugin provides a custom installer to retrieve and place libraries where Drupal wants them.
Easier code review. As with Drupal Tangler and modules, library files are not committed to the project. This eliminates the need to traverse these files to find technical implementation and project specific changes when performing code reviews.
Programmatic retrieval. There is no need to find the library, download the correct version, decompress it, and put the folder in the right spot with the right name.
Version constraints. Since Drupal Tangler uses Composer, constraints can be defined, offering the same advantages as outlined in Drupal Tangler (above).
Easier to update and track updates. Just like Drupal Tangler, performing updates within defined constraints is now as easy as pushing a button.
Drupal Settings Compile
What is it?
Drupal Settings Compile loads configuration from an arbitrary directory on a server instead of templating settings.php or versioning your database configuration.
Automation. The settings.php file is created programmatically, and there is no need to create one from scratch or modify Drupal’s unwieldy default.settings.php.
No need to know PHP. Using Drupal Settings Compile requires only the knowledge of the schema and available tunables, both of which are made explicitly clear in the project’s README.
Easier to set/change items. Since tunables are limited and include only settings changed from default, the configuration remains small and manageable. In comparison, using Drupal’s default.settings.php requires searching over 500 lines for just a few settings.
Accounts for environmental differences. Loading the configuration from an arbitrary directory by nature accounts for environmental differences. Unlike templating or versioning settings.php, there is no need to include logic accounting for differences between environments.
With Drupal Tangler, Drupal Libraries Installer Plugin, and Drupal Settings Compile, all the pieces are now in place to begin development. Gone are the days of locating, downloading, and committing to the repository Drupal core, modules, themes, and libraries. Gone are the days of painstakingly checking requirement constraints to perform updates. Gone are the days of committing a single settings file and implementing overrides on each environment.
Now, all that’s left is to deploy. Watch out for the final installment of Developing the Promet Way, which will cover Drupal Drop Ship - a deployment tool.
In the meantime, checkout the Promet Drupal 7 Framework - a starting point for developing the “Promet way.”
Now you can check out Part III of the series on our blog!