brick-wall-2961297319229y2r_0.jpg

Whatever you want from git in your make

Monday, January 30, 2012 - 18:15

Make-files are really powerful to use when your work in developing with Drupal with profiles. In the make-file you can download specific versions of modules, and patch them if you need, to easily set up a site. Without the need of having the modules in your own repo. And you could also download modules from git repos, on drupal.org or elsewhere, and that’s one of the big advantages.

In a recent project we use a make file for our profile to download specific versions of modules, it could look like this:

projects[date][version] = 2.0-alpha4
projects[devel][version] = 1.2
projects[diff][version] = 2.0-beta2
projects[ds][version] = 1.4

They are ordinary releases that you could download from drupal.org. Sometimes we need to download modules from git instead, maybe we need to do some patching and stuff, or we need just the latest. Until now we have download a specific branch, like latest dev for the Menu Minipanels.

projects[menu_minipanels][type] = module
projects[menu_minipanels][download][type] = git
projects[menu_minipanels][download][url] = http://git.drupal.org/project/menu_minipanels.git
projects[menu_minipanels][download][branch] = 7.x-1.x

Pretty straight forward.

But then we had a problem. We needed to checkout a specific commit, and we hit the wall. How could we do that, we tried a couple of solutions. Some script magic and some ugly hacking. And suddenly I found this wonderful blog post.

And a door opened in the wall. And the sun shined on our faces.

You could check out a specific commit with
projects[menu_minipanels][download][revision] = e09d58f2c1cba50cec1aeed102614b1e5a32992d

Or you could check out a specific tag
projects[menu_minipanels][download][tag] = 7.x-1.x-dev

So you could choose fram branch, revision or tag. That is just great, if you ask me.

Just a note: you can not combine revision, tag or branch, and there a no need for that either.

Attachment

application-octet-stream_0.png