I just set up a new Jenkins server for many of our client projects (all Rails apps), and I ended up creating a gem containing the code that I used to automate project configuration for our CI builds. There are three scripts included in the gem, which I called 'railblazer':
app_adapter: given a Gemfile, determines whether the application runs on mysql, mysql2, or postgres
blaze: (Shell) build script that can be used by Jenkins - uses defaults and settings that have been useful to us on a bunch of projects
db_config: outputs a complete database.yml when given an adapter and app name. Uses a template included in the gem by default, or a local one if desired
The code that I wrote may be useful for automatically creating database.yml files locally as well as on CI servers.
Hope that some of you find this useful! Let me know if you have any comments or suggestions.
CEO and Lead Developer