Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
1e410972
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,发现更多精彩内容 >>
提交
1e410972
编写于
12月 31, 2009
作者:
C
Carl Lerche
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fully remove config.frameworks in favor of requires in boot.rb
上级
783caae5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
24 addition
and
38 deletion
+24
-38
railties/lib/rails/application.rb
railties/lib/rails/application.rb
+3
-1
railties/lib/rails/configuration.rb
railties/lib/rails/configuration.rb
+1
-20
railties/lib/rails/generators/rails/app/templates/config/application.rb
...ails/generators/rails/app/templates/config/application.rb
+0
-8
railties/lib/rails/generators/rails/app/templates/config/boot.rb
...s/lib/rails/generators/rails/app/templates/config/boot.rb
+9
-0
railties/test/application/configuration_test.rb
railties/test/application/configuration_test.rb
+2
-1
railties/test/application/initializer_test.rb
railties/test/application/initializer_test.rb
+2
-2
railties/test/generators/app_generator_test.rb
railties/test/generators/app_generator_test.rb
+5
-4
railties/test/initializer/path_test.rb
railties/test/initializer/path_test.rb
+2
-2
未找到文件。
railties/lib/rails/application.rb
浏览文件 @
1e410972
...
...
@@ -273,7 +273,9 @@ def call(env)
# For each framework, search for instrument file with Notifications hooks.
#
initializer
:load_notifications_hooks
do
config
.
frameworks
.
each
do
|
framework
|
frameworks
=
[
:active_record
,
:action_controller
,
:action_view
,
:action_mailer
,
:active_resource
]
frameworks
.
each
do
|
framework
|
begin
require
"
#{
framework
}
/notifications"
rescue
LoadError
=>
e
...
...
railties/lib/rails/configuration.rb
浏览文件 @
1e410972
...
...
@@ -59,7 +59,7 @@ class Configuration < Plugin::Configuration
attr_writer
:cache_store
,
:controller_paths
,
:database_configuration_file
,
:eager_load_paths
,
:
frameworks
,
:framework_root_path
,
:
i18n
,
:load_paths
,
:i18n
,
:load_paths
,
:log_level
,
:log_path
,
:paths
,
:routes_configuration_file
,
:view_path
...
...
@@ -134,21 +134,6 @@ def threadsafe!
self
end
def
framework_paths
paths
=
%w(railties railties/lib activesupport/lib)
paths
<<
'actionpack/lib'
if
frameworks
.
include?
(
:action_controller
)
||
frameworks
.
include?
(
:action_view
)
[
:active_record
,
:action_mailer
,
:active_resource
,
:action_web_service
].
each
do
|
framework
|
paths
<<
"
#{
framework
.
to_s
.
gsub
(
'_'
,
''
)
}
/lib"
if
frameworks
.
include?
(
framework
)
end
paths
.
map
{
|
dir
|
"
#{
framework_root_path
}
/
#{
dir
}
"
}.
select
{
|
dir
|
File
.
directory?
(
dir
)
}
end
def
framework_root_path
defined?
(
::
RAILS_FRAMEWORK_ROOT
)
?
::
RAILS_FRAMEWORK_ROOT
:
"
#{
root
}
/vendor/rails"
end
# Loads and returns the contents of the #database_configuration_file. The
# contents of the file are processed via ERB before being sent through
# YAML::load.
...
...
@@ -239,10 +224,6 @@ def log_level
@log_level
||=
RAILS_ENV
==
'production'
?
:info
:
:debug
end
def
frameworks
@frameworks
||=
[
:active_record
,
:action_controller
,
:action_view
,
:action_mailer
,
:active_resource
]
end
def
i18n
@i18n
||=
begin
i18n
=
ActiveSupport
::
OrderedOptions
.
new
...
...
railties/lib/rails/generators/rails/app/templates/config/application.rb
浏览文件 @
1e410972
...
...
@@ -13,16 +13,8 @@ class Application < Rails::Application
# :all can be used as a placeholder for all plugins not explicitly named
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Skip frameworks you're not going to use. To use Rails without a database,
# you must remove the Active Record framework.
<
% if
options
[
:skip_activerecord
]
-
%>
config.frameworks -= [ :active_record ]
<% else -%>
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
# Activate observers that should always be running
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
<
% end
-
%>
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names.
...
...
railties/lib/rails/generators/rails/app/templates/config/boot.rb
浏览文件 @
1e410972
...
...
@@ -14,3 +14,12 @@
end
require
'rails'
# To skip frameworks you're not going to use, remove require "rails" and
# list the frameworks that you are going to use.
#
# require "active_model/rails"
# require "active_record/rails"
# require "action_controller/rails"
# require "action_view/rails"
# require "action_mailer/rails"
# require "active_resource/rails"
\ No newline at end of file
railties/test/application/configuration_test.rb
浏览文件 @
1e410972
...
...
@@ -75,10 +75,11 @@ def setup
test
"the application can be marked as threadsafe when there are no frameworks"
do
FileUtils
.
rm_rf
(
"
#{
app_path
}
/config/environments"
)
add_to_config
<<-
RUBY
config.frameworks = []
config.threadsafe!
RUBY
use_frameworks
[]
assert_nothing_raised
do
require
"
#{
app_path
}
/config/application"
end
...
...
railties/test/application/initializer_test.rb
浏览文件 @
1e410972
...
...
@@ -7,7 +7,6 @@ class InitializerTest < Test::Unit::TestCase
def
setup
build_app
boot_rails
require
"rails"
end
test
"initializing an application adds the application paths to the load path"
do
...
...
@@ -51,8 +50,9 @@ module Zoo::ReptileHouse ; end
assert_nothing_raised
NameError
do
add_to_config
<<-
RUBY
config.root = "
#{
app_path
}
"
config.frameworks = []
RUBY
use_frameworks
[]
require
"
#{
app_path
}
/config/environment"
end
end
...
...
railties/test/generators/app_generator_test.rb
浏览文件 @
1e410972
...
...
@@ -63,10 +63,11 @@ def test_config_database_is_not_added_if_skip_activerecord_is_given
assert_no_file
"config/database.yml"
end
def
test_activerecord_is_removed_from_frameworks_if_skip_activerecord_is_given
run_generator
[
"--skip-activerecord"
]
assert_file
"config/application.rb"
,
/config\.frameworks \-= \[ :active_record \]/
end
# TODO: Bring this back using requires
# def test_activerecord_is_removed_from_frameworks_if_skip_activerecord_is_given
# run_generator ["--skip-activerecord"]
# assert_file "config/application.rb", /config\.frameworks \-= \[ :active_record \]/
# end
def
test_prototype_and_test_unit_are_added_by_default
run_generator
...
...
railties/test/initializer/path_test.rb
浏览文件 @
1e410972
...
...
@@ -7,14 +7,14 @@ class PathTest < Test::Unit::TestCase
def
setup
build_app
boot_rails
require
"rails"
add_to_config
<<-
RUBY
config.root = "
#{
app_path
}
"
config.frameworks = [:action_controller, :action_view, :action_mailer, :active_record]
config.after_initialize do
ActionController::Base.session_store = nil
end
RUBY
use_frameworks
[
:action_controller
,
:action_view
,
:action_mailer
,
:active_record
]
require
"rails"
require
"
#{
app_path
}
/config/environment"
@paths
=
Rails
.
application
.
config
.
paths
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录