diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-04-25 09:20:40 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-04-25 09:20:40 -0700 |
commit | 17fec021d196ffbd745c340f98b9cfbcdb16b2a8 (patch) | |
tree | e20068efe78bc674323bc4aec22ce5b4c6de1c7e /railties/lib | |
parent | 2fc8d7ea90c901600319d2ad4d3dbfece3ced410 (diff) | |
parent | 51854de52caa410862266a79b255132a0710aef0 (diff) | |
download | rails-17fec021d196ffbd745c340f98b9cfbcdb16b2a8.tar.gz rails-17fec021d196ffbd745c340f98b9cfbcdb16b2a8.tar.bz2 rails-17fec021d196ffbd745c340f98b9cfbcdb16b2a8.zip |
Merged pull request #300 from arunagw/jdbc_test.
Start Adding jdbcmysql support to new rails template.
Diffstat (limited to 'railties/lib')
3 files changed, 52 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 481fa95068..46a2a3f154 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -10,6 +10,8 @@ module Rails module Generators class AppBase < Base DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db ) + JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 ) + DATABASES.concat(JDBC_DATABASES) JAVASCRIPTS = %w( jquery prototype ) attr_accessor :rails_template @@ -156,12 +158,14 @@ module Rails end def gem_for_database - # %w( mysql oracle postgresql sqlite3 frontbase ibm_db ) + # %w( mysql oracle postgresql sqlite3 frontbase ibm_db jdbcmysql jdbcsqlite3) case options[:database] when "oracle" then "ruby-oci8" when "postgresql" then "pg" when "frontbase" then "ruby-frontbase" when "mysql" then "mysql2" + when "jdbcmysql" then "activerecord-jdbcmysql-adapter" + when "jdbcsqlite3" then "activerecord-jdbcsqlite3-adapter" else options[:database] end end diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml new file mode 100644 index 0000000000..ca807c9f3f --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml @@ -0,0 +1,30 @@ +# MySQL. Versions 4.1 and 5.0 are recommended. +# +# Install the MySQL driver: +# gem install activerecord-jdbcmysql-adapter +# +# And be sure to use new-style password hashing: +# http://dev.mysql.com/doc/refman/5.0/en/old-client.html +development: + adapter: jdbcmysql + database: <%= app_name %>_development + username: root + password: + host: localhost + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: jdbcmysql + database: <%= app_name %>_test + username: root + password: + host: localhost + +production: + adapter: jdbcmysql + database: <%= app_name %>_production + username: root + password: + host: localhost diff --git a/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml new file mode 100644 index 0000000000..30776b3b4e --- /dev/null +++ b/railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml @@ -0,0 +1,17 @@ +# SQLite version 3.x +# gem 'activerecord-jdbcsqlite3-adapter' + +development: + adapter: jdbcsqlite3 + database: db/development.sqlite3 + +# Warning: The database defined as "test" will be erased and +# re-generated from your development database when you run "rake". +# Do not set this db to the same as development or production. +test: + adapter: jdbcsqlite3 + database: db/test.sqlite3 + +production: + adapter: jdbcsqlite3 + database: db/production.sqlite3 |