Permalink
Browse files

Convert database names to ones appropriate for JRuby

  • Loading branch information...
1 parent 2aeabdc commit 2fc22bf156fc172957040d165afc9c9e36d96d71 @arunagw arunagw committed Jun 22, 2011
Showing with 12 additions and 0 deletions.
  1. +12 −0 railties/lib/rails/generators/rails/app/app_generator.rb
@@ -206,6 +206,7 @@ def initialize(*args)
@original_wd = Dir.pwd
super
+ convert_database_option_for_jruby
if !options[:skip_active_record] && !DATABASES.include?(options[:database])
raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}."
@@ -411,6 +412,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 version_constraint_for_database_gem
case options[:database]
when "mysql" then "~> 0.2.6"

0 comments on commit 2fc22bf

Please sign in to comment.