Browse files

Convert database names to ones appropriate for JRuby

  • Loading branch information...
1 parent 198cd8b commit 1cbbe067d40fd8fb8c184eed5d96b976605f25a2 @nicksieger nicksieger committed Jun 15, 2011
Showing with 12 additions and 1 deletion.
  1. +12 −1 railties/lib/rails/generators/app_base.rb
View
13 railties/lib/rails/generators/app_base.rb
@@ -64,8 +64,8 @@ def self.add_shared_options_for(name)
def initialize(*args)
@original_wd = Dir.pwd
-
super
+ convert_database_option_for_jruby
end
protected
@@ -165,6 +165,17 @@ def gem_for_database
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'"

0 comments on commit 1cbbe06

Please sign in to comment.