Your SlideShare is downloading. ×
Automating Drupal Development: Makefiles, Features and Beyond     Antonio De Marco      Andrea Pescetti               http:...
Nuvole: Our Team BELGIUM     ITALY  Brussels   Parma
Clients in Europe and USA
Working with Drupal Distributions
Serving International
Serving International
Trainings on Code Driven
Automating Drupal        Development1. Automating code retrieval2. Automating installation3. Automating site configuration4...
1Automating code retrieval
Drupal site building blocks
Core      ModulesContributed, Custom,       Themes       External      Libraries  Installation       Profile           Drup...
drupal.org                 github.com             example.com
The best way to download      Introducing Drush Make
Drush MakeDrush make is a Drush command thatcan create a ready-to-use Drupal site,pulling sources from variouslocations. I...
Drush Make‣   A single .info file to describe    modules, dependencies and    patches‣   A one-line command to download    ...
Drush Make can download
Minimal makefile: core only; distro.make; Usage:; $ drush make distro.make [directory];api = 2core = 7.xprojects[drupal][ty...
Minimal makefile: core only$ drush make distro.make myprojectdrupal-7.7 downloaded.$ ls -al myproject-rw-r--r--    1   adem...
Downloading a module; views.make; Usage:; $ drush make views.make --no-core .;api = 2core = 7.xprojects[views][subdir] = c...
Downloading a module$ drush make views.make --no-core .views-7.x-3.1 downloaded.$ ls -al sites/all/modules/contrib/views/t...
Drush Make can apply
Applying patches; distro.make; Usage:; $ drush make distro.make [directory];api = 2core = 7.xprojects[drupal][type] = core...
Applying patches$ drush make distro.make myprojectdrupal-7.7 downloaded.drupal patched with 911354.43.patch.drupal patched...
Drush Make supports
flexslider / flexslider.make; Flex Sliderapi = 2core = 7.xlibraries[flexslider][download][type] = "get"libraries[flexslider]...
Downloading flexslider; flexslider-module.make; Usage:; $ drush make flexslider-module.make --no-core .;api = 2core = 7.xpr...
Recursive makefile parsing$ drush make flexslider-module.make --no-core .Project flexslider contains 4 modules: flexslider_...
Drush Make supports
Including an external makefile; distro.make;; $ drush make buildkit.make [directory];api = 2core = 7.x; Include Build Kit d...
Build KitExtendable distribution, reusable .make file
Including Build Kit module set;; myproject.make;api = 2core = 7.x; Include Build Kit install profile makefile via URLinclu...
Build Kit: A closer lookDemonstrating makefile inclusion and recursion.
Build Kit provides 2 make‣   distro.make: Drupal core with possible core    patches and a link to download drupal-org.make...
Build Kit: full content$ git clone --branch 7.x-2.x http://git.drupal.org/project/buildkit.git...$ ls -al buildkit/total 4...
buildkit / distro.makeapi = 2core = 7.xprojects[drupal][type] = coreprojects[drupal][version] = "7.14"; Use vocabulary mac...
Your project: 2 make files‣   distro.make: Drupal core with possible core    patches and a link to download myproject.make‣...
drush make distro.make
Found myproject.makedrush make distro.make
Found myproject.makedrush make distro.make
Run myproject.makeFound myproject.makedrush make distro.make
Run myproject.makeFound myproject.makedrush make distro.make
2Automating installation
Installation Profile
Installation profile components$ tree myproject-profilemyproject-profile!"" README.txt!"" distro.make!"" drushrc.php!"" myp...
Profiles: just likemodules ‣   An .info file to specify installation     dependencies ‣   An .install file to perform     ins...
myproject.infoname = Myprojectcore = 7.xdescription = Myproject installation profile.; Coredependencies[] = bookdependenci...
myproject.profile/**  * Implements hook_install()  */function myproject_install() {   // Enable custom theme   theme_enable...
myproject.profile/** * Implements hook_form_FORM_ID_alter(). */function myproject_form_install_configure_form_alter(&$form,...
myproject.install/**  * Implements hook_install_tasks()  */function myproject_install_tasks() {   return array(      mypro...
myproject.install/** * Implements hook_install_tasks() callback */function myproject_create_terms() {  $terms = array();  ...
Introducing Drush Bake          A Drush command by Nuvoleto create installation profiles based on templates
Installation profile template$ git clone git.nuvole.org:/var/git/starter-profile.git...$ tree starter-profilestarter-profil...
Template distro.make$ cat starter-profile/distro.makeapi = 2core = 7.x; Include Build Kit distro makefile via URLincludes[...
Template starter.make (aka                 myproject.make)$ cat starter-profile/starter.makeapi = 2core = 7.x; Build Kit =...
Template starter.install (aka             myproject.install)$ cat starter-profile/starter.install<?php/**  * Implements ho...
Generating a new installation profile $ drush bake starter-profile/distro.make myproject
Generating a new installation profile$ # Create new installation profile starting from starter-profile template$ drush bake...
Generated distro.make$ cat myproject-profile/distro.makeapi = 2core = 7.xprojects[drupal][type] = coreprojects[drupal][ver...
Full bootstrap$ # Push profile folder to Nuvole server following internal conventions$ git nuvole myproject-profile$ # Bui...
Bootstrap your project in 3 steps$ drush bake starter-profile/distro.make myproject$ git nuvole myproject-profile$ drush m...
3Automating site configuration
FeaturesThe best way to package configuration
What is a feature?‣   A collection of Drupal elements    which taken together satisfy a    certain use-case.‣   A modular ...
Configuration in Database
Configuration in Database
Packaged as Features
Packaged as Features
Creating a Feature
It’s all in the feature’s .info         Features are Modules
core = "7.x"description = "Core feature, stuff we need all the time."dependencies[] = "colorbox"dependencies[] = "ds"depen...
A feature can have a .make     Drush Make operates recursively
api = 2core = 7.x; Modules =====================================================================projects[colorbox][subdir]...
How to download yourprojects from any custom
$ cat starter-profile/starter.makeapi = 2core = 7.x; Build Kit ===========================================================...
Introducing FeatureKeep features, themes, makefiles, etc... organized.
$ cat starter-profile/starter.makeapi = 2core = 7.x; Build Kit ===========================================================...
Feature Server and Drush$ # Drush goodies$ drush | grep fserver fserver-distro          Update packaging for a distributio...
4Automating tests
Dont depend on trust  Automatically test every component
Meet ContinuousUse Hudson/Jenkins to automatically test: 1. Makefile 2. Installation 3. Configuration
Building a CI Job‣   Create a job for testing your site‣   Triggered:    ‣   Manually    ‣   Scheduled    ‣   By events (g...
Test #1: Makefile‣   Clone your code from git‣   Run drush make‣   Test that the profile is downloaded‣   Test that modules ...
Test #1: Shell commands‣   drush -y --pipe make distro.make‣   test -d profiles/myproject‣   test -d profiles/myproject/modu...
Test #2: Installation‣   Triggered by successful completion of Test #1‣   Run drush site-install:    drush -y site-install...
Test #3: Configuration‣   Triggered by successful completion of Test #2‣   Relies on simpletest‣   Run drush test-run‣   Ex...
Thank You.More on Code-Driven Development http://nuvole.org/blog http://nuvole.org/trainings
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Automating Drupal Development: Makefiles, features and beyond
Upcoming SlideShare
Loading in...5
×

Automating Drupal Development: Makefiles, features and beyond

8,742

Published on

Published in: Technology
1 Comment
17 Likes
Statistics
Notes
No Downloads
Views
Total Views
8,742
On Slideshare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
0
Comments
1
Likes
17
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • [Each of them lives in separate domains and can be shipped in different forms]\n
  • \n
  • \n
  • \n
  • Clear upgrade path [easy to make assumptions on configuration state]\nClean installation procedure [produce a &amp;#x201C;vanilla&amp;#x201D; database]\n
  • Clear upgrade path [easy to make assumptions on configuration state]\nClean installation procedure [produce a &amp;#x201C;vanilla&amp;#x201D; database]\n
  • \n
  • Illustrate make file: core directive, drupal version and core patches.\nthis only downloads drupal core, where is our distribution?\n
  • \n
  • Illustrate make file: core directive, drupal version and core patches.\nthis only downloads drupal core, where is our distribution?\n
  • \n
  • \n
  • Illustrate make file: core directive, drupal version and core patches.\nthis only downloads drupal core, where is our distribution?\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Illustrate make file: core directive, drupal version and core patches.\nthis only downloads drupal core, where is our distribution?\n
  • \n
  • \n
  • Illustrate make file: core directive, drupal version and core patches.\nthis only downloads drupal core, where is our distribution?\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Clear upgrade path [easy to make assumptions on configuration state]\nClean installation procedure [produce a &amp;#x201C;vanilla&amp;#x201D; database]\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Clear upgrade path [easy to make assumptions on configuration state]\nClean installation procedure [produce a &amp;#x201C;vanilla&amp;#x201D; database]\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript of "Automating Drupal Development: Makefiles, features and beyond"

    1. 1. Automating Drupal Development: Makefiles, Features and Beyond Antonio De Marco Andrea Pescetti http://nuvole.org @nuvoleweb
    2. 2. Nuvole: Our Team BELGIUM ITALY Brussels Parma
    3. 3. Clients in Europe and USA
    4. 4. Working with Drupal Distributions
    5. 5. Serving International
    6. 6. Serving International
    7. 7. Trainings on Code Driven
    8. 8. Automating Drupal Development1. Automating code retrieval2. Automating installation3. Automating site configuration4. Automating tests
    9. 9. 1Automating code retrieval
    10. 10. Drupal site building blocks
    11. 11. Core ModulesContributed, Custom, Themes External Libraries Installation Profile Drupal site building blocks
    12. 12. drupal.org github.com example.com
    13. 13. The best way to download Introducing Drush Make
    14. 14. Drush MakeDrush make is a Drush command thatcan create a ready-to-use Drupal site,pulling sources from variouslocations. In practical terms, thismeans that it is possible to distributea complicated Drupal distribution as asingle text file.
    15. 15. Drush Make‣ A single .info file to describe modules, dependencies and patches‣ A one-line command to download contributed and custom code: libraries, modules, themes, etc...
    16. 16. Drush Make can download
    17. 17. Minimal makefile: core only; distro.make; Usage:; $ drush make distro.make [directory];api = 2core = 7.xprojects[drupal][type] = coreprojects[drupal][version] = "7.7"
    18. 18. Minimal makefile: core only$ drush make distro.make myprojectdrupal-7.7 downloaded.$ ls -al myproject-rw-r--r-- 1 ademarco staff 174 May 16 20:04 .gitignoredrwxr-xr-x 49 ademarco staff 1666 May 16 20:04 includes/-rw-r--r-- 1 ademarco staff 529 May 16 20:04 index.php-rw-r--r-- 1 ademarco staff 688 May 16 20:04 install.phpdrwxr-xr-x 70 ademarco staff 2380 May 16 20:04 misc/drwxr-xr-x 43 ademarco staff 1462 May 16 20:04 modules/drwxr-xr-x 6 ademarco staff 204 May 28 13:28 profiles/-rw-r--r-- 1 ademarco staff 1561 May 16 20:04 robots.txtdrwxr-xr-x 13 ademarco staff 442 May 16 20:04 scripts/drwxr-xr-x 5 ademarco staff 170 May 16 20:04 sites/drwxr-xr-x 8 ademarco staff 272 May 16 20:04 themes/-rw-r--r-- 1 ademarco staff 19338 May 16 20:04 update.php-rw-r--r-- 1 ademarco staff 2051 May 16 20:04 web.config-rw-r--r-- 1 ademarco staff 417 May 16 20:04 xmlrpc.php
    19. 19. Downloading a module; views.make; Usage:; $ drush make views.make --no-core .;api = 2core = 7.xprojects[views][subdir] = contribprojects[views][version] = 3.1
    20. 20. Downloading a module$ drush make views.make --no-core .views-7.x-3.1 downloaded.$ ls -al sites/all/modules/contrib/views/total 64...-rw-r--r-- 1 ademarco staff 16067 May 28 13:28 views.info-rw-r--r-- 1 ademarco staff 20358 May 28 13:28 views.install-rw-r--r-- 1 ademarco staff 78204 May 28 13:28 views.module...
    21. 21. Drush Make can apply
    22. 22. Applying patches; distro.make; Usage:; $ drush make distro.make [directory];api = 2core = 7.xprojects[drupal][type] = coreprojects[drupal][version] = "7.7"; Make system directories configurable to allow tests in profiles/[name]/modules; http://drupal.org/node/911354projects[drupal][patch][911354] = http://drupal.org/files/issues/911354.43.patch; Missing drupal_alter() for text formats and filters; http://drupal.org/node/903730projects[drupal][patch][903730] = http://drupal.org/files/issues/drupal.filter-al...
    23. 23. Applying patches$ drush make distro.make myprojectdrupal-7.7 downloaded.drupal patched with 911354.43.patch.drupal patched with drupal.filter-alter.82.patch.drupal patched with 995156-5_portable_taxonomy_permissions.patch.Generated PATCHES.txt file for drupal
    24. 24. Drush Make supports
    25. 25. flexslider / flexslider.make; Flex Sliderapi = 2core = 7.xlibraries[flexslider][download][type] = "get"libraries[flexslider][download][url] = "https://github.com/.../zipball/master"libraries[flexslider][directory_name] = "flexslider"libraries[flexslider][type] = "library"
    26. 26. Downloading flexslider; flexslider-module.make; Usage:; $ drush make flexslider-module.make --no-core .;api = 2core = 7.xprojects[flexslider][subdir] = contrib
    27. 27. Recursive makefile parsing$ drush make flexslider-module.make --no-core .Project flexslider contains 4 modules: flexslider_views_slideshow,flexslider_views, flexslider_fields, flexslider.flexslider-7.x-1.0-rc3 downloaded.Found makefile: flexslider.makeflexslider downloaded from https://github.com/.../zipball/master.$ tree -l sites/all/sites/all/!"" libraries#   %"" flexslider...%"" modules %"" contrib %"" flexslider...
    28. 28. Drush Make supports
    29. 29. Including an external makefile; distro.make;; $ drush make buildkit.make [directory];api = 2core = 7.x; Include Build Kit distro makefile via URLincludes[] = http://drupalcode.org/project/buildkit.git/../7.x-2.x:/distro.make
    30. 30. Build KitExtendable distribution, reusable .make file
    31. 31. Including Build Kit module set;; myproject.make;api = 2core = 7.x; Include Build Kit install profile makefile via URLincludes[] = http://drupalcode.org/project/buildkit.git/../drupal-org.make; Modules ====================================================================projects[views_bulk_operations][subdir] = contribprojects[coffee][subdir] = contrib
    32. 32. Build Kit: A closer lookDemonstrating makefile inclusion and recursion.
    33. 33. Build Kit provides 2 make‣ distro.make: Drupal core with possible core patches and a link to download drupal-org.make‣ drupal-org.make: a selection of common modules from drupal.org
    34. 34. Build Kit: full content$ git clone --branch 7.x-2.x http://git.drupal.org/project/buildkit.git...$ ls -al buildkit/total 48drwxr-xr-x 9 ademarco staff 306 Jun 14 15:45 .drwxrwxr-x@ 20 ademarco staff 680 Jun 14 15:45 ..drwxr-xr-x 13 ademarco staff 442 Jun 14 15:45 .git-rw-r--r-- 1 ademarco staff 3868 Jun 14 15:45 README.txt-rw-r--r-- 1 ademarco staff 583 Jun 14 15:45 buildkit.info-rw-r--r-- 1 ademarco staff 151 Jun 14 15:45 buildkit.install-rw-r--r-- 1 ademarco staff 6 Jun 14 15:45 buildkit.profile-rw-r--r-- 1 ademarco staff 849 Jun 14 15:45 distro.make-rw-r--r-- 1 ademarco staff 902 Jun 14 15:45 drupal-org.make
    35. 35. buildkit / distro.makeapi = 2core = 7.xprojects[drupal][type] = coreprojects[drupal][version] = "7.14"; Use vocabulary machine name for permissions; http://drupal.org/node/995156projects[drupal][patch][995156] = http://drupal.org/files/issues/995156-5_portabprojects[buildkit][type] = profileprojects[buildkit][download][type] = gitprojects[buildkit][download][url] = http://git.drupal.org/project/buildkit.gitprojects[buildkit][download][branch] = 7.x-2.x
    36. 36. Your project: 2 make files‣ distro.make: Drupal core with possible core patches and a link to download myproject.make‣ myproject.make: includes BuildKit’s drupal-org.make plus project-specific modules and themes
    37. 37. drush make distro.make
    38. 38. Found myproject.makedrush make distro.make
    39. 39. Found myproject.makedrush make distro.make
    40. 40. Run myproject.makeFound myproject.makedrush make distro.make
    41. 41. Run myproject.makeFound myproject.makedrush make distro.make
    42. 42. 2Automating installation
    43. 43. Installation Profile
    44. 44. Installation profile components$ tree myproject-profilemyproject-profile!"" README.txt!"" distro.make!"" drushrc.php!"" myproject.info!"" myproject.install!"" myproject.make%"" myproject.profile
    45. 45. Profiles: just likemodules ‣ An .info file to specify installation dependencies ‣ An .install file to perform installation tasks and upgrades ‣ Fully customizable via .profile files ‣ Can include makefiles and other stuff
    46. 46. myproject.infoname = Myprojectcore = 7.xdescription = Myproject installation profile.; Coredependencies[] = bookdependencies[] = field_uidependencies[] = file...; Contribdependencies[] = admindependencies[] = colorboxdependencies[] = ds...; Featuresdependencies[] = myproject_coredependencies[] = myproject_blog
    47. 47. myproject.profile/** * Implements hook_install() */function myproject_install() { // Enable custom theme theme_enable(array(custom_theme)); variable_set(theme_default, custom_theme);}
    48. 48. myproject.profile/** * Implements hook_form_FORM_ID_alter(). */function myproject_form_install_configure_form_alter(&$form, $form_state) { $form[site_information][site_name] [#default_value] = Drupalissimo; $form[site_information] [site_mail][#default_value] = info@drupalissimo.com; $form[admin_account][account] [name][#default_value] = admin; $form[admin_account][account] [mail][#default_value] = dev@nuvole.org; $form[update_notifications] [update_status_module][#default_value] = array(1 => FALSE, 2 => FALSE}
    49. 49. myproject.install/** * Implements hook_install_tasks() */function myproject_install_tasks() { return array( myproject_create_terms => array( display_name => st(Create taxonomy terms), ), ... );}
    50. 50. myproject.install/** * Implements hook_install_tasks() callback */function myproject_create_terms() { $terms = array(); $vocabulary = taxonomy_vocabulary_machine_name_load(category); $terms[] = Solution; $terms[] = Client; $terms[] = Use case; foreach ($terms as $name) { $term = new stdClass(); $term->vid = $vocabulary->vid; $term->name = $name; taxonomy_term_save($term); }}
    51. 51. Introducing Drush Bake A Drush command by Nuvoleto create installation profiles based on templates
    52. 52. Installation profile template$ git clone git.nuvole.org:/var/git/starter-profile.git...$ tree starter-profilestarter-profile/!"" README.txt!"" distro.make!"" drushrc.php!"" starter.info!"" starter.install!"" starter.make%"" starter.profile
    53. 53. Template distro.make$ cat starter-profile/distro.makeapi = 2core = 7.x; Include Build Kit distro makefile via URLincludes[] = http://drupalcode.org/project/buildkit.git/blob_plain/refs/heads/7.xprojects[starter][type] = profileprojects[starter][download][type] = gitprojects[starter][download][url] = git.nuvole.org:/var/git/starter-profile.git
    54. 54. Template starter.make (aka myproject.make)$ cat starter-profile/starter.makeapi = 2core = 7.x; Build Kit ===================================================================includes[] = http://drupalcode.org/project/buildkit.git/.../drupal-org.make; Modules =====================================================================projects[coffee][subdir] = contrib...projects[twist][type] = themeprojects[twist][download][type] = gitprojects[twist][download][url] = git.nuvole.org:/var/git/twist.git
    55. 55. Template starter.install (aka myproject.install)$ cat starter-profile/starter.install<?php/** * Implements hook_install(). */function starter_install() { theme_enable(array(twist)); variable_set(theme_default, twist);}
    56. 56. Generating a new installation profile $ drush bake starter-profile/distro.make myproject
    57. 57. Generating a new installation profile$ # Create new installation profile starting from starter-profile template$ drush bake starter-profile/distro.make myproject...$ tree myproject-profilemyproject-profile!"" README.txt!"" distro.make!"" drushrc.php!"" myproject.info!"" myproject.install!"" myproject.make%"" myproject.profile
    58. 58. Generated distro.make$ cat myproject-profile/distro.makeapi = 2core = 7.xprojects[drupal][type] = coreprojects[drupal][version] = "7.12"; Make system directories configurable to allow tests in profiles/[name]/modules; http://drupal.org/node/911354projects[drupal][patch][911354] = http://drupal.org/files/issues/911354.43.patch...projects[myproject][type] = profileprojects[myproject][download][type] = gitprojects[myproject][download][url] = git.nuvole.org:/var/git/myproject-profile.gi
    59. 59. Full bootstrap$ # Push profile folder to Nuvole server following internal conventions$ git nuvole myproject-profile$ # Build the project$ drush make myproject-profile/distro.make myprojectdrupal-7.12 downloaded. [ok]drupal patched with 911354.43.patch. [ok]drupal patched with drupal.filter-alter.82.patch. [ok]drupal patched with 995156-5_portable_taxonomy_permissions.patch. [ok]Generated PATCHES.txt file for drupal [ok]myproject cloned from git.nuvole.org:/var/git/myproject-profile.git.[ok]Found makefile: myproject.make [ok]libraries-7.x-1.0 downloaded. [ok]rubik-7.x-4.0-beta7 downloaded. [ok]twist cloned from git.nuvole.org:/var/git/twist.git. [ok]feature_core cloned from git.nuvole.org:/var/git/feature_core.git. [ok]Found makefile: feature_core.make [ok]...
    60. 60. Bootstrap your project in 3 steps$ drush bake starter-profile/distro.make myproject$ git nuvole myproject-profile$ drush make myproject-profile/distro.make myproject
    61. 61. 3Automating site configuration
    62. 62. FeaturesThe best way to package configuration
    63. 63. What is a feature?‣ A collection of Drupal elements which taken together satisfy a certain use-case.‣ A modular piece of functionality for a Drupal site.‣ A way to export configuration into PHP code, in the form of a module.‣ http://drupal.org/project/features
    64. 64. Configuration in Database
    65. 65. Configuration in Database
    66. 66. Packaged as Features
    67. 67. Packaged as Features
    68. 68. Creating a Feature
    69. 69. It’s all in the feature’s .info Features are Modules
    70. 70. core = "7.x"description = "Core feature, stuff we need all the time."dependencies[] = "colorbox"dependencies[] = "ds"dependencies[] = "features"dependencies[] = "insert"dependencies[] = "markdown"dependencies[] = "menu"dependencies[] = "pathauto"dependencies[] = "strongarm"dependencies[] = "token"features[ctools][] = "ds:ds:1"features[ctools][] = "strongarm:strongarm:1"features[ds_view_modes][] = "core_small_teaser"features[filter][] = "core_rich_text"features[menu_custom][] = "main-menu"features[menu_links][] = "main-menu:<front>"features[user_permission][] = "access content"features[user_permission][] = "use text format core_rich_text"features[variable][] = "admin_toolbar"features[variable][] = "date_format_long"...
    71. 71. A feature can have a .make Drush Make operates recursively
    72. 72. api = 2core = 7.x; Modules =====================================================================projects[colorbox][subdir] = contribprojects[colorbox][version] = 1.0-beta4projects[insert][subdir] = contribprojects[insert][version] = 1.1; Libraries ===================================================================libraries[colorbox_library][download][type] = "get"libraries[colorbox_library][download][url] = "http://colorpowered.com/colorbox/libraries[colorbox_library][directory_name] = "colorbox"libraries[colorbox_library][destination] = "libraries" feature_core.mak A feature can specify where to find its own dependencies
    73. 73. How to download yourprojects from any custom
    74. 74. $ cat starter-profile/starter.makeapi = 2core = 7.x; Build Kit ===================================================================includes[] = http://drupalcode.org/project/buildkit.git/blob_plain/refs/heads/7.x; Modules =====================================================================projects[libraries][subdir] = contribprojects[libraries][version] = 1.0; Features ====================================================================projects[feature_core][type] = moduleprojects[feature_core][subdir] = featuresprojects[feature_core][download][type] = "git"projects[feature_core][download][url] = git.nuvole.org:/var/git/feature_core.git; Themes ======================================================================projects[twist][type] = themeprojects[twist][download][type] = gitprojects[twist][download][url] = git.nuvole.org:/var/git/twist.git
    75. 75. Introducing FeatureKeep features, themes, makefiles, etc... organized.
    76. 76. $ cat starter-profile/starter.makeapi = 2core = 7.x; Build Kit ===================================================================includes[] = http://drupalcode.org/project/buildkit.git/blob_plain/refs/heads/7.x-; Modules =====================================================================projects[libraries][subdir] = contribprojects[libraries][version] = 1.0; Features ====================================================================projects[feature_core][subdir] = featuresprojects[feature_core][location] = http://fserver.nuvole.org/fserver; Themes ======================================================================projects[twist][type] = themeprojects[twist][location] = http://fserver.nuvole.org/fserver
    77. 77. Feature Server and Drush$ # Drush goodies$ drush | grep fserver fserver-distro Update packaging for a distribution. fserver-package Update packaging for a project. fserver-status Determine the packaging status of a project.$ # Build releases for feature_news based on GIT tags and branches$ drush fserver-package feature_news$ # Check releases status$ drush fserver-statusMethod Project New tagsgit Feature News 7.x-1.0git Feature Pages 7.x-1.0...
    78. 78. 4Automating tests
    79. 79. Dont depend on trust Automatically test every component
    80. 80. Meet ContinuousUse Hudson/Jenkins to automatically test: 1. Makefile 2. Installation 3. Configuration
    81. 81. Building a CI Job‣ Create a job for testing your site‣ Triggered: ‣ Manually ‣ Scheduled ‣ By events (git push or other jobs)‣ A job can consist of ant scripts or simple shell commands (including drush)
    82. 82. Test #1: Makefile‣ Clone your code from git‣ Run drush make‣ Test that the profile is downloaded‣ Test that modules are placed in the expected folders
    83. 83. Test #1: Shell commands‣ drush -y --pipe make distro.make‣ test -d profiles/myproject‣ test -d profiles/myproject/modules/contrib‣ test -d profiles/myproject/modules/custom‣ test -d profiles/myproject/modules/features
    84. 84. Test #2: Installation‣ Triggered by successful completion of Test #1‣ Run drush site-install: drush -y site-install ... myproject‣ Expect successful completion
    85. 85. Test #3: Configuration‣ Triggered by successful completion of Test #2‣ Relies on simpletest‣ Run drush test-run‣ Expect successful completion
    86. 86. Thank You.More on Code-Driven Development http://nuvole.org/blog http://nuvole.org/trainings

    ×