From b335533e16436d1a12f15a60f6436bdc7b967012 Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Sat, 23 Apr 2011 18:55:17 +0530 Subject: jdbcsqlite3 support added into template. #jruby --- railties/lib/rails/generators/app_base.rb | 4 +++- .../app/templates/config/databases/jdbcsqlite3.yml | 17 +++++++++++++++++ railties/test/generators/app_generator_test.rb | 6 ++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml (limited to 'railties') 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" -- cgit v1.2.3