Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
426348b4
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,发现更多精彩内容 >>
提交
426348b4
编写于
12月 21, 2009
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update routes.rb template to use App name
上级
36624b2c
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
29 addition
and
14 deletion
+29
-14
railties/lib/rails/application.rb
railties/lib/rails/application.rb
+4
-0
railties/lib/rails/generators/actions.rb
railties/lib/rails/generators/actions.rb
+1
-1
railties/lib/rails/generators/rails/app/app_generator.rb
railties/lib/rails/generators/rails/app/app_generator.rb
+3
-3
railties/lib/rails/generators/rails/app/templates/config/routes.rb
...lib/rails/generators/rails/app/templates/config/routes.rb
+1
-1
railties/test/application/initializer_test.rb
railties/test/application/initializer_test.rb
+10
-0
railties/test/application/routing_test.rb
railties/test/application/routing_test.rb
+7
-7
railties/test/initializer/initialize_i18n_test.rb
railties/test/initializer/initialize_i18n_test.rb
+1
-0
railties/test/initializer/path_test.rb
railties/test/initializer/path_test.rb
+1
-0
railties/test/paths_test.rb
railties/test/paths_test.rb
+1
-2
未找到文件。
railties/lib/rails/application.rb
浏览文件 @
426348b4
...
...
@@ -41,6 +41,10 @@ def load_tasks
end
end
def
routes
ActionController
::
Routing
::
Routes
end
def
call
(
env
)
new
.
call
(
env
)
end
...
...
railties/lib/rails/generators/actions.rb
浏览文件 @
426348b4
...
...
@@ -273,7 +273,7 @@ def freeze!(args={})
#
def
route
(
routing_code
)
log
:route
,
routing_code
sentinel
=
"
ActionController::Routing::R
outes.draw do |map|"
sentinel
=
"
r
outes.draw do |map|"
in_root
do
inject_into_file
'config/routes.rb'
,
"
\n
#{
routing_code
}
\n
"
,
{
:after
=>
sentinel
,
:verbose
=>
false
}
...
...
railties/lib/rails/generators/rails/app/app_generator.rb
浏览文件 @
426348b4
...
...
@@ -62,9 +62,9 @@ def create_config_files
empty_directory
"config"
inside
"config"
do
copy_fil
e
"routes.rb"
template
"application.rb"
template
"environment.rb"
templat
e
"routes.rb"
template
"application.rb"
template
"environment.rb"
directory
"environments"
directory
"initializers"
...
...
railties/lib/rails/generators/rails/app/templates/config/routes.rb
浏览文件 @
426348b4
ActionController
::
Routing
::
R
outes
.
draw
do
|
map
|
<
%= app_const %>.r
outes.draw do |map|
# The priority is based upon order of creation:
# first created -> highest priority.
...
...
railties/test/application/initializer_test.rb
浏览文件 @
426348b4
...
...
@@ -15,6 +15,7 @@ def setup
Rails
::
Initializer
.
run
do
|
config
|
config
.
root
=
app_path
end
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
assert
$:
.
include?
(
"
#{
app_path
}
/app/models"
)
...
...
@@ -45,6 +46,7 @@ module Zoo::ReptileHouse ; end
config
.
root
=
app_path
config
.
eager_load_paths
=
"
#{
app_path
}
/lib"
end
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
...
...
@@ -55,6 +57,7 @@ module Zoo::ReptileHouse ; end
app_file
"config/environments/development.rb"
,
"$initialize_test_set_from_env = 'success'"
assert_nil
$initialize_test_set_from_env
Rails
::
Initializer
.
run
{
|
config
|
config
.
root
=
app_path
}
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
assert_equal
"success"
,
$initialize_test_set_from_env
end
...
...
@@ -75,6 +78,7 @@ module Zoo::ReptileHouse ; end
config
.
after_initialize
{
$test_after_initialize_block1
=
"success"
}
config
.
after_initialize
{
$test_after_initialize_block2
=
"congratulations"
}
end
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
assert_equal
"success"
,
$test_after_initialize_block1
...
...
@@ -88,6 +92,7 @@ module Zoo::ReptileHouse ; end
config
.
after_initialize
# don't pass a block, this is what we're testing!
config
.
after_initialize
{
$test_after_initialize_block2
=
"congratulations"
}
end
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
assert_equal
"success"
,
$test_after_initialize_block1
...
...
@@ -100,6 +105,7 @@ module Zoo::ReptileHouse ; end
config
.
root
=
app_path
config
.
i18n
.
default_locale
=
:de
end
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
assert_equal
:de
,
I18n
.
default_locale
...
...
@@ -137,6 +143,7 @@ module Zoo::ReptileHouse ; end
config
.
root
=
app_path
config
.
action_controller
.
session_store
=
:cookie_store
end
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
assert
!
Rails
.
application
.
config
.
middleware
.
include?
(
ActiveRecord
::
SessionStore
)
...
...
@@ -155,6 +162,7 @@ module Zoo::ReptileHouse ; end
c
.
root
=
app_path
c
.
action_controller
.
session_store
=
:active_record_store
end
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
expects
=
[
ActiveRecord
::
ConnectionAdapters
::
ConnectionManagement
,
ActiveRecord
::
QueryCache
,
ActiveRecord
::
SessionStore
]
...
...
@@ -179,6 +187,7 @@ module Zoo::ReptileHouse ; end
c
.
root
=
app_path
c
.
frameworks
-=
[
:action_view
]
end
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
assert_equal
nil
,
ActionMailer
::
Base
.
template_root
...
...
@@ -189,6 +198,7 @@ module Zoo::ReptileHouse ; end
Rails
::
Initializer
.
run
do
|
c
|
c
.
root
=
app_path
end
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
assert_instance_of
Pathname
,
Rails
.
root
end
...
...
railties/test/application/routing_test.rb
浏览文件 @
426348b4
...
...
@@ -29,7 +29,7 @@ def index
RUBY
app_file
'config/routes.rb'
,
<<-
RUBY
A
ctionController::Routing::R
outes.draw do |map|
A
ppTemplate.r
outes.draw do |map|
match ':controller(/:action)'
end
RUBY
...
...
@@ -56,7 +56,7 @@ def index
RUBY
app_file
'config/routes.rb'
,
<<-
RUBY
A
ctionController::Routing::R
outes.draw do |map|
A
ppTemplate.r
outes.draw do |map|
match ':controller(/:action)'
end
RUBY
...
...
@@ -88,7 +88,7 @@ def index
RUBY
app_file
'config/routes.rb'
,
<<-
RUBY
A
ctionController::Routing::R
outes.draw do |map|
A
ppTemplate.r
outes.draw do |map|
match ':controller(/:action)'
end
RUBY
...
...
@@ -110,7 +110,7 @@ def index
RUBY
app_file
'config/routes.rb'
,
<<-
RUBY
A
ctionController::Routing::R
outes.draw do |map|
A
ppTemplate.r
outes.draw do |map|
match 'foo', :to => 'foo#index'
end
RUBY
...
...
@@ -125,7 +125,7 @@ def index
RUBY
plugin
.
write
'config/routes.rb'
,
<<-
RUBY
A
ctionController::Routing::R
outes.draw do |map|
A
ppTemplate.r
outes.draw do |map|
match 'bar', :to => 'bar#index'
end
RUBY
...
...
@@ -152,7 +152,7 @@ def baz
RUBY
app_file
'config/routes.rb'
,
<<-
RUBY
A
ctionController::Routing::R
outes.draw do |map|
A
ppTemplate.r
outes.draw do |map|
match 'foo', :to => 'foo#bar'
end
RUBY
...
...
@@ -161,7 +161,7 @@ def baz
assert_equal
'bar'
,
last_response
.
body
app_file
'config/routes.rb'
,
<<-
RUBY
A
ctionController::Routing::R
outes.draw do |map|
A
ppTemplate.r
outes.draw do |map|
match 'foo', :to => 'foo#baz'
end
RUBY
...
...
railties/test/initializer/initialize_i18n_test.rb
浏览文件 @
426348b4
...
...
@@ -16,6 +16,7 @@ def setup
c
.
root
=
app_path
c
.
i18n
.
load_path
<<
"my/other/locale.yml"
end
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
#{RAILS_FRAMEWORK_ROOT}/railties/test/fixtures/plugins/engines/engine/config/locales/en.yml
...
...
railties/test/initializer/path_test.rb
浏览文件 @
426348b4
...
...
@@ -14,6 +14,7 @@ def setup
ActionController
::
Base
.
session_store
=
nil
end
end
Object
.
const_set
(
:AppTemplate
,
Rails
.
application
)
Rails
.
initialize!
@paths
=
Rails
.
application
.
config
.
paths
end
...
...
railties/test/paths_test.rb
浏览文件 @
426348b4
...
...
@@ -2,7 +2,6 @@
require
'rails/paths'
class
PathsTest
<
ActiveSupport
::
TestCase
def
setup
@root
=
Rails
::
Application
::
Root
.
new
(
"/foo/bar"
)
end
...
...
@@ -228,4 +227,4 @@ def setup
@root
.
app
.
eager_load!
assert_equal
[
"/foo/bar/app"
],
@root
.
load_paths
end
end
\ No newline at end of file
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录