Type drush topic rebuild-example to see an example rebuild.info file.
A few things to note:
- The
rebuild.infofile is written using the INI syntax and follows the same conventions as a standard Drupal.infofile. - In general, "1" should be used to denote TRUE and "0" should be used to denote FALSE
- In most cases, options for different commands like sql-sync and rsync follow the same conventions as their drush counter parts. So when in doubt, type "drush help sql-sync" to find out what valid options you can use in the
sql_syncsection.
Rebuilding from a remote source
This example is valid for cases where you want to rebuild from a remote source.
;
; # REBUILD MANIFEST #
;
; Sql-sync and rsync example.
;
; DESCRIPTION
;
; Enter a description of what your rebuild file does.
description = "Rebuilds local development environment from remote destination"The description key lets you add a string that will be displayed to users who rebuild their local environment using the rebuild file. The description is optional.
; VERSION
;
; Optional - specify a version of your rebuild script
version = 1.0The version key lets you specify a version of your info file. Useful for debugging with co-workers.
; DEFAULT SOURCE
;
; Define the default source for a sql-sync. Not valid for site-install rebuild.
default_source = @example.prodDrush Rebuild lets you rebuild your local environment based on any source defined in your drush alias, so you could rebuild based on @staging, @qa, or @production aliases for example. But more often than not, you want your local development environment to match one remote environment. By defining default_source you can save yourself some typing. You'll be able to run drush rebuild @example.local instead of drush rebuild @example.local --source=@example.prod
; SQL SYNC
;
; Define options for database sync
sql_sync[create-db] = TRUE
sql_sync[sanitize] = sanitize-email
sql_sync[structure-tables-key] = commonThe sql_sync section lets you define options for syncing a remote database to your local environment. If you just wanted database syncing without any additional options, you could write:
sql_sync = 1
; RSYNC
;
; Define options for rsync
; Either specify rsync[files_only] = 1, or define a list of rsync options
; to pass to drush.
rsync[files_only] = 1
; rsync[exclude] = .htaccessAs of Drush Rebuild version 1.2, rsync is not fully supported. But the option above (files_only) works just fine. This will rsync the files from your remote environment (what is in sites/default/files) to your local environment. Use with caution for large sites.
In the future, all the options supported by drush rsync will be supported by Drush Rebuild.
; VARIABLES
;
; Define variables to be set
variables[preprocess_js] = 0
variables[preprocess_css] = 0
; Note that %email will load the variable specified in your drush alias
; under array('rebuild' => 'email')
variables[reroute_email_address] = %emailThe variables section is pretty straightforward - use the name of the variable and assign it a value.
In the code above, note that you can use placeholders. This requires a correctly configured Drush alias.
; USER LOGIN
;
; Specify if user should be logged in after running rebuild
uli = 1
;If the value is set to 1, Drush Rebuild will open your browser and log you into the site after the rebuild completes successfully. Set to 0, or don't include this in your rebuild.info file, if you don't want that behavior.
; MODULES
;
; Modules to enable
modules_enable[] = devel
modules_enable[] = devel_node_access
; Modules to disable
modules_disable[] = overlayDefine modules that you want to enable or disable.
; DRUSH SCRIPTS
;
; Specify any PHP scripts that should be executed during the rebuild process.
; The scripts will be executed using drush php-eval. pre_process files will be
; evaluated before drush rebuild does anything; post_process will be evaluated
; at the end of the rebuild process. The files must be in the same directory
; as your rebuild.info file.
pre_process = example.php
post_process = after_rebuild.phpThis section is also straightforward. Note that if your pre_process or post_process script returns FALSE, the rebuild will halt.
; OVERRIDES
;
; Specify the name of the file that contains any rebuild overrides.
; Provide the name of the file if it is in the same directory as rebuild.info,
; or the full path to the file otherwise.
overrides = local.rebuild.infoThis is useful when a team is using the same rebuild file. You can define a local overrides file, and exclude it from version control, so that each team member can customize the rebuild process to their liking.
Rebuilding with an install profile
Everything from the above applies except for the sql_sync and rsync sections. In place of that, you will want this:
site_install[profile] = minimal
site_install[account-mail] = %email
site_install[account-name] = SuperAdmin
site_install[site-name] = Local InstallNote that the placeholder refers to a value defined in the rebuild section of your Drush alias.