Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
c8cc8a98
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,发现更多精彩内容 >>
提交
c8cc8a98
编写于
1月 22, 2010
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Moved more configuration away from bootstrap.
上级
4ae79367
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
81 addition
and
95 deletion
+81
-95
actionmailer/lib/action_mailer/railtie.rb
actionmailer/lib/action_mailer/railtie.rb
+0
-5
actionpack/lib/action_controller/railtie.rb
actionpack/lib/action_controller/railtie.rb
+0
-10
activerecord/lib/active_record/railtie.rb
activerecord/lib/active_record/railtie.rb
+5
-5
activeresource/lib/active_resource/railtie.rb
activeresource/lib/active_resource/railtie.rb
+6
-0
activesupport/lib/active_support/railtie.rb
activesupport/lib/active_support/railtie.rb
+29
-0
railties/lib/rails/all.rb
railties/lib/rails/all.rb
+1
-0
railties/lib/rails/application.rb
railties/lib/rails/application.rb
+39
-0
railties/lib/rails/bootstrap.rb
railties/lib/rails/bootstrap.rb
+0
-72
railties/lib/rails/configuration.rb
railties/lib/rails/configuration.rb
+1
-3
未找到文件。
actionmailer/lib/action_mailer/railtie.rb
浏览文件 @
c8cc8a98
...
...
@@ -18,10 +18,5 @@ class Railtie < Rails::Railtie
initializer
"action_mailer.logger"
do
ActionMailer
::
Base
.
logger
||=
Rails
.
logger
end
initializer
"action_mailer.view_paths"
do
|
app
|
# TODO: this should be combined with the logic for default config.action_mailer.view_paths
ActionMailer
::
Base
.
template_root
=
[]
if
ActionMailer
::
Base
.
view_paths
.
blank?
end
end
end
\ No newline at end of file
actionpack/lib/action_controller/railtie.rb
浏览文件 @
c8cc8a98
...
...
@@ -22,15 +22,5 @@ class Railtie < Rails::Railtie
initializer
"action_controller.initialize_framework_caches"
do
ActionController
::
Base
.
cache_store
||=
RAILS_CACHE
end
# Sets +ActionController::Base#view_paths+ and +ActionMailer::Base#template_root+
# (but only for those frameworks that are to be loaded). If the framework's
# paths have already been set, it is not changed, otherwise it is
# set to use Configuration#view_path.
initializer
"action_controller.initialize_framework_views"
do
|
app
|
# TODO: this should be combined with the logic for default config.action_controller.view_paths
ActionController
::
Base
.
view_paths
=
[]
if
ActionController
::
Base
.
view_paths
.
blank?
end
end
end
activerecord/lib/active_record/railtie.rb
浏览文件 @
c8cc8a98
...
...
@@ -18,6 +18,11 @@ class Railtie < Rails::Railtie
require
"active_record/railties/subscriber"
subscriber
ActiveRecord
::
Railties
::
Subscriber
.
new
initializer
"active_record.initialize_timezone"
do
ActiveRecord
::
Base
.
time_zone_aware_attributes
=
true
ActiveRecord
::
Base
.
default_timezone
=
:utc
end
initializer
"active_record.set_configs"
do
|
app
|
app
.
config
.
active_record
.
each
do
|
k
,
v
|
ActiveRecord
::
Base
.
send
"
#{
k
}
="
,
v
...
...
@@ -31,11 +36,6 @@ class Railtie < Rails::Railtie
ActiveRecord
::
Base
.
establish_connection
end
initializer
"active_record.initialize_timezone"
do
ActiveRecord
::
Base
.
time_zone_aware_attributes
=
true
ActiveRecord
::
Base
.
default_timezone
=
:utc
end
# Expose database runtime to controller for logging.
initializer
"active_record.log_runtime"
do
|
app
|
require
"active_record/railties/controller_runtime"
...
...
activeresource/lib/active_resource/railtie.rb
浏览文件 @
c8cc8a98
...
...
@@ -7,5 +7,11 @@ class Railtie < Rails::Railtie
require
"active_resource/railties/subscriber"
subscriber
ActiveResource
::
Railties
::
Subscriber
.
new
initializer
"active_resource.set_configs"
do
|
app
|
app
.
config
.
active_resource
.
each
do
|
k
,
v
|
ActiveResource
::
Base
.
send
"
#{
k
}
="
,
v
end
end
end
end
\ No newline at end of file
activesupport/lib/active_support/railtie.rb
0 → 100644
浏览文件 @
c8cc8a98
require
"active_support"
require
"rails"
module
ActiveSupport
class
Railtie
<
Rails
::
Railtie
plugin_name
:active_support
# Loads support for "whiny nil" (noisy warnings when methods are invoked
# on +nil+ values) if Configuration#whiny_nils is true.
initializer
:initialize_whiny_nils
do
|
app
|
require
'active_support/whiny_nil'
if
app
.
config
.
whiny_nils
end
# Sets the default value for Time.zone
# If assigned value cannot be matched to a TimeZone, an exception will be raised.
initializer
:initialize_time_zone
do
|
app
|
require
'active_support/core_ext/time/zones'
zone_default
=
Time
.
__send__
(
:get_zone
,
app
.
config
.
time_zone
)
unless
zone_default
raise
\
'Value assigned to config.time_zone not recognized.'
+
'Run "rake -D time" for a list of tasks for finding appropriate time zone names.'
end
Time
.
zone_default
=
zone_default
end
end
end
\ No newline at end of file
railties/lib/rails/all.rb
浏览文件 @
c8cc8a98
require
"rails"
%w(
active_support
active_model
active_record
action_controller
...
...
railties/lib/rails/application.rb
浏览文件 @
c8cc8a98
...
...
@@ -137,6 +137,45 @@ def call(env)
end
end
# Set the i18n configuration from config.i18n but special-case for the load_path which should be
# appended to what's already set instead of overwritten.
initializer
:initialize_i18n
do
require
'active_support/i18n'
config
.
i18n
.
each
do
|
setting
,
value
|
if
setting
==
:load_path
I18n
.
load_path
+=
value
else
I18n
.
send
(
"
#{
setting
}
="
,
value
)
end
end
ActionDispatch
::
Callbacks
.
to_prepare
do
I18n
.
reload!
end
end
initializer
:set_clear_dependencies_hook
do
unless
config
.
cache_classes
ActionDispatch
::
Callbacks
.
after
do
ActiveSupport
::
Dependencies
.
clear
end
end
end
initializer
:initialize_notifications
do
require
'active_support/notifications'
if
config
.
colorize_logging
==
false
Rails
::
Subscriber
.
colorize_logging
=
false
config
.
generators
.
colorize_logging
=
false
end
ActiveSupport
::
Notifications
.
subscribe
do
|*
args
|
Rails
::
Subscriber
.
dispatch
(
args
)
end
end
# Disable dependency loading during request cycle
initializer
:disable_dependency_loading
do
if
config
.
cache_classes
&&
!
config
.
dependency_loading
...
...
railties/lib/rails/bootstrap.rb
浏览文件 @
c8cc8a98
...
...
@@ -33,13 +33,6 @@ def initialize(application)
# FIXME This is just a dumb initializer used as hook
end
# Create tmp directories
initializer
:ensure_tmp_directories_exist
do
%w(cache pids sessions sockets)
.
each
do
|
dir_to_make
|
FileUtils
.
mkdir_p
(
File
.
join
(
root
,
'tmp'
,
dir_to_make
))
end
end
# Preload all frameworks specified by the Configuration#frameworks.
# Used by Passenger to ensure everything's loaded before forking and
# to avoid autoload race conditions in JRuby.
...
...
@@ -64,70 +57,5 @@ def initialize(application)
# TODO: Remove files from the $" and always use require
ActiveSupport
::
Dependencies
.
mechanism
=
config
.
cache_classes
?
:require
:
:load
end
# Loads support for "whiny nil" (noisy warnings when methods are invoked
# on +nil+ values) if Configuration#whiny_nils is true.
initializer
:initialize_whiny_nils
do
require
'active_support/whiny_nil'
if
config
.
whiny_nils
end
# Sets the default value for Time.zone
# If assigned value cannot be matched to a TimeZone, an exception will be raised.
initializer
:initialize_time_zone
do
require
'active_support/core_ext/time/zones'
zone_default
=
Time
.
__send__
(
:get_zone
,
config
.
time_zone
)
unless
zone_default
raise
\
'Value assigned to config.time_zone not recognized.'
+
'Run "rake -D time" for a list of tasks for finding appropriate time zone names.'
end
Time
.
zone_default
=
zone_default
end
# Set the i18n configuration from config.i18n but special-case for the load_path which should be
# appended to what's already set instead of overwritten.
initializer
:initialize_i18n
do
require
'active_support/i18n'
config
.
i18n
.
each
do
|
setting
,
value
|
if
setting
==
:load_path
I18n
.
load_path
+=
value
else
I18n
.
send
(
"
#{
setting
}
="
,
value
)
end
end
ActionDispatch
::
Callbacks
.
to_prepare
do
I18n
.
reload!
end
end
initializer
:set_clear_dependencies_hook
do
unless
config
.
cache_classes
ActionDispatch
::
Callbacks
.
after
do
ActiveSupport
::
Dependencies
.
clear
end
end
end
initializer
:initialize_notifications
do
require
'active_support/notifications'
if
config
.
colorize_logging
==
false
Rails
::
Subscriber
.
colorize_logging
=
false
config
.
generators
.
colorize_logging
=
false
end
ActiveSupport
::
Notifications
.
subscribe
do
|*
args
|
Rails
::
Subscriber
.
dispatch
(
args
)
end
end
private
def
expand_load_path
(
load_paths
)
load_paths
.
map
{
|
path
|
Dir
.
glob
(
path
.
to_s
)
}.
flatten
.
uniq
end
end
end
railties/lib/rails/configuration.rb
浏览文件 @
c8cc8a98
...
...
@@ -62,10 +62,8 @@ def config_key_regexp
/^(
#{
bits
}
)(?:=)?$/
end
# TODO Remove :active_support as special case by adding a railtie
# for it and for I18n
def
config_keys
([
:active_support
]
+
Railtie
.
plugin_names
)
.
map
{
|
n
|
n
.
to_s
}.
uniq
Railtie
.
plugin_names
.
map
{
|
n
|
n
.
to_s
}.
uniq
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录