Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
9cfd1d44
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,发现更多精彩内容 >>
提交
9cfd1d44
编写于
6月 19, 2009
作者:
Y
Yehuda Katz + Carl Lerche
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Get more tests to pass
上级
f2aea4d3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
76 addition
and
5 deletion
+76
-5
railties/lib/initializer.rb
railties/lib/initializer.rb
+71
-2
railties/test/generator_lookup_test.rb
railties/test/generator_lookup_test.rb
+5
-3
未找到文件。
railties/lib/initializer.rb
浏览文件 @
9cfd1d44
require
"pathname"
module
Rails
class
Configuration
attr_accessor
:cache_classes
,
:load_paths
,
:eager_load_paths
,
:framework_paths
,
:load_once_paths
,
:gems_dependencies_loaded
,
:after_initialize_blocks
,
:frameworks
,
:framework_root_path
,
:root_path
,
:plugin_paths
,
:plugins
,
:plugin_loader
,
:plugin_locators
,
:gems
,
:loaded_plugins
,
:reload_plugins
,
:i18n
:i18n
,
:gems
def
initialize
@framework_paths
=
[]
...
...
@@ -68,6 +70,21 @@ def default_i18n
i18n
end
# Adds a single Gem dependency to the rails application. By default, it will require
# the library with the same name as the gem. Use :lib to specify a different name.
#
# # gem 'aws-s3', '>= 0.4.0'
# # require 'aws/s3'
# config.gem 'aws-s3', :lib => 'aws/s3', :version => '>= 0.4.0', \
# :source => "http://code.whytheluckystiff.net"
#
# To require a library be installed, but not attempt to load it, pass :lib => false
#
# config.gem 'qrp', :version => '0.4.1', :lib => false
def
gem
(
name
,
options
=
{})
@gems
<<
Rails
::
GemDependency
.
new
(
name
,
options
)
end
def
default_gems
[]
end
...
...
@@ -656,11 +673,63 @@ def self.run(initializer = nil, config = nil)
# TODO: w0t?
module
Rails
class
<<
self
# The Configuration instance used to configure the Rails environment
def
configuration
@@configuration
end
def
configuration
=
(
configuration
)
@@configuration
=
configuration
end
def
initialized?
@initialized
||
false
end
def
initialized
=
(
initialized
)
@initialized
||=
initialized
end
def
logger
if
defined?
(
RAILS_DEFAULT_LOGGER
)
RAILS_DEFAULT_LOGGER
else
nil
end
end
def
backtrace_cleaner
@@backtrace_cleaner
||=
begin
# Relies on ActiveSupport, so we have to lazy load to postpone definition until AS has been loaded
require
'rails/backtrace_cleaner'
Rails
::
BacktraceCleaner
.
new
end
end
def
root
Pathname
.
new
(
RAILS_ROOT
)
if
defined?
(
RAILS_ROOT
)
end
end
def
env
@_env
||=
ActiveSupport
::
StringInquirer
.
new
(
RAILS_ENV
)
end
def
cache
RAILS_CACHE
end
def
version
VERSION
::
STRING
end
def
public_path
@@public_path
||=
self
.
root
?
File
.
join
(
self
.
root
,
"public"
)
:
"public"
end
def
public_path
=
(
path
)
@@public_path
=
path
end
end
class
OrderedOptions
<
Array
#:nodoc:
def
[]=
(
key
,
value
)
key
=
key
.
to_sym
...
...
railties/test/generator_lookup_test.rb
浏览文件 @
9cfd1d44
...
...
@@ -7,9 +7,11 @@ def setup
# We need to add our testing plugin directory to the plugin paths so
# the locator knows where to look for our plugins
@configuration
.
plugin_paths
+=
@fixture_dirs
.
map
{
|
fd
|
plugin_fixture_path
(
fd
)}
@initializer
=
Rails
::
Initializer
.
new
(
@configuration
)
@initializer
.
add_plugin_load_paths
@initializer
.
load_plugins
@initializer
=
Rails
::
Initializer
.
default
@initializer
.
config
=
@configuration
@initializer
.
run
(
:add_plugin_load_paths
)
@initializer
.
run
(
:load_plugins
)
@initializer
.
run
(
:set_root_path
)
load
'rails_generator.rb'
require
'rails_generator/scripts'
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录