Skip to content

Refactor builders and deployers

A really big refactor required to make builders and deployers more extensible and avoid repeating lots of code. I have used a lot of interface composition, to be able to create more specialized abstract classes by simply implementing a set of interfaces.

Now it's really easy to create a command to be executed on a shell, and we can create more commands or even modules without having to repeat the same code.

Some hints:

Interfaces:

  • AsyncTaskPluginInterface: Interface for plugins that execute any generic asynchronous task.
  • ReleaseBasedAsyncTaskPluginInterface: Interface for plugins that execute an async task based on releases.

Abstract Classes:

  • AsyncTaskPluginBase: Base class for plugins that execute any generic asynchronous task.
  • ConfigurableAsyncTaskPluginBase: Base class for plugins that execute a configurable asynchronous task. The main difference with Drupal\static_suite\Plugin\AsyncTaskPluginBase is that a configurable task can have several parameters externally configured, and can be configured to be synchronously run even when run from a web-server.
  • ConfigurableDrushAsyncTaskPluginBase: Base class for plugins that execute a configurable asynchronous drush task. Drush commands have special requirements when being forked, since WebMozart, a Drupal dependency, throws an error if no HOME nor PATH is defined. This base class ensures both environment variables are defined.
  • ReleaseBasedConfigurableDrushAsyncTaskPluginBase: Base class for plugins that execute a configurable Drush async task based on releases.

Traits:

  • BenchmarkTrait: Methods for measuring the performance of a process.

PS: not all possible refactors have been done. The rest of it will be done in alpha 6.

StaticDeployerPluginBase.diagram

StaticBuilderPluginBase.diagram

Merge request reports

Loading