Thursday, October 11, 2012

drush make with install profile run from github

keeping installing sites and enabling all those modules you use every time is a pain in the ass.

Well no more!

I discovered that there is an easier way!

To work with this you need to have a basic drupal webserver running or need to install that first.
also drush 5.x needs to be enabled so you can run drush make

To get a quick and dirty solution just for testing or for me to remember how to get the install, you need to run the following command in the folder where you want the drupal install:
drush make https://raw.github.com/scubafly/drupal-make-files/master/d7.make -y

To jump to understanding what I did, here's what I did:

First I made a list of modules that I always use.
Then based on that list I created a .make file which now sits at https://raw.github.com/scubafly/drupal-make-files/master/d7.make 

And looks like this:
core = 7.x
api = 2

; core
projects[] = drupal
; basic drupal 7 install always needed file with devel included
projects[] = admin_menu
projects[] = ctools
projects[] = devel
projects[] = link
projects[] = mail_logger
projects[] = l10n_client
projects[] = l10n_update
projects[] = backup_migrate
projects[] = entity
projects[] = module_filter
projects[] = pathauto
projects[] = profile2
projects[] = token
projects[] = taxonomy_csv
projects[] = wysiwyg
projects[] = views

So now I can run the following command in the terminal while sitting in the folder where I want my drupal install:
drush make https://raw.github.com/scubafly/drupal-make-files/master/d7.make -y
This will download the latest drupal 7 and modules that where included in the make file.

So yeah thats all fun and all, but still you need to click trough the install and use "drush en module, module, module, module" or manually click to enable all the modules you want for every install.

Creating a profile.

The easiest way to create a profile from scratch is to copy the profile from an existing drupal install.
The install profiles can be found in websitefolder/profiles/<profilename>

profiles are somewhat like modules except they are not, they are profiles :)
Now in the .info file you can define which modules should be enabled. If you look at the standard profile ( websitefolder/profiles/standard/standard.info ) you can see that there are dependencies defined.
for example this is how you would define that devel should be enabled upon installation:
dependencies[] = devel

More information how to create profiles can be found here

I've pushed the profile into github so I can include it in my make file. My profile info looks like this at the moment of writing:
name = Jack standaard
description = basic install profile
core = 7.x

;this is used to enable the modules

; d7.make modules
dependencies[] = admin_devel
dependencies[] = admin_menu
dependencies[] = ctools
dependencies[] = block
dependencies[] = color
dependencies[] = contextual
dependencies[] = dashboard
dependencies[] = dblog
dependencies[] = field
dependencies[] = field_sql_storage
dependencies[] = field_ui
dependencies[] = file
dependencies[] = filter
dependencies[] = help
dependencies[] = image
dependencies[] = list
dependencies[] = locale
dependencies[] = menu
dependencies[] = node
dependencies[] = number
dependencies[] = options
dependencies[] = overlay
dependencies[] = path
dependencies[] = rdf
dependencies[] = search
dependencies[] = shortcut
dependencies[] = system
dependencies[] = taxonomy
dependencies[] = text
dependencies[] = trigger
dependencies[] = update
dependencies[] = user
dependencies[] = devel
dependencies[] = link
dependencies[] = mail_logger
dependencies[] = l10n_client
dependencies[] = l10n_update
dependencies[] = backup_migrate
dependencies[] = entity
dependencies[] = module_filter
dependencies[] = pathauto
dependencies[] = profile2
dependencies[] = token
dependencies[] = taxonomy_csv
dependencies[] = wysiwyg
dependencies[] = views
dependencies[] = views_ui


Since I pushed the whole profile to github ( click the link for details ) I can now include the profile to the make file which then ends up looking like this:

core = 7.x
api = 2

; core
projects[] = drupal
; basic drupal 7 install always needed file with devel included
projects[] = admin_menu
projects[] = ctools
projects[] = devel
projects[] = link
projects[] = mail_logger
projects[] = l10n_client
projects[] = l10n_update
projects[] = backup_migrate
projects[] = entity
projects[] = module_filter
projects[] = pathauto
projects[] = profile2
projects[] = token
projects[] = taxonomy_csv
projects[] = wysiwyg
projects[] = views

; add custom profile
projects[jack_standaard][type] = "profile"
projects[jack_standaard][download][type] = "git"
projects[jack_standaard][download][url] = "git://github.com/scubafly/jack_standaard.git"

make sure u use the git read only link as url that works the best without the need of logging in.

now when you run drush make https://raw.github.com/scubafly/drupal-make-files/master/d7.make -y  the drupal, the modules and the profile will be downloaded. And when you open the webpage you should see the 'jack_standaard' profile as option to install.