On Aug 10, 2008, at 12:22 PM, Greg Dunlap wrote:
On Sun, Aug 10, 2008 at 6:06 AM, Victor Kane <victorkane@gmail.com> wrote:
Alex Barth recently contact me about exactly this, having come to the exact same conclusion. He has opened an issue in deploy's issue queue:
He himself wrote a module quite similar to Deploy called Ports which is pretty interesting and abstracts import/export a bit beyond what I did. Maybe he can chime in here about what he's done because I've only taken really a cursory glance at it.
I'm happy that this discussion is coming up. I started writing port module for generating installer profiles and was then pleasantly surprised to see similarities with Greg's deploy module. At port module's core there is a very simple idea: provide a hook to let modules define a matching export and import function. Here is the ports hook definition for imagecache for example: // Implementation of hook_ports() function imagecache_ports() { $ports = array(); $ports['imagecache_presets']['name'] = t('Image cache presets'); $ports['imagecache_presets']['export callback'] = 'imagecache_export_presets'; $ports['imagecache_presets']['import callback'] = 'imagecache_import_presets'; $ports['imagecache_presets']['type'] = PORT_STRUCTURE; // not yet implemented $ports['imagecache_presets']['version'] = '1.68.2.3'; // not yet implemented return $ports; } This simple approach is pretty powerful, because it makes it really easy to generate a single export array that contains all the information for importing it on a target site. In its simplest applications, you can copy / paste this array to your target site or you can use it to generate install functions for an install profile (both operations currently supported by port module). After doing a first proof of concept as a result of a client project, I saw how similar certain approaches in deploy module are and got in touch with Greg. I had another look at deploy module this weekend: I'm actually thinking that a deploy like module and a port like module could play very well together by port providing the structure in which modules should export and import configuration and deploy providing the XML-RPC integration, deployment functionality and the UI. Another module that could be implemented on top of port module is the install profile wizard (recent discussion on a related thread: http://drupal.org/node/230059#comment-957328) . That said, port is a proof of concept, this is the current status and limitations: # Basic hook_ports() system defined # UI for copy/paste deployment of export data # UI for generating callable PHP functions # on-behalf implementations for menus, user roles and permissions, module status, content types, imagecache, nodeprofile and spaces. # while there is a flag for PORT_STRUCTURE and PORT_CONTENT I haven't thought deeper about content export/import - I'm just thinking that it's a very closely related problem # while there's a slot for version number, port isn't handling any version comparisons atm # there is no 'update' handling, no notion of mapping # there is no way of exporting parts of a modules configuration yet. While modules can define more than one export / import pair, there's no way of exporting just a part of one export function. e. g. export only certain imagecache definitions, not all of them. this one should be easy. Ideas for update handling in port: I'm leaning towards not dealing with it on this level. In the existing implementation modules would deal with create new vs update by themselves. I haven't thought much about this though and there might be a smart helper that port could provide so that we know on this level what's an update and what's new. Plans for port: don't know yet. I'm in touch with Greg on deploy and I plan to get in touch with Boris Mann on install profile wizards. These are the two projects where I see overlap. I'd be very curious to get your thoughts on port module's approach. Check out the code here: http://cvs.drupal.org/viewvc.py/drupal/contributions/sandbox/alex_b/port/ - Alex Barth http://www.developmentseed.org/blog tel (202) 250-3633