Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
99c042b3
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,发现更多精彩内容 >>
提交
99c042b3
编写于
5月 27, 2015
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #19867 from radar/rename-app-rails-loader
Remove redundant 'Rails' from Rails::AppRailsLoader constant
上级
7a9651cf
f9640b09
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
14 addition
and
14 deletion
+14
-14
guides/source/initialization.md
guides/source/initialization.md
+3
-3
railties/lib/rails/app_loader.rb
railties/lib/rails/app_loader.rb
+2
-2
railties/lib/rails/cli.rb
railties/lib/rails/cli.rb
+1
-1
railties/test/app_loader_test.rb
railties/test/app_loader_test.rb
+8
-8
未找到文件。
guides/source/initialization.md
浏览文件 @
99c042b3
...
...
@@ -53,11 +53,11 @@ require "rails/cli"
```
The file
`railties/lib/rails/cli`
in turn calls
`Rails::App
RailsLoader.exec_app_rails
`
.
`Rails::App
Loader.exec_app
`
.
### `railties/lib/rails/app_
rails_
loader.rb`
### `railties/lib/rails/app_loader.rb`
The primary goal of the function
`exec_app
_rails
`
is to execute your app's
The primary goal of the function
`exec_app`
is to execute your app's
`bin/rails`
. If the current directory does not have a
`bin/rails`
, it will
navigate upwards until it finds a
`bin/rails`
executable. Thus one can invoke a
`rails`
command from anywhere inside a rails application.
...
...
railties/lib/rails/app_
rails_
loader.rb
→
railties/lib/rails/app_loader.rb
浏览文件 @
99c042b3
...
...
@@ -2,7 +2,7 @@
require
'rails/version'
module
Rails
module
App
RailsLoader
module
App
Loader
# :nodoc:
extend
self
RUBY
=
Gem
.
ruby
...
...
@@ -29,7 +29,7 @@ module AppRailsLoader
EOS
def
exec_app
_rails
def
exec_app
original_cwd
=
Dir
.
pwd
loop
do
...
...
railties/lib/rails/cli.rb
浏览文件 @
99c042b3
...
...
@@ -2,7 +2,7 @@
# If we are inside a Rails application this method performs an exec and thus
# the rest of this script is not run.
Rails
::
App
RailsLoader
.
exec_app_rails
Rails
::
App
Loader
.
exec_app
require
'rails/ruby_version_check'
Signal
.
trap
(
"INT"
)
{
puts
;
exit
(
1
)
}
...
...
railties/test/app_
rails_
loader_test.rb
→
railties/test/app_loader_test.rb
浏览文件 @
99c042b3
...
...
@@ -2,10 +2,10 @@
require
'abstract_unit'
require
'rails/app_rails_loader'
class
App
Rails
LoaderTest
<
ActiveSupport
::
TestCase
class
AppLoaderTest
<
ActiveSupport
::
TestCase
def
loader
@loader
||=
Class
.
new
do
extend
Rails
::
App
Rails
Loader
extend
Rails
::
AppLoader
def
self
.
exec_arguments
@exec_arguments
...
...
@@ -23,7 +23,7 @@ def write(filename, contents=nil)
end
def
expects_exec
(
exe
)
assert_equal
[
Rails
::
App
Rails
Loader
::
RUBY
,
exe
],
loader
.
exec_arguments
assert_equal
[
Rails
::
AppLoader
::
RUBY
,
exe
],
loader
.
exec_arguments
end
setup
do
...
...
@@ -38,20 +38,20 @@ def expects_exec(exe)
test
"is not in a Rails application if
#{
exe
}
is not found in the current or parent directories"
do
def
loader
.
find_executables
;
end
assert
!
loader
.
exec_app
_rails
assert
!
loader
.
exec_app
end
test
"is not in a Rails application if
#{
exe
}
exists but is a folder"
do
FileUtils
.
mkdir_p
(
exe
)
assert
!
loader
.
exec_app
_rails
assert
!
loader
.
exec_app
end
[
'APP_PATH'
,
'ENGINE_PATH'
].
each
do
|
keyword
|
test
"is in a Rails application if
#{
exe
}
exists and contains
#{
keyword
}
"
do
write
exe
,
keyword
loader
.
exec_app
_rails
loader
.
exec_app
expects_exec
exe
end
...
...
@@ -59,7 +59,7 @@ def loader.find_executables; end
test
"is not in a Rails application if
#{
exe
}
exists but doesn't contain
#{
keyword
}
"
do
write
exe
assert
!
loader
.
exec_app
_rails
assert
!
loader
.
exec_app
end
test
"is in a Rails application if parent directory has
#{
exe
}
containing
#{
keyword
}
and chdirs to the root directory"
do
...
...
@@ -68,7 +68,7 @@ def loader.find_executables; end
Dir
.
chdir
(
'foo/bar'
)
loader
.
exec_app
_rails
loader
.
exec_app
expects_exec
exe
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录