Skip to content

Commit

Permalink
Convert database names to ones appropriate for JRuby
Browse files Browse the repository at this point in the history
  • Loading branch information
arunagw committed Jun 22, 2011
1 parent 2aeabdc commit 2fc22bf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions railties/lib/rails/generators/rails/app/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(", ")}."
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 2fc22bf

Please sign in to comment.