Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
6404f8a1
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6404f8a1
编写于
6月 21, 2011
作者:
A
Aaron Patterson
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #1811 from nicksieger/more-jruby-gem-for-database-fixes-master
More jruby gem for database fixes master
上级
d6f1291f
a85b9faf
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
88 addition
and
23 deletion
+88
-23
railties/lib/rails/generators/app_base.rb
railties/lib/rails/generators/app_base.rb
+17
-5
railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml
.../generators/rails/app/templates/config/databases/jdbc.yml
+62
-0
railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml
...rators/rails/app/templates/config/databases/jdbcmysql.yml
+3
-3
railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml
...s/rails/app/templates/config/databases/jdbcpostgresql.yml
+3
-12
railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml
...tors/rails/app/templates/config/databases/jdbcsqlite3.yml
+3
-3
未找到文件。
railties/lib/rails/generators/app_base.rb
浏览文件 @
6404f8a1
...
...
@@ -10,7 +10,7 @@ module Rails
module
Generators
class
AppBase
<
Base
DATABASES
=
%w( mysql oracle postgresql sqlite3 frontbase ibm_db )
JDBC_DATABASES
=
%w( jdbcmysql jdbcsqlite3 jdbcpostgresql )
JDBC_DATABASES
=
%w( jdbcmysql jdbcsqlite3 jdbcpostgresql
jdbc
)
DATABASES
.
concat
(
JDBC_DATABASES
)
attr_accessor
:rails_template
...
...
@@ -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
...
...
@@ -157,13 +157,25 @@ def gem_for_database
when
"postgresql"
then
"pg"
when
"frontbase"
then
"ruby-frontbase"
when
"mysql"
then
"mysql2"
when
"jdbcmysql"
then
"activerecord-jdbcmysql-adapter"
when
"jdbcsqlite3"
then
"activerecord-jdbcsqlite3-adapter"
when
"jdbcpostgresql"
then
"activerecord-jdbcpostgresql-adapter"
when
"jdbcmysql"
then
"activerecord-jdbcmysql-adapter"
when
"jdbcsqlite3"
then
"activerecord-jdbcsqlite3-adapter"
when
"jdbcpostgresql"
then
"activerecord-jdbcpostgresql-adapter"
when
"jdbc"
then
"activerecord-jdbc-adapter"
else
options
[
: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'"
...
...
railties/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml
0 → 100644
浏览文件 @
6404f8a1
# If you are using mssql, derby, hsqldb, or h2 with one of the
# ActiveRecord JDBC adapters, install the appropriate driver, e.g.,:
# gem install activerecord-jdbcmssql-adapter
#
# Configure using Gemfile:
# gem 'activerecord-jdbcmssql-adapter'
#
#development:
# adapter: mssql
# username: <%= app_name %>
# password:
# host: localhost
# database: <%= app_name %>_development
#
# 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: mssql
# username: <%= app_name %>
# password:
# host: localhost
# database: <%= app_name %>_test
#
#production:
# adapter: mssql
# username: <%= app_name %>
# password:
# host: localhost
# database: <%= app_name %>_production
# If you are using oracle, db2, sybase, informix or prefer to use the plain
# JDBC adapter, configure your database setting as the example below (requires
# you to download and manually install the database vendor's JDBC driver .jar
# file). See your driver documentation for the apropriate driver class and
# connection string:
development
:
adapter
:
jdbc
username
:
<%= app_name %>
password
:
driver
:
url
:
jdbc:db://localhost/<%= app_name %>_development
# 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
:
jdbc
username
:
<%= app_name %>
password
:
driver
:
url
:
jdbc:db://localhost/<%= app_name %>_test
production
:
adapter
:
jdbc
username
:
<%= app_name %>
password
:
driver
:
url
:
jdbc:db://localhost/<%= app_name %>_production
railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml
浏览文件 @
6404f8a1
...
...
@@ -9,7 +9,7 @@
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development
:
adapter
:
jdbc
mysql
adapter
:
mysql
database
:
<%= app_name %>_development
username
:
root
password
:
...
...
@@ -19,14 +19,14 @@ development:
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test
:
adapter
:
jdbc
mysql
adapter
:
mysql
database
:
<%= app_name %>_test
username
:
root
password
:
host
:
localhost
production
:
adapter
:
jdbc
mysql
adapter
:
mysql
database
:
<%= app_name %>_production
username
:
root
password
:
...
...
railties/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml
浏览文件 @
6404f8a1
# PostgreSQL. Versions 7.4 and 8.x are supported.
#
# Install the pg driver:
# gem install pg
# On Mac OS X with macports:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
#
# Configure Using Gemfile
# gem 'activerecord-jdbcpostgresql-adapter'
development
:
adapter
:
jdbc
postgresql
adapter
:
postgresql
encoding
:
unicode
database
:
<%= app_name %>_development
username
:
<%= app_name %>
...
...
@@ -38,14 +29,14 @@ development:
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test
:
adapter
:
jdbc
postgresql
adapter
:
postgresql
encoding
:
unicode
database
:
<%= app_name %>_test
username
:
<%= app_name %>
password
:
production
:
adapter
:
jdbc
postgresql
adapter
:
postgresql
encoding
:
unicode
database
:
<%= app_name %>_production
username
:
<%= app_name %>
...
...
railties/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml
浏览文件 @
6404f8a1
...
...
@@ -5,16 +5,16 @@
# gem 'activerecord-jdbcsqlite3-adapter'
#
development
:
adapter
:
jdbc
sqlite3
adapter
:
sqlite3
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
:
jdbc
sqlite3
adapter
:
sqlite3
database
:
db/test.sqlite3
production
:
adapter
:
jdbc
sqlite3
adapter
:
sqlite3
database
:
db/production.sqlite3
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录