Raw Notes: From Zero to Distribution using Features, Profiler, and Drush Make

Session by Dmitri Gaskin, awesome as always. dmitri01 [at] gmail.com

Features

  • Dmitri is walking us through the creation of a distribution, from installation to distro.
  • Working in Drupal 6.20
  • Building a distro is like any other Drupal site; install core, install modules, but also install Features to package up our configuration.
  • Set up CCK content type with fields, Imagecache presets
  • Feature: collection of components of a Drupal site that are packaged up as a piece of code as opposed to in the database.
  • When you create a feature you select the components that you want to include -- content types, views, imagecache presets, other dependencies. You select what you want to include, then download as a feature.
  • Downloaded feature is a module. Copy downloaded feature into sites/all/modules/ and enable via Features admin.
  • Other things that can be exported with Features: menu items, taxonomy and vocabularies (using a special patch to views), Views, many other modules.
  • A feature is supposed to be a package of functionality; when you export things to a feature such as content types, views, etc, you don't really want to export your whole site to a feature; instead, export isolated packages of functionality.
  • General best practice: take an isolated piece of functionality, e.g. the news functionality of your site, export that as a feature separate from other features. Makes for easy disabling of an entire feature, easy transfer of particular sets of functionality to other sites.
  • Changes made to a feature component within the UI cause the feature to be overridden (a state visible in the Features UI); you can download the feature again, replace the old code, and your feature goes back to the Default state (meaning what's active/showing up on your site is the same as what's in code.)
  • Site performance is faster with Features; 

Drush Make

  • Note: all of this works in Drupal 7
  • Creating the Drush Make file for a site that includes this one feature:
    • call the file {your feature}.make
    • core = 6.x (or what you're using)
    • api = the api you're using
    • projects [] = the modules you need, preferably with specific versions. Example: projects[cck] = 2.9 - standard syntax for modules available on D.o
    • If you want to specify what subdirectories of sites/all included projects go into (e.g. contrib, features), you can use the longer projects[$module][version] = $version to specifry version and projects[$module][subdir] = $subdir
    • include project[] = drupal too for core
    • For a project that's not on D.o, like your feature = projects[news_items][type] = module, projects[news_items}[download][type] = get, projects[news_items][download][url] = http://url_for_your_feature
    • Specify patches: projects[$module][patch][] = http://$url_of_patch
    • Comments in drush make files start with "; " at beginning of line
    • include URL for issue from which you got the patch so people using your make file know where you got the patch from
  • Recommends using Drush Make 2.1
  • Run "drush make your.make target_directory"
  • drush make-generate = automatically generates a make file from your Drupal site, but there's a bug in this that will be fixed soon.

Profiler

  • dgo.to/profiler, documentation in module itself, viewable through git.drupal.org
  • Easy way to create an entire installation profile
  • Distribution vs profile: install profile is just the code that runs on the initial installation of Drupal core. Distribution is the installation profile PLUS all the dependent modules for your site.
  • create folder with your drush make file, $yourname.profile and $yourname.info; contents of each can be found in Profiler documentaiton
  • $yourname.info
    • name = Your distro name
    • description = Your description
    • dependencies[] = $your_feature (when you enable the feature, it enables all of ITS dependencies)
    • theme = $your theme
  • Check out Profiler documentation for libraries[profiler][download] info that needs to be added to your drush make file
  • Bundle up your distribution into a .tgz, then create an overarching $yourdistro.make file for the whole thing with core, api, projects including drupal, profile, project[$yourdistro][download]etc to specify where your feature is (or features are)
  • After you run drush make on the overarching distro make file, when you run it for your new site you'll see a new installation profile option for your distro that you can include to install your new site
  • For exporting Blocks you can use Context module

Add new comment