diff options
author | Arun Agrawal <arun@fromjaipur.com> | 2011-04-23 18:55:17 +0530 |
---|---|---|
committer | Arun Agrawal <arun@fromjaipur.com> | 2011-04-23 19:03:24 +0530 |
commit | b335533e16436d1a12f15a60f6436bdc7b967012 (patch) | |
tree | 461946eef3a34d919e789273aae1c1f18cfe4250 | |
parent | 6cea2436d7bb8e62acc35d98d141f3bab7743dbc (diff) | |
download | rails-b335533e16436d1a12f15a60f6436bdc7b967012.tar.gz rails-b335533e16436d1a12f15a60f6436bdc7b967012.tar.bz2 rails-b335533e16436d1a12f15a60f6436bdc7b967012.zip |
jdbcsqlite3 support added into template. #jruby
3 files changed, 26 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index ddfd5256fe..b240222c6e 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -9,7 +9,8 @@ require 'uri' module Rails module Generators class AppBase < Base - DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db jdbcmysql ) + JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 ) + DATABASES = %w( mysql oracle postgresql sqlite3 frontbase ibm_db ) + JDBC_DATABASES JAVASCRIPTS = %w( jquery prototype ) attr_accessor :rails_template @@ -163,6 +164,7 @@ module Rails 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/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 diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 176d016fb9..839f75d963 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -137,6 +137,12 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_file "Gemfile", /^gem\s+["']activerecord-jdbcmysql-adapter["']$/ end + def test_config_jdbcsqlite3_database + run_generator([destination_root, "-d", "jdbcsqlite3"]) + assert_file "config/database.yml", /jdbcsqlite3/ + assert_file "Gemfile", /^gem\s+["']activerecord-jdbcsqlite3-adapter["']$/ + end + def test_generator_if_skip_active_record_is_given run_generator [destination_root, "--skip-active-record"] assert_no_file "config/database.yml" |