Sync enabled modules between sites

So in the process of updating my development site, a new module has been installed. One of my previously installed modules has since become dependent on this new module.

So to get this on to my live/staging site, I use version control to update so that it has the same code as my dev site.
Now I have an issue, I need to enable that new module.

I could simply enable the module manually in drush, but there could be several modules, and I may accidentally miss one.
Plus, I want to write a script that does all of this in one command (with all the other stuff I need to do, sql-sync, run tests, etc).

So ideally, I want a way to sync enabled modules between two sites. But only for specific modules (e.g. devel module should only be installed on dev, I found the environment module that can help with that)

Can anyone recommend a method for doing this? Or propose an alternative workflow?

Comments

My too-brief answer: use a

My too-brief answer: use a post-sync hook. No time to say more at the moment...

Wait, that is a nonsensical answer.

I was thinking you are using drush rsync, but you are using your vcs. The concept is the same, except you do not use a hook, it is just a command. You can use pm-list to find the enabled modules on each system, diff them, take some modules out via config if they are development only (devel, hacked, etc.). Look in includes/commands for functions to call drush functions with -- drush_invoke_sitealias_args(), etc., and see drush_backend_get_result() for comments on how to interpret the results.

And of course, the even better answer...

Use features.

Thanks greg

That's great help.

I figured it would need some work to achieve, but thanks for the pointers.

On another note, how would I use features for this? I'm already using features for exporting anything that features supports. But there's a whole bunch of stuff that it doesn't.
Plus how would features be able to enable a module?

Incidentally, I did the

Owen Barton's picture

Incidentally, I did the diffing of pm-list as an example in out Drupalcon Chicago session - you might want to check out the video. An alternative to diffing that may be a bit simpler from a command line point of view would simply be to pm-list disabled modules on site A, disable those on site A (this can be a single command, using --pipe and | into the disable command), and then pm-list enabled modules on site A, then enable those on site B (another single command using pipe). You could also make your own drush command that calls the pm-list and enable/disable commands (or just functions) and does the same thing with arrays.

drush

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week