Created
September 17, 2009 02:08
-
-
Save akm/188307 to your computer and use it in GitHub Desktop.
database.yml.example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% | |
db_proj_name = 'your project name on db' | |
scm_proj_name = 'your project name on scm' | |
branch = `git status`.scan(/\# On branch ([^\s]+?)$/).flatten.first if File.exist?('./.git') | |
branch ||= `svn info`.scan(/\/#{scm_proj_name}\/(?:branches\/(.*?))\/|(trunk)/).flatten.compact.first if File.exist?('./.svn') | |
branch = branch ? '_' << branch.sub(/^local[\-_]/, '').sub('-', '_') : '' | |
%> | |
common: &common | |
adapter: mysql | |
encoding: utf8 | |
username: root | |
password: | |
socket: /opt/local/var/run/mysql5/mysqld.sock | |
development: | |
database: <%= db_proj_name %><%= branch %>_development | |
<<: *common | |
test: | |
database: <%= db_proj_name %><%= branch %>_test | |
<<: *common | |
production: | |
database: <%= db_proj_name %><%= branch %>_production | |
<<: *common |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment