BADCamp Sprinting Success Story : Drush make files support YAML

Jonathan Hedstrom, Software Architect
#Drupal | Posted

After a very successful drush code-sprint at BADCamp 2014, drush make now supports YAML format!

Instead of the old INI format

  1. api = 2
  2.  
  3. ; Set contrib directory.
  4. defaults[projects][subdir] = "contrib"
  5.  
  6. core = "7.x"
  7. projects[drupal][type] = "core"
  8. projects[drupal][version] = "7.32"
  9. ; Remove scary ajax error when autocomplete terminates: https://www.drupal.org/node/1232416#comment-8748879
  10. projects[drupal][patch][] = "https://www.drupal.org/files/issues/D7-fix_autocomplete_terminated_error-1232416-179-do-not-test.patch"
  11. ; Ensure plain text fields evaluate line breaks.
  12. projects[drupal][patch][] = "http://drupal.org/files/text-plain-1152216-24.patch"
  13.  
  14. projects[addressfield][version] = "1.0-beta5"
  15.  
  16. projects[addressfield_tokens][version] = "1.4"
  17.  
  18. projects[admin_views][version] = "1.3"
  19.  
  20. projects[field_collection][version] = "1.0-beta7"
  21. ; Field collections are ownerless https://drupal.org/node/1954124
  22. projects[field_collection][patch][] = "https://drupal.org/files/issues/field_collection-ownerless_fields-1954124-23.patch"
  23. ; Fixes fatal error in migrate code: https://www.drupal.org/node/2315921#comment-9028779
  24. projects[field_collection][patch][] = "https://www.drupal.org/files/issues/migrate-fatal-error-2315921-01.patch"

YAML can be used with the latest version of Drush 7:

  1. api: 2
  2.  
  3. # Set contrib directory.
  4. defaults:
  5.   projects:
  6.   subdir: "contrib"
  7. core: "7.x"
  8. projects:
  9.   drupal:
  10.   type: "core"
  11.   version: "7.33"
  12.   patch:
  13. # Remove scary ajax error when autocomplete terminates: https://www.drupal.org/node/1232416#comment-8748879
  14. - "https://www.drupal.org/files/issues/D7-fix_autocomplete_terminated_error-1232416-179-do-not-test.patch"
  15. # Ensure plain text fields evaluate line breaks.
  16. - "http://drupal.org/files/text-plain-1152216-24.patch"
  17.  
  18.   addressfield: "1.0-beta5"
  19.   addressfield_tokens: "1.4"
  20.   admin_views: "1.3"
  21.   field_collection:
  22.   version: "1.0-beta7"
  23.   patch:
  24. # Field collections are ownerless https://drupal.org/node/1954124
  25. - "https://drupal.org/files/issues/field_collection-ownerless_fields-1954124-23.patch"
  26. # Fixes fatal error in migrate code: https://www.drupal.org/node/2315921#comment-9028779
  27. - "https://www.drupal.org/files/issues/migrate-fatal-error-2315921-01.patch"

Included .make files whether local, or discovered recursively within downloaded projects, can be in either YAML of INI format.

In order to use the newly-supported YAML format, simply name files with a .yml extension, such as my_project.make.yml.

The best part? This can be used now! Even though YAML files are mostly a new concept for Drupal 8, drush make will parse YAML make files for Drupal 7, and even Drupal 6.

Jonathan Hedstrom

Jonathan Hedstrom

Software Architect