提交 ff7a6a9b 编写于 作者: C Carl Lerche

Add the database adapter in the generated Gemfile

上级 bf1f70d8
......@@ -90,6 +90,18 @@ def create_boot_file
template "config/boot.rb"
end
def gem_for_database
# %w( mysql oracle postgresql sqlite3 frontbase ibm_db )
case options[:database]
when "mysql" then "mysql"
when "oracle" then "ruby-oci8"
when "postgresql" then "pg"
when "sqlite3" then "sqlite3-ruby"
when "frontbase" then "ruby-frontbase"
when "ibm_db" then "ibm_db"
end
end
def create_activerecord_files
return if options[:skip_activerecord]
template "config/databases/#{options[:database]}.yml", "config/database.yml"
......
......@@ -13,6 +13,14 @@ gem "rails", "<%= Rails::VERSION::STRING %>"
<%= "# " unless options.edge? %>gem "rails", :git => "git://github.com/rails/rails.git"
<%- end -%>
<% unless options[:skip_activerecord] -%>
<% if options[:database] == 'sqlite3' -%>
# ActiveRecord requires a database adapter. By default,
# Rails has selected sqlite3.
<% end -%>
gem "<%= gem_for_database %>"
<% end -%>
## Bundle the gems you use:
# gem "bj"
# gem "hpricot", "0.6"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册