From 4dd2d07d4a823036b90bf8db75749eb33aafd337 Mon Sep 17 00:00:00 2001 From: Nick Sieger Date: Wed, 15 Jun 2011 12:59:11 -0500 Subject: Convert database names to ones appropriate for JRuby --- railties/lib/rails/generators/app_base.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'railties') diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 3346c5ec13..378eceb4c3 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -64,8 +64,8 @@ module Rails def initialize(*args) @original_wd = Dir.pwd - super + convert_database_option_for_jruby end protected @@ -165,6 +165,17 @@ module Rails end end + def convert_database_option_for_jruby + if defined?(JRUBY_VERSION) + case options[:database] + when "oracle" then options[:database].replace "jdbc" + when "postgresql" then options[:database].replace "jdbcpostgresql" + when "mysql" then options[:database].replace "jdbcmysql" + when "sqlite3" then options[:database].replace "jdbcsqlite3" + end + end + end + def ruby_debugger_gemfile_entry if RUBY_VERSION < "1.9" "gem 'ruby-debug'" -- cgit v1.2.3