I have many websites but much the same framework for each of them. The only differences being the views, the styles, the databases and deploy.rb. What's the best way to arrange things in version control e.g. svn so that I can maintain and deploy these projects and keep the core code with the little differences for each project? Thanks John Small
on 2008-11-24 18:38
on 2008-12-12 07:23
John Small wrote: > I have many websites but much the same framework for each of them. The > only differences being the views, the styles, the databases and > deploy.rb. > > What's the best way to arrange things in version control e.g. svn so > that I can maintain and deploy these projects and keep the core code > with the little differences for each project? John, laying out a project in SVN or other repository will depend a lot on how you have structured your code, so I can't really speak directly to that. Instead, let me share how I've solved a similar problem. I have a framework, with vertical plugins (based on Rails Engines, more below) that I organize like so: /harness/trunk /plugins/<plugin_name>/trunk /sites/<site_name>/trunk Harness contains the main rails framework, but virtually no code The plugins each contain a vertical - user management, a CMS, a blog, a wiki... as well as a few core plugins for shared code, libraries, etc. The site plugins each contain the custom information for a site - layout, css, custom app code (models, views, etc), which because I have such powerful vertical plugins, contains a small amount of code, css and configuration So a deployed app has the harness, the core plugins all sites use, a selection of plugins for that site's features (eg a blog), and the site plugin for that domain to put on a coat of paint and to add any site-custom config and functionality. It's a great system, and I'm very happy with the results. The trick is to figure out how to build your harness such that the plugins can do all the work. For example, my database.yml file is empty - I configure the database in a custom boot script that pulls its data from my site plugin automagically. Hope that helps, and DEFINITELY check out http://rails-engines.org if you haven't already. Engines rule for reusable web coding.