Skip to content

Instantly share code, notes, and snippets.

@johnschult
Created January 29, 2011 17:11
Show Gist options
  • Save johnschult/802000 to your computer and use it in GitHub Desktop.
Save johnschult/802000 to your computer and use it in GitHub Desktop.
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
@johnschult
Copy link
Author

All the credit for this goes to Dimitrij Denissenko. The original code is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment