Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
64ea3dfd
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,发现更多精彩内容 >>
提交
64ea3dfd
编写于
1月 27, 2010
作者:
J
José Valim
提交者:
Carl Lerche
1月 28, 2010
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add reloadable specific for engines and move environment to application paths.
Signed-off-by:
N
Carl Lerche
<
carllerche@mac.com
>
上级
d3d48747
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
23 addition
and
11 deletion
+23
-11
railties/lib/rails/application/configuration.rb
railties/lib/rails/application/configuration.rb
+4
-5
railties/lib/rails/engine.rb
railties/lib/rails/engine.rb
+1
-1
railties/lib/rails/engine/configuration.rb
railties/lib/rails/engine/configuration.rb
+0
-1
railties/lib/rails/plugin.rb
railties/lib/rails/plugin.rb
+6
-0
railties/test/railties/configuration_test.rb
railties/test/railties/configuration_test.rb
+3
-3
railties/test/railties/engine_test.rb
railties/test/railties/engine_test.rb
+4
-0
railties/test/railties/plugin_test.rb
railties/test/railties/plugin_test.rb
+4
-0
railties/test/railties/shared_tests.rb
railties/test/railties/shared_tests.rb
+1
-1
未找到文件。
railties/lib/rails/application/configuration.rb
浏览文件 @
64ea3dfd
...
@@ -8,14 +8,16 @@ class Configuration < ::Rails::Engine::Configuration
...
@@ -8,14 +8,16 @@ class Configuration < ::Rails::Engine::Configuration
attr_accessor
:cache_classes
,
:cache_store
,
:colorize_logging
,
attr_accessor
:cache_classes
,
:cache_store
,
:colorize_logging
,
:consider_all_requests_local
,
:dependency_loading
,
:consider_all_requests_local
,
:dependency_loading
,
:filter_parameters
,
:log_level
,
:logger
,
:metals
,
:filter_parameters
,
:log_level
,
:logger
,
:metals
,
:plugins
,
:preload_frameworks
,
:reload_plugins
,
:plugins
,
:preload_frameworks
,
:reload_
engines
,
:reload_
plugins
,
:serve_static_assets
,
:time_zone
,
:whiny_nils
:serve_static_assets
,
:time_zone
,
:whiny_nils
def
initialize
(
*
)
def
initialize
(
*
)
super
super
@colorize_logging
=
true
@filter_parameters
=
[]
@filter_parameters
=
[]
@dependency_loading
=
true
@dependency_loading
=
true
@serve_static_assets
=
true
@serve_static_assets
=
true
@time_zone
=
"UTC"
end
end
def
paths
def
paths
...
@@ -23,6 +25,7 @@ def paths
...
@@ -23,6 +25,7 @@ def paths
paths
=
super
paths
=
super
paths
.
app
.
controllers
<<
builtin_controller
if
builtin_controller
paths
.
app
.
controllers
<<
builtin_controller
if
builtin_controller
paths
.
config
.
database
"config/database.yml"
paths
.
config
.
database
"config/database.yml"
paths
.
config
.
environment
"config/environments"
,
:glob
=>
"
#{
Rails
.
env
}
.rb"
paths
.
log
"log/
#{
Rails
.
env
}
.log"
paths
.
log
"log/
#{
Rails
.
env
}
.log"
paths
.
tmp
"tmp"
paths
.
tmp
"tmp"
paths
.
tmp
.
cache
"tmp/cache"
paths
.
tmp
.
cache
"tmp/cache"
...
@@ -76,10 +79,6 @@ def builtin_controller
...
@@ -76,10 +79,6 @@ def builtin_controller
def
log_level
def
log_level
@log_level
||=
Rails
.
env
.
production?
?
:info
:
:debug
@log_level
||=
Rails
.
env
.
production?
?
:info
:
:debug
end
end
def
time_zone
@time_zone
||=
"UTC"
end
end
end
end
end
end
end
\ No newline at end of file
railties/lib/rails/engine.rb
浏览文件 @
64ea3dfd
...
@@ -124,7 +124,7 @@ def load_tasks
...
@@ -124,7 +124,7 @@ def load_tasks
protected
protected
def
reloadable?
(
app
)
def
reloadable?
(
app
)
app
.
config
.
reload_
plugin
s
app
.
config
.
reload_
engine
s
end
end
end
end
end
end
\ No newline at end of file
railties/lib/rails/engine/configuration.rb
浏览文件 @
64ea3dfd
...
@@ -22,7 +22,6 @@ def paths
...
@@ -22,7 +22,6 @@ def paths
paths
.
lib
"lib"
,
:load_path
=>
true
paths
.
lib
"lib"
,
:load_path
=>
true
paths
.
lib
.
tasks
"lib/tasks"
,
:glob
=>
"**/*.rake"
paths
.
lib
.
tasks
"lib/tasks"
,
:glob
=>
"**/*.rake"
paths
.
config
"config"
paths
.
config
"config"
paths
.
config
.
environment
"config/environments"
,
:glob
=>
"
#{
Rails
.
env
}
.rb"
paths
.
config
.
initializers
"config/initializers"
,
:glob
=>
"**/*.rb"
paths
.
config
.
initializers
"config/initializers"
,
:glob
=>
"**/*.rb"
paths
.
config
.
locales
"config/locales"
,
:glob
=>
"*.{rb,yml}"
paths
.
config
.
locales
"config/locales"
,
:glob
=>
"*.{rb,yml}"
paths
.
config
.
routes
"config/routes.rb"
paths
.
config
.
routes
"config/routes.rb"
...
...
railties/lib/rails/plugin.rb
浏览文件 @
64ea3dfd
...
@@ -54,5 +54,11 @@ def config
...
@@ -54,5 +54,11 @@ def config
raise
"
\"
#{
name
}
\"
is a Railtie/Engine and cannot be installed as plugin"
raise
"
\"
#{
name
}
\"
is a Railtie/Engine and cannot be installed as plugin"
end
end
end
end
protected
def
reloadable?
(
app
)
app
.
config
.
reload_plugins
end
end
end
end
end
railties/test/railties/configuration_test.rb
浏览文件 @
64ea3dfd
...
@@ -18,13 +18,13 @@ class Foo < Rails::Railtie ; config.foo.greetings = "hello" ; end
...
@@ -18,13 +18,13 @@ class Foo < Rails::Railtie ; config.foo.greetings = "hello" ; end
assert_equal
"hello"
,
Foo
.
config
.
foo
.
greetings
assert_equal
"hello"
,
Foo
.
config
.
foo
.
greetings
end
end
test
"
plugin
configurations are available in the application"
do
test
"
railtie
configurations are available in the application"
do
class
Foo
<
Rails
::
Railtie
;
config
.
foo
.
greetings
=
"hello"
;
end
class
Foo
<
Rails
::
Railtie
;
config
.
foo
.
greetings
=
"hello"
;
end
require
"
#{
app_path
}
/config/application"
require
"
#{
app_path
}
/config/application"
assert_equal
"hello"
,
AppTemplate
::
Application
.
config
.
foo
.
greetings
assert_equal
"hello"
,
AppTemplate
::
Application
.
config
.
foo
.
greetings
end
end
test
"
plugin
config merges are deep"
do
test
"
railtie
config merges are deep"
do
class
Foo
<
Rails
::
Railtie
;
config
.
foo
.
greetings
=
'hello'
;
end
class
Foo
<
Rails
::
Railtie
;
config
.
foo
.
greetings
=
'hello'
;
end
class
Bar
<
Rails
::
Railtie
class
Bar
<
Rails
::
Railtie
config
.
foo
.
bar
=
"bar"
config
.
foo
.
bar
=
"bar"
...
@@ -33,7 +33,7 @@ class Bar < Rails::Railtie
...
@@ -33,7 +33,7 @@ class Bar < Rails::Railtie
assert_equal
"bar"
,
Bar
.
config
.
foo
.
bar
assert_equal
"bar"
,
Bar
.
config
.
foo
.
bar
end
end
test
"
plugin
can add subscribers"
do
test
"
railtie
can add subscribers"
do
begin
begin
class
Foo
<
Rails
::
Railtie
;
subscriber
(
Rails
::
Subscriber
.
new
);
end
class
Foo
<
Rails
::
Railtie
;
subscriber
(
Rails
::
Subscriber
.
new
);
end
assert_kind_of
Rails
::
Subscriber
,
Rails
::
Subscriber
.
subscribers
[
:foo
]
assert_kind_of
Rails
::
Subscriber
,
Rails
::
Subscriber
.
subscribers
[
:foo
]
...
...
railties/test/railties/engine_test.rb
浏览文件 @
64ea3dfd
...
@@ -19,5 +19,9 @@ class Engine < ::Rails::Engine
...
@@ -19,5 +19,9 @@ class Engine < ::Rails::Engine
plugin
.
write
"lib/another.rb"
,
"class Another; end"
plugin
.
write
"lib/another.rb"
,
"class Another; end"
end
end
end
end
def
reload_config
:reload_engines
end
end
end
end
end
railties/test/railties/plugin_test.rb
浏览文件 @
64ea3dfd
...
@@ -15,6 +15,10 @@ def setup
...
@@ -15,6 +15,10 @@ def setup
end
end
end
end
def
reload_config
:reload_plugins
end
test
"plugin can load the file with the same name in lib"
do
test
"plugin can load the file with the same name in lib"
do
boot_rails
boot_rails
require
"bukkits"
require
"bukkits"
...
...
railties/test/railties/shared_tests.rb
浏览文件 @
64ea3dfd
...
@@ -31,7 +31,7 @@ def test_plugins_constants_are_not_reloaded_by_default
...
@@ -31,7 +31,7 @@ def test_plugins_constants_are_not_reloaded_by_default
def
test_plugin_constants_get_reloaded_if_config_reload_plugins
def
test_plugin_constants_get_reloaded_if_config_reload_plugins
add_to_config
<<-
RUBY
add_to_config
<<-
RUBY
config.
reload_plugins
= true
config.
#{
reload_config
}
= true
RUBY
RUBY
boot_rails
boot_rails
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录