提交 99c042b3 编写于 作者: R Rafael Mendonça França

Merge pull request #19867 from radar/rename-app-rails-loader

Remove redundant 'Rails' from Rails::AppRailsLoader constant
......@@ -53,11 +53,11 @@ require "rails/cli"
```
The file `railties/lib/rails/cli` in turn calls
`Rails::AppRailsLoader.exec_app_rails`.
`Rails::AppLoader.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.
......
......@@ -2,7 +2,7 @@
require 'rails/version'
module Rails
module AppRailsLoader
module AppLoader # :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
......
......@@ -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::AppRailsLoader.exec_app_rails
Rails::AppLoader.exec_app
require 'rails/ruby_version_check'
Signal.trap("INT") { puts; exit(1) }
......
......@@ -2,10 +2,10 @@
require 'abstract_unit'
require 'rails/app_rails_loader'
class AppRailsLoaderTest < ActiveSupport::TestCase
class AppLoaderTest < ActiveSupport::TestCase
def loader
@loader ||= Class.new do
extend Rails::AppRailsLoader
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::AppRailsLoader::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.
先完成此消息的编辑!
想要评论请 注册