Advanced project structure
Managing a lot of different modules, themes, profiles and sites is hard. This method tries to ease the pain of managing external projects by using Drush make, a tool for downloading all projects in a specification.
Example project
In order for you to get off the ground faster, we have created a sample project that can be used as a base. It is available here.
Separation is good
Since we are working with a lot of external projects that are all really managed someplace else than in our repository, we don't want to have them directly in our repository, rather we would like to be able to define a list of all external projects we want to use, and have a tool download them for us. Things like upgrading modules would then only be a matter of updating the list of modules. Drush make does exactly this.
Make file example
An example make file can look like this:
$Id$
; API
api = 2
; Core
core = 7.x
; Drupal project.
projects[drupal] = 7.10
; Fetch alpha4 of NodeStream.
projects[nodestream]= 7.x-2.x-alpha4
; We point to our own installation profile here.
; This profile is our own, and it can live anywhere, for instance on github.
; The profile we are using here is an example profile for NodeStream that is good to use as a start.
projects[ns_example_profile][type] = profile
projects[ns_example_profile][download][type] = git
projects[ns_example_profile][download][url] = http://git.drupal.org/sandbox/fabsor/1401946.git
projects[ns_example_profile][download][branch] = 7.x-2.x
; You can add as many other profiles as you want, and develop them
; within the same platform by just adding them to this make file in the same
; manner as above.
We recommend that you put your make file in the root of your repository, and build your actual web root in a separate directory.
Running the make file
Once you have a make file that fits your needs, you are ready to run it. Run the following command to build your project:
drush make example.make web
It's usually nice to keep the working copies of any repositories while developing. In order to keep them run the following instead:
drush make --working-copy example.make web
Updating projects
To update a project, just go in and change the make file and bump the version number. Once you updated you can run drush make again. Note that it is usually a good idea to remove the folders of the projects that you are going to update, since you might have files left that should have been removed otherwise.
Automate some more!
Working with drush make can sometimes be a bit tedious, since you have to remove folders of project that you want to update before you rebuild your project. Also, a build takes a long time, and you might want to do some more operations before or after your build.
We recommend that you use another build tool that runs drush make for you and does other tedious tasks related to your project. In our example project, we used a python tool called Fabric to perform some operations while building and rebuilding. Fabric can also execute commands on remote servers, which means that it can be used as a deployment tool as well. Have a look at our fabric file for some examples on how to streamline the building process.
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion