Parse database.yml with erb (#13004).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11286 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1e0a94de84
commit
b0f496a58d
3
Gemfile
3
Gemfile
|
@ -36,9 +36,10 @@ end
|
||||||
|
|
||||||
# Include database gems for the adapters found in the database
|
# Include database gems for the adapters found in the database
|
||||||
# configuration file
|
# configuration file
|
||||||
|
require 'erb'
|
||||||
database_file = File.join(File.dirname(__FILE__), "config/database.yml")
|
database_file = File.join(File.dirname(__FILE__), "config/database.yml")
|
||||||
if File.exist?(database_file)
|
if File.exist?(database_file)
|
||||||
database_config = YAML.load_file(database_file)
|
database_config = YAML::load(ERB.new(IO.read(database_file)).result)
|
||||||
adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
|
adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
|
||||||
if adapters.any?
|
if adapters.any?
|
||||||
adapters.each do |adapter|
|
adapters.each do |adapter|
|
||||||
|
|
Loading…
Reference in New Issue