"Drush make" provides the possibility of automatic Drupal project generation. A functional site with specific versions and custom modules could be generated only configuring a script.
This gives to the developer a high efficiency when we want to start a new project, environment or restore an existing one.
e-mail: enrique.del-castillo@keyconsulting.fr
twitter: @KeyCBarcelona
3. • Drush make provides the possibility of automatic Drupal
project generation
• A functional site with specific versions and custom
modules could be generated only configuring a script
• This gives us high efficiency when we want to start a
new project, environment or restore an existing one
4. • Internet connection
• Drush: installed and configured
• A main script file created by us
• A folder with all necessary .make files,
custom modules and themes, patches
and other files
• DrushCmd.script
5. • main_script.sh
– Our main script to run all the process
• /project_name/custom_modules/*.tar.gz
– All compressed custom modules we want to add to the project
• /project_name/custom_themes/*.tar.gz
– All compressed custom themes we want to add to the project
• /project_name/files/*
– Files we want to add manually to the project (libraries, translation files …)
• /project_name/patches/*.patch
– All patches we want to apply during the process
• /project_name/DrushCmd.script
– Script provided to ease Drupal make deployment
• /project_name/*.make
– All make files to be executed that will be described further
6. • Main script will need to follow all the necessary steps:
– Prepare drush make with DrushCmd.script
– Call drush make installation command
– Copy or overwrite missing files
– Patch files
– Purge useless files and folders
– Do any needed action to have our site working
• Example: we could decide to generate a database
for the site
7. # Clean target folder
project/DrushCmd.script --alias-path=project --cible=@project.integration --rm-all
# Add make files to the project
project/DrushCmd.script --alias-path=project --cible=@project.integration --make-trans=project/project.integration.make
project/DrushCmd.script --alias-path=project --cible=@project.integration --make-
trans=project/project.core_contrib.make
project/DrushCmd.script --alias-path=project --cible=@project.integration --make-trans=project/project.custom.make
project/DrushCmd.script --alias-path=project --cible=@project.integration --make-trans=project/project.theme.make
# Run automatic process
cd application/contenus && drush make project.integration.make --no-cache -y --prepare-install
# Copy translation file
cp /root/project/files/drupal-7.22.fr.po profiles/minimal/translations/
# Patch lightbox2 module
patch -p1 sites/all/modules/lightbox2/js/lightbox.js < /root/project/patches/lightbox2-1.patch
# Remove useless files and folders
rm -v .gitignore
rm -v CHANGELOG.txt
rm -v COPYRIGHT.txt
rm -v INSTALL.txt
8. • It is a script provided to us which eases drush make process
• It allows different options to:
– remove all previous files
– transmission of make files to the integration server
– Drupal installation with module activation
– apply needed patches
– profile transmission to the integration server
– profile configuration
– post installation actions
9. • We could tecnically have only one .make file but it will be more
organized to have one make file for every section: core and
contrib modules, custom modules and themes
• The first make file needs to start with these lines, specifying Core
and api versions
– core = 7.x
– api = 2
• In this main .make file we can include other make files like this
10. • It is recommended to create a make file for these configurations
• It is possible to download core, libraries and modules directly from external URLs (or
internal if we prefer)
• Core:
– We just need to select the core version we want to install and the URL to
download it
• Libraries:
– As core version we can install Drupal libraries directly from internal or external
URLs
• Contrib modules:
– The same for contrib modules
11. • It is advisable to create a separated make file for
these modules
• Here, it is possible to include custom modules
or contrib modules which are not available
anymore
• It is possible to include modules from an
internal path instead of an external URL
12. • In addition we can have a separated make file to
include themes
• Custom themes can be included like custom
modules
• If there is a module and a theme with the same
name, we can use the directory_name
parameter to avoid conflicts
13. • After the Drupal installation we could wish
to replace or add some files.
– For example: language configurations or any
file needed for the project
• To achieve this we can add lines to copy
or overwrite files in the main script file
14. • It is also possible to patch files instead of
overwritting them. This could be necessary
in some case, for example: module or
theme conflicts, customize contrib
modules, hard-coded changes
• For this we can also patch directly Drupal
modules using make files
15. • It is also possible to remove useless files and folders in
the main script file:
– Example:
• Unnecessary Drupal core files
• Unnecessary Drupal module files
• And purge .make files which were transfered at the
beginning of the process:
• rm -v *.make