Created
January 29, 2011 17:11
-
-
Save johnschult/802000 to your computer and use it in GitHub Desktop.
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
database = begin | |
File.read(File.dirname(__FILE__) + '/config/database.yml').scan(/production.+?adapter\W+(\w+)/im).join | |
rescue | |
nil | |
end | |
case database | |
when /postgres/, /pg/ | |
gem 'pg', :require => false | |
when /sqlite/ | |
gem 'sqlite3-ruby', :require => false | |
else | |
gem 'mysql', :require => false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
All the credit for this goes to Dimitrij Denissenko. The original code is here.