[Railties] require_relative => require

This basically reverts 618268b4b9
This commit is contained in:
Akira Matsuda 2017-10-21 22:08:33 +09:00
parent 01ae396602
commit 6a728491b6
74 changed files with 115 additions and 115 deletions

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "rails/ruby_version_check"
require "rails/ruby_version_check"
require "pathname"
@ -11,8 +11,8 @@ require "active_support/core_ext/module/delegation"
require "active_support/core_ext/array/extract_options"
require "active_support/core_ext/object/blank"
require_relative "rails/application"
require_relative "rails/version"
require "rails/application"
require "rails/version"
require "active_support/railtie"
require "action_dispatch/railtie"
@ -50,7 +50,7 @@ module Rails
def backtrace_cleaner
@backtrace_cleaner ||= begin
# Relies on Active Support, so we have to lazy load to postpone definition until Active Support has been loaded
require_relative "rails/backtrace_cleaner"
require "rails/backtrace_cleaner"
Rails::BacktraceCleaner.new
end
end

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require "rdoc/task"
require_relative "generator"
require "rails/api/generator"
module Rails
module API

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require "pathname"
require_relative "version"
require "rails/version"
module Rails
module AppLoader # :nodoc:
@ -56,7 +56,7 @@ EOS
$stderr.puts(BUNDLER_WARNING)
Object.const_set(:APP_PATH, File.expand_path("config/application", Dir.pwd))
require File.expand_path("../boot", APP_PATH)
require_relative "commands"
require "rails/commands"
break
end
end

View File

@ -7,8 +7,8 @@ require "active_support/key_generator"
require "active_support/message_verifier"
require "active_support/encrypted_configuration"
require "active_support/deprecation"
require_relative "engine"
require_relative "secrets"
require "rails/engine"
require "rails/secrets"
module Rails
# An Engine with the responsibility of coordinating the whole boot process.
@ -474,7 +474,7 @@ module Rails
def run_tasks_blocks(app) #:nodoc:
railties.each { |r| r.run_tasks_blocks(app) }
super
require_relative "tasks"
require "rails/tasks"
task :environment do
ActiveSupport.on_load(:before_initialize) { config.eager_load = false }

View File

@ -4,7 +4,7 @@ require "fileutils"
require "active_support/notifications"
require "active_support/dependencies"
require "active_support/descendants_tracker"
require_relative "../secrets"
require "rails/secrets"
module Rails
class Application

View File

@ -2,8 +2,8 @@
require "active_support/core_ext/kernel/reporting"
require "active_support/file_update_checker"
require_relative "../engine/configuration"
require_relative "../source_annotation_extractor"
require "rails/engine/configuration"
require "rails/source_annotation_extractor"
module Rails
class Application

View File

@ -1,15 +1,15 @@
# frozen_string_literal: true
require_relative "app_loader"
require "rails/app_loader"
# If we are inside a Rails application this method performs an exec and thus
# the rest of this script is not run.
Rails::AppLoader.exec_app
require_relative "ruby_version_check"
require "rails/ruby_version_check"
Signal.trap("INT") { puts; exit(1) }
require_relative "command"
require "rails/command"
if ARGV.first == "plugin"
ARGV.shift

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "code_statistics_calculator"
require "rails/code_statistics_calculator"
require "active_support/core_ext/enumerable"
class CodeStatistics #:nodoc:

View File

@ -6,7 +6,7 @@ require "erb"
require "active_support/core_ext/string/filters"
require "active_support/core_ext/string/inflections"
require_relative "actions"
require "rails/command/actions"
module Rails
module Command

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "command"
require "rails/command"
aliases = {
"g" => "generate",

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "../../generators"
require_relative "../../generators/rails/app/app_generator"
require "rails/generators"
require "rails/generators/rails/app/app_generator"
module Rails
module Generators

View File

@ -3,7 +3,7 @@
require "irb"
require "irb/completion"
require_relative "../../command/environment_argument"
require "rails/command/environment_argument"
module Rails
class Console

View File

@ -67,15 +67,15 @@ module Rails
def master_key_generator
require_relative "../../generators"
require_relative "../../generators/rails/master_key/master_key_generator"
require "rails/generators"
require "rails/generators/rails/master_key/master_key_generator"
Rails::Generators::MasterKeyGenerator.new
end
def credentials_generator
require_relative "../../generators"
require_relative "../../generators/rails/credentials/credentials_generator"
require "rails/generators"
require "rails/generators/rails/credentials/credentials_generator"
Rails::Generators::CredentialsGenerator.new
end

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../command/environment_argument"
require "rails/command/environment_argument"
module Rails
class DBConsole

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../generators"
require "rails/generators"
module Rails
module Command

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../generators"
require "rails/generators"
module Rails
module Command

View File

@ -36,8 +36,8 @@ module Rails
private
def run_plugin_generator(plugin_args)
require_relative "../../generators"
require_relative "../../generators/rails/plugin/plugin_generator"
require "rails/generators"
require "rails/generators/rails/plugin/plugin_generator"
Rails::Generators::PluginGenerator.start plugin_args
end
end

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require "active_support"
require_relative "../../secrets"
require "rails/secrets"
module Rails
module Command
@ -56,8 +56,8 @@ module Rails
private
def generator
require_relative "../../generators"
require_relative "../../generators/rails/encrypted_secrets/encrypted_secrets_generator"
require "rails/generators"
require "rails/generators/rails/encrypted_secrets/encrypted_secrets_generator"
Rails::Generators::EncryptedSecretsGenerator
end

View File

@ -6,7 +6,7 @@ require "action_dispatch"
require "rails"
require "active_support/deprecation"
require "active_support/core_ext/string/filters"
require_relative "../../dev_caching"
require "rails/dev_caching"
module Rails
class Server < ::Rack::Server

View File

@ -1,8 +1,8 @@
# frozen_string_literal: true
require_relative "../../command"
require_relative "../../test_unit/runner"
require_relative "../../test_unit/reporter"
require "rails/command"
require "rails/test_unit/runner"
require "rails/test_unit/reporter"
module Rails
module Command

View File

@ -2,8 +2,8 @@
require "active_support/ordered_options"
require "active_support/core_ext/object"
require_relative "paths"
require_relative "rack"
require "rails/paths"
require "rails/rack"
module Rails
module Configuration

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "railtie"
require_relative "engine/railties"
require "rails/railtie"
require "rails/engine/railties"
require "active_support/core_ext/module/delegation"
require "pathname"
require "thread"
@ -439,8 +439,8 @@ module Rails
# Load console and invoke the registered hooks.
# Check <tt>Rails::Railtie.console</tt> for more info.
def load_console(app = self)
require_relative "console/app"
require_relative "console/helpers"
require "rails/console/app"
require "rails/console/helpers"
run_console_blocks(app)
self
end
@ -463,7 +463,7 @@ module Rails
# Load Rails generators and invoke the registered hooks.
# Check <tt>Rails::Railtie.generators</tt> for more info.
def load_generators(app = self)
require_relative "generators"
require "rails/generators"
run_generators_blocks(app)
Rails::Generators.configure!(app.config.generators)
self

View File

@ -6,4 +6,4 @@ unless defined?(APP_PATH)
end
end
require_relative "../commands"
require "rails/commands"

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../railtie/configuration"
require "rails/railtie/configuration"
module Rails
class Engine

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "../generators"
require_relative "../generators/rails/plugin/plugin_generator"
require "rails/generators"
require "rails/generators/rails/plugin/plugin_generator"
module Rails
class Engine

View File

@ -4,7 +4,7 @@ activesupport_path = File.expand_path("../../../activesupport/lib", __dir__)
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
require "thor/group"
require_relative "command"
require "rails/command"
require "active_support"
require "active_support/core_ext/object/blank"

View File

@ -3,10 +3,10 @@
require "fileutils"
require "digest/md5"
require "active_support/core_ext/string/strip"
require_relative "../version" unless defined?(Rails::VERSION)
require "rails/version" unless defined?(Rails::VERSION)
require "open-uri"
require "uri"
require_relative "../generators"
require "rails/generators"
require "active_support/core_ext/array/extract_options"
module Rails

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../named_base"
require "rails/generators/named_base"
module Css # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../named_base"
require "rails/generators/named_base"
module Css # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "named_base"
require "rails/generators/named_base"
module Erb # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../erb"
require "rails/generators/erb"
module Erb # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../erb"
require "rails/generators/erb"
module Erb # :nodoc:
module Generators # :nodoc:

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "../../erb"
require_relative "../../resource_helpers"
require "rails/generators/erb"
require "rails/generators/resource_helpers"
module Erb # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../named_base"
require "rails/generators/named_base"
module Js # :nodoc:
module Generators # :nodoc:

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require "active_support/concern"
require_relative "actions/create_migration"
require "rails/generators/actions/create_migration"
module Rails
module Generators

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "active_model"
require "rails/generators/active_model"
module Rails
module Generators

View File

@ -1,8 +1,8 @@
# frozen_string_literal: true
require "active_support/core_ext/module/introspection"
require_relative "base"
require_relative "generated_attribute"
require "rails/generators/base"
require "rails/generators/generated_attribute"
module Rails
module Generators

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../app_base"
require "rails/generators/app_base"
module Rails
module ActionMethods # :nodoc:
@ -161,7 +161,7 @@ module Rails
def master_key
return if options[:pretend]
require_relative "../master_key/master_key_generator"
require "rails/generators/rails/master_key/master_key_generator"
after_bundle do
Rails::Generators::MasterKeyGenerator.new([], quiet: options[:quiet]).add_master_key_file
@ -171,7 +171,7 @@ module Rails
def credentials
return if options[:pretend]
require_relative "../credentials/credentials_generator"
require "rails/generators/rails/credentials/credentials_generator"
after_bundle do
Rails::Generators::CredentialsGenerator.new([], quiet: options[:quiet]).add_credentials_file_silently
@ -559,7 +559,7 @@ module Rails
def handle_version_request!(argument)
if ["--version", "-v"].include?(argument)
require_relative "../../../version"
require "rails/version"
puts "Rails #{Rails::VERSION::STRING}"
exit(0)
end

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "../../base"
require_relative "../master_key/master_key_generator"
require "rails/generators/base"
require "rails/generators/rails/master_key/master_key_generator"
require "active_support/encrypted_configuration"
module Rails

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "../../base"
require_relative "../../../secrets"
require "rails/generators/base"
require "rails/secrets"
module Rails
module Generators

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../base"
require "rails/generators/base"
require "pathname"
require "active_support/encrypted_file"

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../model_helpers"
require "rails/generators/model_helpers"
module Rails
module Generators

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require "active_support/core_ext/hash/slice"
require_relative "../app/app_generator"
require "rails/generators/rails/app/app_generator"
require "date"
module Rails

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "../../resource_helpers"
require_relative "../model/model_generator"
require "rails/generators/resource_helpers"
require "rails/generators/rails/model/model_generator"
module Rails
module Generators

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../resource/resource_generator"
require "rails/generators/rails/resource/resource_generator"
module Rails
module Generators

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../resource_helpers"
require "rails/generators/resource_helpers"
module Rails
module Generators

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "active_model"
require_relative "model_helpers"
require "rails/generators/active_model"
require "rails/generators/model_helpers"
module Rails
module Generators

View File

@ -1,9 +1,9 @@
# frozen_string_literal: true
require_relative "../generators"
require_relative "testing/behaviour"
require_relative "testing/setup_and_teardown"
require_relative "testing/assertions"
require "rails/generators"
require "rails/generators/testing/behaviour"
require "rails/generators/testing/setup_and_teardown"
require "rails/generators/testing/assertions"
require "fileutils"
module Rails

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "named_base"
require "rails/generators/named_base"
module TestUnit # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../test_unit"
require "rails/generators/test_unit"
module TestUnit # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../test_unit"
require "rails/generators/test_unit"
module TestUnit # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../test_unit"
require "rails/generators/test_unit"
module TestUnit # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../test_unit"
require "rails/generators/test_unit"
module TestUnit # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../test_unit"
require "rails/generators/test_unit"
module TestUnit # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../test_unit"
require "rails/generators/test_unit"
module TestUnit # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../test_unit"
require "rails/generators/test_unit"
module TestUnit # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../test_unit"
require "rails/generators/test_unit"
module TestUnit # :nodoc:
module Generators # :nodoc:

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "../../test_unit"
require_relative "../../resource_helpers"
require "rails/generators/test_unit"
require "rails/generators/resource_helpers"
module TestUnit # :nodoc:
module Generators # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../../test_unit"
require "rails/generators/test_unit"
module TestUnit # :nodoc:
module Generators # :nodoc:

View File

@ -6,7 +6,7 @@ require "active_support/core_ext/hash/reverse_merge"
require "active_support/core_ext/kernel/reporting"
require "active_support/testing/stream"
require "active_support/concern"
require_relative "../../generators"
require "rails/generators"
module Rails
module Generators

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "application_controller"
require "rails/application_controller"
require "action_dispatch/routing/inspector"
class Rails::InfoController < Rails::ApplicationController # :nodoc:

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "application_controller"
require "rails/application_controller"
class Rails::MailersController < Rails::ApplicationController # :nodoc:
prepend_view_path ActionDispatch::DebugExceptions::RESCUES_TEMPLATE_PATH

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true
require_relative "../test_unit/runner"
require_relative "../test_unit/reporter"
require "rails/test_unit/runner"
require "rails/test_unit/reporter"
Rails::TestUnitReporter.executable = "bin/test"

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "initializable"
require "rails/initializable"
require "active_support/inflector"
require "active_support/core_ext/module/introspection"
require "active_support/core_ext/module/delegation"

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../configuration"
require "rails/configuration"
module Rails
class Railtie

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../source_annotation_extractor"
require "rails/source_annotation_extractor"
desc "Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)"
task :notes do

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "../dev_caching"
require "rails/dev_caching"
namespace :dev do
desc "Toggle development mode caching on/off"

View File

@ -8,7 +8,7 @@ task "load_app" do
task update: [ "update:bin" ]
namespace :update do
require_relative "../engine/updater"
require "rails/engine/updater"
# desc "Adds new executables to the engine bin/ directory"
task :bin do
Rails::Engine::Updater.run(:create_bin_files)

View File

@ -9,8 +9,8 @@ namespace :app do
template = ENV["LOCATION"]
raise "No LOCATION value given. Please set LOCATION either as path to a file or a URL" if template.blank?
template = File.expand_path(template) if template !~ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://}
require_relative "../generators"
require_relative "../generators/rails/app/app_generator"
require "rails/generators"
require "rails/generators/rails/app/app_generator"
generator = Rails::Generators::AppGenerator.new [Rails.root], {}, { destination_root: Rails.root }
generator.apply template, verbose: false
end
@ -38,7 +38,7 @@ namespace :app do
end
namespace :update do
require_relative "../app_updater"
require "rails/app_updater"
# desc "Update config/boot.rb from your current rails install"
task :configs do

View File

@ -26,6 +26,6 @@ end.select { |name, dir| File.directory?(dir) }
desc "Report code statistics (KLOCs, etc) from the application or engine"
task :stats do
require_relative "../code_statistics"
require "rails/code_statistics"
CodeStatistics.new(*STATS_DIRECTORIES).to_s
end

View File

@ -8,7 +8,7 @@ require "active_support/test_case"
require "action_controller"
require "action_controller/test_case"
require "action_dispatch/testing/integration"
require_relative "generators/test_case"
require "rails/generators/test_case"
require "active_support/testing/autorun"

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "line_filtering"
require "rails/test_unit/line_filtering"
if defined?(Rake.application) && Rake.application.top_level_tasks.grep(/^(default$|test(:|$))/).any?
ENV["RAILS_ENV"] ||= Rake.application.options.show_tasks ? "development" : "test"

View File

@ -2,7 +2,7 @@
gem "minitest"
require "minitest"
require_relative "runner"
require "rails/test_unit/runner"
task default: :test

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
require_relative "application_controller"
require "rails/application_controller"
class Rails::WelcomeController < Rails::ApplicationController # :nodoc:
layout false