dry application architecture

Hi everyone. In my company we developed a rails cms and now we are trying to figure out how to use it in the smartest way.

We would like to use our modules, wich are mvc for common site elements like 'pages', 'posts', 'news', 'feed' etc, as svn externals in every site project. In this way if we find a bug in the cms core we can easily update every site we made.

In the same time we would like to make possible to extend our core modules for customizing them if needed.

We thought this directory structure would be nice:

site_project/   /app   /public   ... other rails dirs ...   /modules # <-- here we want to put svn:external to cms modules     /app       /models         page.rb         post.rb       /views

the extension of core modules will be put on site_project/app as a normal rails application. If we don't put an extension we want to load the related module.

E.g. in the directory i put before if i define site_project/app/models/page this file will be loaded but if my application will need post.rb the modules file will be loaded.

I know i didn't explain very clear I hope someone would understant enough to help me, even because i bet it's a common problem for studios that use rails for web developing.

best regards.

Gabriel, the way I do this personally is to put my models/views/controllers/helpers in a plugin, and then have the plugin loaded via the engines plugin.

If you're using all subversion repositories for everything, you can use svn:externals to point to your plugin and you should be good to go. If not, I recently released a rubygem called 'ext' that lets me do svn:externals-like stuff with git, so I use that to manage subprojects. For example, the engines repository is managed via git so if you use svn:externals you would have to check the whole engines repository into your main projects' repositories. I personally find that kind of annoying to do, especially if you make modifications to the engines repository (which I had to) since you would then have to go to all your projects and fix the engines plugins there as well (or even just to do a git pull to get the latest engines changes would require making a commit to every main project that uses engines.) Those type of annoyances are what inspired me to make ext.

Either way, take a look at the engines plugin and see if you can use it to solve this problem, as I had success with the engines plugin.

Miles