railties 6.0.0 → 7.1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +699 -245
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.md +99 -0
- data/README.rdoc +7 -8
- data/lib/minitest/rails_plugin.rb +80 -2
- data/lib/rails/all.rb +0 -1
- data/lib/rails/api/task.rb +37 -5
- data/lib/rails/app_updater.rb +9 -6
- data/lib/rails/application/bootstrap.rb +52 -14
- data/lib/rails/application/configuration.rb +327 -86
- data/lib/rails/application/default_middleware_stack.rb +33 -7
- data/lib/rails/application/dummy_config.rb +19 -0
- data/lib/rails/application/finisher.rb +94 -113
- data/lib/rails/application/routes_reloader.rb +17 -3
- data/lib/rails/application.rb +258 -201
- data/lib/rails/application_controller.rb +3 -4
- data/lib/rails/autoloaders/inflector.rb +21 -0
- data/lib/rails/autoloaders.rb +42 -42
- data/lib/rails/backtrace_cleaner.rb +13 -8
- data/lib/rails/cli.rb +5 -2
- data/lib/rails/code_statistics.rb +6 -4
- data/lib/rails/code_statistics_calculator.rb +16 -7
- data/lib/rails/command/actions.rb +10 -12
- data/lib/rails/command/base.rb +66 -46
- data/lib/rails/command/behavior.rb +3 -3
- data/lib/rails/command/environment_argument.rb +33 -17
- data/lib/rails/command/helpers/editor.rb +17 -12
- data/lib/rails/command.rb +90 -32
- data/lib/rails/commands/about/about_command.rb +14 -0
- data/lib/rails/commands/application/application_command.rb +2 -0
- data/lib/rails/commands/console/console_command.rb +17 -13
- data/lib/rails/commands/credentials/USAGE +54 -39
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +53 -0
- data/lib/rails/commands/credentials/credentials_command.rb +83 -60
- data/lib/rails/commands/db/system/change/change_command.rb +8 -2
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +39 -124
- data/lib/rails/commands/destroy/destroy_command.rb +3 -2
- data/lib/rails/commands/dev/dev_command.rb +1 -6
- data/lib/rails/commands/encrypted/USAGE +15 -20
- data/lib/rails/commands/encrypted/encrypted_command.rb +46 -35
- data/lib/rails/commands/gem_help/USAGE +16 -0
- data/lib/rails/commands/gem_help/gem_help_command.rb +13 -0
- data/lib/rails/commands/generate/generate_command.rb +3 -3
- data/lib/rails/commands/help/USAGE +15 -14
- data/lib/rails/commands/help/help_command.rb +21 -2
- data/lib/rails/commands/initializers/initializers_command.rb +1 -4
- data/lib/rails/commands/middleware/middleware_command.rb +17 -0
- data/lib/rails/commands/new/new_command.rb +2 -0
- data/lib/rails/commands/notes/notes_command.rb +5 -14
- data/lib/rails/commands/plugin/plugin_command.rb +2 -0
- data/lib/rails/commands/rake/rake_command.rb +27 -23
- data/lib/rails/commands/restart/restart_command.rb +14 -0
- data/lib/rails/commands/routes/routes_command.rb +13 -1
- data/lib/rails/commands/runner/USAGE +14 -12
- data/lib/rails/commands/runner/runner_command.rb +34 -21
- data/lib/rails/commands/secret/secret_command.rb +13 -0
- data/lib/rails/commands/secrets/USAGE +44 -43
- data/lib/rails/commands/secrets/secrets_command.rb +20 -38
- data/lib/rails/commands/server/server_command.rb +40 -64
- data/lib/rails/commands/test/USAGE +14 -0
- data/lib/rails/commands/test/test_command.rb +58 -16
- data/lib/rails/commands/unused_routes/unused_routes_command.rb +75 -0
- data/lib/rails/commands/version/version_command.rb +1 -0
- data/lib/rails/configuration.rb +53 -23
- data/lib/rails/console/app.rb +1 -4
- data/lib/rails/console/helpers.rb +2 -2
- data/lib/rails/deprecator.rb +7 -0
- data/lib/rails/engine/configuration.rb +54 -9
- data/lib/rails/engine/updater.rb +1 -1
- data/lib/rails/engine.rb +105 -81
- data/lib/rails/gem_version.rb +5 -5
- data/lib/rails/generators/actions/create_migration.rb +9 -5
- data/lib/rails/generators/actions.rb +275 -97
- data/lib/rails/generators/active_model.rb +28 -14
- data/lib/rails/generators/app_base.rb +487 -165
- data/lib/rails/generators/app_name.rb +3 -14
- data/lib/rails/generators/base.rb +42 -31
- data/lib/rails/generators/database.rb +41 -4
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +0 -1
- data/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +1 -1
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +2 -1
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +11 -11
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +8 -4
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +11 -28
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +7 -3
- data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +17 -0
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +8 -17
- data/lib/rails/generators/erb.rb +1 -2
- data/lib/rails/generators/generated_attribute.rb +60 -19
- data/lib/rails/generators/migration.rb +4 -8
- data/lib/rails/generators/model_helpers.rb +29 -4
- data/lib/rails/generators/named_base.rb +15 -15
- data/lib/rails/generators/rails/app/USAGE +23 -6
- data/lib/rails/generators/rails/app/app_generator.rb +151 -80
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +103 -0
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +44 -54
- data/lib/rails/generators/rails/app/templates/Rakefile.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +2 -2
- data/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/app/models/application_record.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +4 -9
- data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/bin/rails.tt +3 -3
- data/lib/rails/generators/rails/app/templates/bin/rake.tt +2 -2
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +19 -15
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +18 -23
- data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +5 -6
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +12 -11
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +17 -16
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +5 -5
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +12 -11
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +12 -11
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +17 -18
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +4 -4
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +14 -13
- data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +59 -0
- data/lib/rails/generators/rails/app/templates/config/environment.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +32 -14
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +42 -55
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +27 -15
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +3 -5
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +21 -28
- data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +6 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt +4 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt +284 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +13 -0
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +13 -15
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +17 -20
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +8 -1
- data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +5 -5
- data/lib/rails/generators/rails/app/templates/config.ru.tt +2 -1
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +7 -5
- data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +10 -0
- data/lib/rails/generators/rails/app/templates/dockerignore.tt +43 -0
- data/lib/rails/generators/rails/app/templates/gitattributes.tt +9 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +12 -9
- data/lib/rails/generators/rails/app/templates/node-version.tt +1 -0
- data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +10 -8
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +13 -11
- data/lib/rails/generators/rails/application_record/application_record_generator.rb +4 -0
- data/lib/rails/generators/rails/benchmark/USAGE +19 -0
- data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +30 -0
- data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
- data/lib/rails/generators/rails/controller/USAGE +13 -5
- data/lib/rails/generators/rails/controller/controller_generator.rb +7 -42
- data/lib/rails/generators/rails/controller/templates/controller.rb.tt +1 -5
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +30 -25
- data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +8 -0
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +31 -1
- data/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +6 -2
- data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -2
- data/lib/rails/generators/rails/generator/USAGE +2 -2
- data/lib/rails/generators/rails/generator/generator_generator.rb +0 -1
- data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -1
- data/lib/rails/generators/rails/generator/templates/USAGE.tt +1 -1
- data/lib/rails/generators/rails/helper/USAGE +2 -3
- data/lib/rails/generators/rails/integration_test/USAGE +2 -2
- data/lib/rails/generators/rails/migration/USAGE +22 -12
- data/lib/rails/generators/rails/model/model_generator.rb +4 -0
- data/lib/rails/generators/rails/plugin/USAGE +17 -6
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +86 -46
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +15 -20
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +10 -39
- data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/README.md.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -18
- data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +0 -1
- data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +0 -3
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +7 -22
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +10 -14
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt +1 -0
- data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +3 -3
- data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt +4 -4
- data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +6 -14
- data/lib/rails/generators/rails/resource/USAGE +4 -4
- data/lib/rails/generators/rails/resource/resource_generator.rb +6 -0
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +2 -27
- data/lib/rails/generators/rails/scaffold/USAGE +5 -5
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -20
- data/lib/rails/generators/rails/scaffold_controller/USAGE +2 -2
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +7 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -6
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +7 -11
- data/lib/rails/generators/rails/system_test/USAGE +2 -2
- data/lib/rails/generators/rails/task/USAGE +3 -3
- data/lib/rails/generators/resource_helpers.rb +2 -2
- data/lib/rails/generators/test_case.rb +3 -3
- data/lib/rails/generators/test_unit/controller/controller_generator.rb +2 -0
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt +3 -3
- data/lib/rails/generators/test_unit/generator/generator_generator.rb +0 -1
- data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +3 -3
- data/lib/rails/generators/test_unit/integration/integration_generator.rb +0 -1
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/job/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +3 -3
- data/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +4 -5
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +6 -6
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +8 -8
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +9 -11
- data/lib/rails/generators/testing/assertions.rb +2 -2
- data/lib/rails/generators/testing/{behaviour.rb → behavior.rb} +8 -7
- data/lib/rails/generators.rb +43 -45
- data/lib/rails/health_controller.rb +55 -0
- data/lib/rails/info.rb +4 -4
- data/lib/rails/info_controller.rb +30 -13
- data/lib/rails/initializable.rb +1 -1
- data/lib/rails/mailers_controller.rb +18 -9
- data/lib/rails/paths.rb +28 -19
- data/lib/rails/rack/logger.rb +17 -17
- data/lib/rails/rackup/server.rb +15 -0
- data/lib/rails/railtie/configurable.rb +0 -1
- data/lib/rails/railtie/configuration.rb +15 -3
- data/lib/rails/railtie.rb +80 -37
- data/lib/rails/ruby_version_check.rb +5 -3
- data/lib/rails/secrets.rb +14 -9
- data/lib/rails/source_annotation_extractor.rb +69 -34
- data/lib/rails/tasks/engine.rake +8 -11
- data/lib/rails/tasks/framework.rake +4 -6
- data/lib/rails/tasks/log.rake +1 -1
- data/lib/rails/tasks/misc.rake +4 -15
- data/lib/rails/tasks/statistics.rake +9 -6
- data/lib/rails/tasks/tmp.rake +13 -6
- data/lib/rails/tasks/yarn.rake +17 -6
- data/lib/rails/tasks/zeitwerk.rake +16 -41
- data/lib/rails/tasks.rb +0 -6
- data/lib/rails/templates/layouts/application.html.erb +15 -0
- data/lib/rails/templates/rails/mailers/email.html.erb +46 -11
- data/lib/rails/templates/rails/mailers/index.html.erb +14 -7
- data/lib/rails/templates/rails/mailers/mailer.html.erb +11 -5
- data/lib/rails/templates/rails/welcome/index.html.erb +65 -48
- data/lib/rails/test_help.rb +13 -14
- data/lib/rails/test_unit/line_filtering.rb +1 -1
- data/lib/rails/test_unit/railtie.rb +0 -4
- data/lib/rails/test_unit/reporter.rb +8 -3
- data/lib/rails/test_unit/runner.rb +61 -19
- data/lib/rails/test_unit/test_parser.rb +88 -0
- data/lib/rails/test_unit/testing.rake +17 -36
- data/lib/rails/testing/maintain_test_schema.rb +16 -0
- data/lib/rails/version.rb +1 -1
- data/lib/rails/welcome_controller.rb +1 -0
- data/lib/rails/zeitwerk_checker.rb +15 -0
- data/lib/rails.rb +31 -23
- metadata +89 -58
- data/RDOC_MAIN.rdoc +0 -98
- data/lib/rails/application/dummy_erb_compiler.rb +0 -18
- data/lib/rails/command/spellchecker.rb +0 -58
- data/lib/rails/generators/css/assets/assets_generator.rb +0 -15
- data/lib/rails/generators/css/assets/templates/stylesheet.css +0 -4
- data/lib/rails/generators/css/scaffold/scaffold_generator.rb +0 -18
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +0 -6
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/index.js +0 -5
- data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +0 -23
- data/lib/rails/generators/rails/app/templates/bin/yarn.tt +0 -10
- data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt +0 -50
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt +0 -86
- data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt +0 -8
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +0 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb.tt +0 -5
- data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb.tt +0 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt +0 -45
- data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +0 -16
- data/lib/rails/generators/rails/app/templates/config/spring.rb.tt +0 -6
- data/lib/rails/generators/rails/app/templates/package.json.tt +0 -11
- data/lib/rails/generators/rails/assets/USAGE +0 -17
- data/lib/rails/generators/rails/assets/assets_generator.rb +0 -26
- data/lib/rails/generators/rails/assets/templates/stylesheet.css +0 -4
- data/lib/rails/generators/rails/model/USAGE +0 -114
- data/lib/rails/generators/rails/plugin/templates/rails/application.rb.tt +0 -23
- data/lib/rails/generators/rails/scaffold/templates/scaffold.css +0 -80
- data/lib/rails/tasks/annotations.rake +0 -22
- data/lib/rails/tasks/dev.rake +0 -11
- data/lib/rails/tasks/initializers.rake +0 -9
- data/lib/rails/tasks/middleware.rake +0 -9
- data/lib/rails/tasks/restart.rake +0 -9
- data/lib/rails/tasks/routes.rake +0 -9
data/lib/rails/generators.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
activesupport_path = File.expand_path("../../../activesupport/lib", __dir__)
|
4
|
-
$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
|
5
|
-
|
6
3
|
require "thor/group"
|
7
4
|
require "rails/command"
|
8
5
|
|
9
|
-
require "active_support"
|
10
|
-
require "active_support/core_ext/object/blank"
|
11
|
-
require "active_support/core_ext/kernel/singleton_class"
|
12
6
|
require "active_support/core_ext/array/extract_options"
|
7
|
+
require "active_support/core_ext/enumerable"
|
13
8
|
require "active_support/core_ext/hash/deep_merge"
|
14
9
|
require "active_support/core_ext/module/attribute_accessors"
|
15
10
|
require "active_support/core_ext/string/indent"
|
@@ -35,13 +30,10 @@ module Rails
|
|
35
30
|
rails: {
|
36
31
|
actions: "-a",
|
37
32
|
orm: "-o",
|
38
|
-
javascripts: "-j",
|
39
|
-
javascript_engine: "-je",
|
33
|
+
javascripts: ["-j", "--js"],
|
40
34
|
resource_controller: "-c",
|
41
35
|
scaffold_controller: "-c",
|
42
36
|
stylesheets: "-y",
|
43
|
-
stylesheet_engine: "-se",
|
44
|
-
scaffold_stylesheet: "-ss",
|
45
37
|
template_engine: "-e",
|
46
38
|
test_framework: "-t"
|
47
39
|
},
|
@@ -62,9 +54,6 @@ module Rails
|
|
62
54
|
resource_controller: :controller,
|
63
55
|
resource_route: true,
|
64
56
|
scaffold_controller: :scaffold_controller,
|
65
|
-
stylesheets: true,
|
66
|
-
stylesheet_engine: :css,
|
67
|
-
scaffold_stylesheet: true,
|
68
57
|
system_tests: nil,
|
69
58
|
test_framework: nil,
|
70
59
|
template_engine: :erb
|
@@ -72,7 +61,7 @@ module Rails
|
|
72
61
|
}
|
73
62
|
|
74
63
|
class << self
|
75
|
-
def configure!(config)
|
64
|
+
def configure!(config) # :nodoc:
|
76
65
|
api_only! if config.api_only
|
77
66
|
no_color! unless config.colorize_logging
|
78
67
|
aliases.deep_merge! config.aliases
|
@@ -81,22 +70,27 @@ module Rails
|
|
81
70
|
templates_path.concat config.templates
|
82
71
|
templates_path.uniq!
|
83
72
|
hide_namespaces(*config.hidden_namespaces)
|
73
|
+
after_generate_callbacks.replace config.after_generate_callbacks
|
84
74
|
end
|
85
75
|
|
86
|
-
def templates_path
|
76
|
+
def templates_path # :nodoc:
|
87
77
|
@templates_path ||= []
|
88
78
|
end
|
89
79
|
|
90
|
-
def aliases
|
80
|
+
def aliases # :nodoc:
|
91
81
|
@aliases ||= DEFAULT_ALIASES.dup
|
92
82
|
end
|
93
83
|
|
94
|
-
def options
|
84
|
+
def options # :nodoc:
|
95
85
|
@options ||= DEFAULT_OPTIONS.dup
|
96
86
|
end
|
97
87
|
|
88
|
+
def after_generate_callbacks # :nodoc:
|
89
|
+
@after_generate_callbacks ||= []
|
90
|
+
end
|
91
|
+
|
98
92
|
# Hold configured generators fallbacks. If a plugin developer wants a
|
99
|
-
# generator group to
|
93
|
+
# generator group to fall back to another group in case of missing generators,
|
100
94
|
# they can add a fallback.
|
101
95
|
#
|
102
96
|
# For example, shoulda is considered a test_framework and is an extension
|
@@ -125,27 +119,19 @@ module Rails
|
|
125
119
|
template_engine: nil
|
126
120
|
)
|
127
121
|
|
128
|
-
|
129
|
-
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
# Remove the color from output.
|
134
|
-
def no_color!
|
135
|
-
Thor::Base.shell = Thor::Shell::Basic
|
122
|
+
options[:mailer] ||= {}
|
123
|
+
options[:mailer][:template_engine] ||= :erb
|
136
124
|
end
|
137
125
|
|
138
126
|
# Returns an array of generator namespaces that are hidden.
|
139
127
|
# Generator namespaces may be hidden for a variety of reasons.
|
140
128
|
# Some are aliased such as "rails:migration" and can be
|
141
|
-
# invoked with the shorter "migration"
|
142
|
-
# such as "css:scaffold".
|
129
|
+
# invoked with the shorter "migration".
|
143
130
|
def hidden_namespaces
|
144
131
|
@hidden_namespaces ||= begin
|
145
132
|
orm = options[:rails][:orm]
|
146
133
|
test = options[:rails][:test_framework]
|
147
134
|
template = options[:rails][:template_engine]
|
148
|
-
css = options[:rails][:stylesheet_engine]
|
149
135
|
|
150
136
|
[
|
151
137
|
"rails",
|
@@ -164,10 +150,8 @@ module Rails
|
|
164
150
|
"#{template}:controller",
|
165
151
|
"#{template}:scaffold",
|
166
152
|
"#{template}:mailer",
|
167
|
-
"
|
168
|
-
"
|
169
|
-
"css:assets",
|
170
|
-
"css:scaffold"
|
153
|
+
"action_text:install",
|
154
|
+
"action_mailbox:install"
|
171
155
|
]
|
172
156
|
end
|
173
157
|
end
|
@@ -179,7 +163,8 @@ module Rails
|
|
179
163
|
|
180
164
|
# Show help message with available generators.
|
181
165
|
def help(command = "generate")
|
182
|
-
puts "Usage:
|
166
|
+
puts "Usage:"
|
167
|
+
puts " bin/rails #{command} GENERATOR [args] [options]"
|
183
168
|
puts
|
184
169
|
puts "General options:"
|
185
170
|
puts " -h, [--help] # Print generator's options and usage"
|
@@ -214,7 +199,7 @@ module Rails
|
|
214
199
|
end
|
215
200
|
|
216
201
|
rails = groups.delete("rails")
|
217
|
-
rails.map! { |n| n.
|
202
|
+
rails.map! { |n| n.delete_prefix("rails:") }
|
218
203
|
rails.delete("app")
|
219
204
|
rails.delete("plugin")
|
220
205
|
rails.delete("encrypted_secrets")
|
@@ -242,7 +227,7 @@ module Rails
|
|
242
227
|
#
|
243
228
|
# Notice that "rails:generators:webrat" could be loaded as well, what
|
244
229
|
# Rails looks for is the first and last parts of the namespace.
|
245
|
-
def find_by_namespace(name, base = nil, context = nil)
|
230
|
+
def find_by_namespace(name, base = nil, context = nil) # :nodoc:
|
246
231
|
lookups = []
|
247
232
|
lookups << "#{base}:#{name}" if base
|
248
233
|
lookups << "#{name}:#{context}" if context
|
@@ -257,7 +242,7 @@ module Rails
|
|
257
242
|
|
258
243
|
lookup(lookups)
|
259
244
|
|
260
|
-
namespaces =
|
245
|
+
namespaces = subclasses.index_by(&:namespace)
|
261
246
|
lookups.each do |namespace|
|
262
247
|
klass = namespaces[namespace]
|
263
248
|
return klass if klass
|
@@ -266,28 +251,32 @@ module Rails
|
|
266
251
|
invoke_fallbacks_for(name, base) || invoke_fallbacks_for(context, name)
|
267
252
|
end
|
268
253
|
|
269
|
-
# Receives a namespace, arguments and the behavior to invoke the generator.
|
270
|
-
# It's used as the default entry point for generate, destroy and update
|
254
|
+
# Receives a namespace, arguments, and the behavior to invoke the generator.
|
255
|
+
# It's used as the default entry point for generate, destroy, and update
|
271
256
|
# commands.
|
272
257
|
def invoke(namespace, args = ARGV, config = {})
|
273
258
|
names = namespace.to_s.split(":")
|
274
259
|
if klass = find_by_namespace(names.pop, names.any? && names.join(":"))
|
275
260
|
args << "--help" if args.empty? && klass.arguments.any?(&:required?)
|
276
261
|
klass.start(args, config)
|
262
|
+
run_after_generate_callback if config[:behavior] == :invoke
|
277
263
|
else
|
278
|
-
options
|
279
|
-
|
280
|
-
suggestion_msg = "Maybe you meant #{suggestion.inspect}?" if suggestion
|
264
|
+
options = sorted_groups.flat_map(&:last)
|
265
|
+
error = Command::CorrectableNameError.new("Could not find generator '#{namespace}'.", namespace, options)
|
281
266
|
|
282
267
|
puts <<~MSG
|
283
|
-
|
284
|
-
Run `rails generate --help` for more options.
|
268
|
+
#{error.detailed_message}
|
269
|
+
Run `bin/rails generate --help` for more options.
|
285
270
|
MSG
|
286
271
|
end
|
287
272
|
end
|
288
273
|
|
289
|
-
|
274
|
+
def add_generated_file(file) # :nodoc:
|
275
|
+
(@@generated_files ||= []) << file
|
276
|
+
file
|
277
|
+
end
|
290
278
|
|
279
|
+
private
|
291
280
|
def print_list(base, namespaces) # :doc:
|
292
281
|
namespaces = namespaces.reject { |n| hidden_namespaces.include?(n) }
|
293
282
|
super
|
@@ -320,6 +309,15 @@ module Rails
|
|
320
309
|
def file_lookup_paths # :doc:
|
321
310
|
@file_lookup_paths ||= [ "{#{lookup_paths.join(',')}}", "**", "*_generator.rb" ]
|
322
311
|
end
|
312
|
+
|
313
|
+
def run_after_generate_callback
|
314
|
+
if defined?(@@generated_files) && !@@generated_files.empty?
|
315
|
+
@after_generate_callbacks.each do |callback|
|
316
|
+
callback.call(@@generated_files)
|
317
|
+
end
|
318
|
+
@@generated_files = []
|
319
|
+
end
|
320
|
+
end
|
323
321
|
end
|
324
322
|
end
|
325
323
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
# Built-in Health Check Endpoint
|
5
|
+
#
|
6
|
+
# \Rails also comes with a built-in health check endpoint that is reachable at
|
7
|
+
# the +/up+ path. This endpoint will return a 200 status code if the app has
|
8
|
+
# booted with no exceptions, and a 500 status code otherwise.
|
9
|
+
#
|
10
|
+
# In production, many applications are required to report their status upstream,
|
11
|
+
# whether it's to an uptime monitor that will page an engineer when things go
|
12
|
+
# wrong, or a load balancer or Kubernetes controller used to determine a pod's
|
13
|
+
# health. This health check is designed to be a one-size fits all that will work
|
14
|
+
# in many situations.
|
15
|
+
#
|
16
|
+
# While any newly generated \Rails applications will have the health check at
|
17
|
+
# +/up+, you can configure the path to be anything you'd like in your
|
18
|
+
# <tt>"config/routes.rb"</tt>:
|
19
|
+
#
|
20
|
+
# Rails.application.routes.draw do
|
21
|
+
# get "healthz" => "rails/health#show", as: :rails_health_check
|
22
|
+
# end
|
23
|
+
#
|
24
|
+
# The health check will now be accessible via the +/healthz+ path.
|
25
|
+
#
|
26
|
+
# NOTE: This endpoint does not reflect the status of all of your application's
|
27
|
+
# dependencies, such as the database or redis cluster. Replace
|
28
|
+
# <tt>"rails/health#show"</tt> with your own controller action if you have
|
29
|
+
# application specific needs.
|
30
|
+
#
|
31
|
+
# Think carefully about what you want to check as it can lead to situations
|
32
|
+
# where your application is being restarted due to a third-party service going
|
33
|
+
# bad. Ideally, you should design your application to handle those outages
|
34
|
+
# gracefully.
|
35
|
+
class HealthController < ActionController::Base
|
36
|
+
rescue_from(Exception) { render_down }
|
37
|
+
|
38
|
+
def show
|
39
|
+
render_up
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
def render_up
|
44
|
+
render html: html_status(color: "green")
|
45
|
+
end
|
46
|
+
|
47
|
+
def render_down
|
48
|
+
render html: html_status(color: "red"), status: 500
|
49
|
+
end
|
50
|
+
|
51
|
+
def html_status(color:)
|
52
|
+
%(<!DOCTYPE html><html><body style="background-color: #{color}"></body></html>).html_safe
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/rails/info.rb
CHANGED
@@ -4,7 +4,7 @@ require "cgi"
|
|
4
4
|
|
5
5
|
module Rails
|
6
6
|
# This module helps build the runtime properties that are displayed in
|
7
|
-
# Rails::InfoController responses. These include the active Rails version,
|
7
|
+
# Rails::InfoController responses. These include the active \Rails version,
|
8
8
|
# Ruby version, Rack version, and so on.
|
9
9
|
module Info
|
10
10
|
mattr_accessor :properties, default: []
|
@@ -21,7 +21,7 @@ module Rails
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
class << self
|
24
|
+
class << self # :nodoc:
|
25
25
|
def property(name, value = nil)
|
26
26
|
value ||= yield
|
27
27
|
properties << [name, value] if value
|
@@ -68,7 +68,7 @@ module Rails
|
|
68
68
|
|
69
69
|
# The RubyGems version, if it's installed.
|
70
70
|
property "RubyGems version" do
|
71
|
-
Gem::
|
71
|
+
Gem::VERSION
|
72
72
|
end
|
73
73
|
|
74
74
|
property "Rack version" do
|
@@ -95,7 +95,7 @@ module Rails
|
|
95
95
|
|
96
96
|
# The name of the database adapter for the current environment.
|
97
97
|
property "Database adapter" do
|
98
|
-
ActiveRecord::Base.
|
98
|
+
ActiveRecord::Base.connection.pool.db_config.adapter
|
99
99
|
end
|
100
100
|
|
101
101
|
property "Database schema version" do
|
@@ -4,7 +4,7 @@ require "rails/application_controller"
|
|
4
4
|
require "action_dispatch/routing/inspector"
|
5
5
|
|
6
6
|
class Rails::InfoController < Rails::ApplicationController # :nodoc:
|
7
|
-
prepend_view_path ActionDispatch::DebugView::
|
7
|
+
prepend_view_path ActionDispatch::DebugView::RESCUES_TEMPLATE_PATHS
|
8
8
|
layout -> { request.xhr? ? false : "application" }
|
9
9
|
|
10
10
|
before_action :require_local!
|
@@ -19,12 +19,12 @@ class Rails::InfoController < Rails::ApplicationController # :nodoc:
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def routes
|
22
|
-
if
|
23
|
-
|
24
|
-
|
22
|
+
if query = params[:query]
|
23
|
+
query = URI::DEFAULT_PARSER.escape query
|
24
|
+
|
25
25
|
render json: {
|
26
|
-
exact:
|
27
|
-
fuzzy:
|
26
|
+
exact: matching_routes(query: query, exact_match: true),
|
27
|
+
fuzzy: matching_routes(query: query, exact_match: false)
|
28
28
|
}
|
29
29
|
else
|
30
30
|
@routes_inspector = ActionDispatch::Routing::RoutesInspector.new(_routes.routes)
|
@@ -33,14 +33,31 @@ class Rails::InfoController < Rails::ApplicationController # :nodoc:
|
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
36
|
+
def matching_routes(query:, exact_match:)
|
37
|
+
return [] if query.blank?
|
36
38
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
normalized_path = ("/" + query).squeeze("/")
|
40
|
+
query_without_url_or_path_suffix = query.gsub(/(\w)(_path$)/, '\1').gsub(/(\w)(_url$)/, '\1')
|
41
|
+
|
42
|
+
_routes.routes.filter_map do |route|
|
43
|
+
route_wrapper = ActionDispatch::Routing::RouteWrapper.new(route)
|
44
|
+
|
45
|
+
if exact_match
|
46
|
+
match = route.path.match(normalized_path)
|
47
|
+
match ||= (query_without_url_or_path_suffix === route_wrapper.name)
|
48
|
+
else
|
49
|
+
match = route_wrapper.path.match(query)
|
50
|
+
match ||= route_wrapper.name.include?(query_without_url_or_path_suffix)
|
51
|
+
end
|
52
|
+
|
53
|
+
match ||= (query === route_wrapper.verb)
|
54
|
+
|
55
|
+
unless match
|
56
|
+
controller_action = URI::DEFAULT_PARSER.escape(route_wrapper.reqs)
|
57
|
+
match = exact_match ? (query === controller_action) : controller_action.include?(query)
|
58
|
+
end
|
42
59
|
|
43
|
-
|
44
|
-
|
60
|
+
route_wrapper.path if match
|
61
|
+
end
|
45
62
|
end
|
46
63
|
end
|
data/lib/rails/initializable.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
require "rails/application_controller"
|
4
4
|
|
5
5
|
class Rails::MailersController < Rails::ApplicationController # :nodoc:
|
6
|
-
prepend_view_path ActionDispatch::DebugView::
|
6
|
+
prepend_view_path ActionDispatch::DebugView::RESCUES_TEMPLATE_PATHS
|
7
7
|
|
8
|
-
around_action :set_locale, only: :preview
|
9
|
-
before_action :find_preview, only: :preview
|
8
|
+
around_action :set_locale, only: [:preview, :download]
|
9
|
+
before_action :find_preview, only: [:preview, :download]
|
10
10
|
before_action :require_local!, unless: :show_previews?
|
11
11
|
|
12
12
|
helper_method :part_query, :locale_query
|
@@ -15,17 +15,28 @@ class Rails::MailersController < Rails::ApplicationController # :nodoc:
|
|
15
15
|
|
16
16
|
def index
|
17
17
|
@previews = ActionMailer::Preview.all
|
18
|
-
@page_title = "Mailer Previews"
|
18
|
+
@page_title = "Action Mailer Previews"
|
19
|
+
end
|
20
|
+
|
21
|
+
def download
|
22
|
+
@email_action = File.basename(params[:path])
|
23
|
+
if @preview.email_exists?(@email_action)
|
24
|
+
@email = @preview.call(@email_action, params)
|
25
|
+
send_data @email.to_s, filename: "#{@email_action}.eml"
|
26
|
+
else
|
27
|
+
raise AbstractController::ActionNotFound, "Email '#{@email_action}' not found in #{@preview.name}"
|
28
|
+
end
|
19
29
|
end
|
20
30
|
|
21
31
|
def preview
|
22
32
|
if params[:path] == @preview.preview_name
|
23
|
-
@page_title = "Mailer Previews for #{@preview.preview_name}"
|
33
|
+
@page_title = "Action Mailer Previews for #{@preview.preview_name}"
|
24
34
|
render action: "mailer"
|
25
35
|
else
|
26
36
|
@email_action = File.basename(params[:path])
|
27
37
|
|
28
38
|
if @preview.email_exists?(@email_action)
|
39
|
+
@page_title = "Mailer Preview for #{@preview.preview_name}##{@email_action}"
|
29
40
|
@email = @preview.call(@email_action, params)
|
30
41
|
|
31
42
|
if params[:part]
|
@@ -92,9 +103,7 @@ class Rails::MailersController < Rails::ApplicationController # :nodoc:
|
|
92
103
|
request.query_parameters.merge(locale: locale).to_query
|
93
104
|
end
|
94
105
|
|
95
|
-
def set_locale
|
96
|
-
I18n.with_locale(params[:locale] || I18n.default_locale)
|
97
|
-
yield
|
98
|
-
end
|
106
|
+
def set_locale(&block)
|
107
|
+
I18n.with_locale(params[:locale] || I18n.default_locale, &block)
|
99
108
|
end
|
100
109
|
end
|
data/lib/rails/paths.rb
CHANGED
@@ -1,22 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "pathname"
|
4
|
+
|
3
5
|
module Rails
|
4
6
|
module Paths
|
5
|
-
# This object is an extended hash that behaves as root of the
|
7
|
+
# This object is an extended hash that behaves as root of the Rails::Paths system.
|
6
8
|
# It allows you to collect information about how you want to structure your application
|
7
|
-
# paths through a Hash-like API. It requires you to give a physical path on initialization.
|
9
|
+
# paths through a Hash-like \API. It requires you to give a physical path on initialization.
|
8
10
|
#
|
9
11
|
# root = Root.new "/rails"
|
10
12
|
# root.add "app/controllers", eager_load: true
|
11
13
|
#
|
12
14
|
# The above command creates a new root object and adds "app/controllers" as a path.
|
13
|
-
# This means we can get a
|
15
|
+
# This means we can get a Rails::Paths::Path object back like below:
|
14
16
|
#
|
15
17
|
# path = root["app/controllers"]
|
16
18
|
# path.eager_load? # => true
|
17
19
|
# path.is_a?(Rails::Paths::Path) # => true
|
18
20
|
#
|
19
|
-
# The
|
21
|
+
# The Path[rdoc-ref:Rails::Paths::Path] object is simply an enumerable and
|
22
|
+
# allows you to easily add extra paths:
|
20
23
|
#
|
21
24
|
# path.is_a?(Enumerable) # => true
|
22
25
|
# path.to_ary.inspect # => ["app/controllers"]
|
@@ -24,17 +27,19 @@ module Rails
|
|
24
27
|
# path << "lib/controllers"
|
25
28
|
# path.to_ary.inspect # => ["app/controllers", "lib/controllers"]
|
26
29
|
#
|
27
|
-
# Notice that when you add a path using
|
28
|
-
#
|
29
|
-
#
|
30
|
+
# Notice that when you add a path using #add, the
|
31
|
+
# Path[rdoc-ref:Rails::Paths::Path] object created already contains the path
|
32
|
+
# with the same path value given to #add. In some situations, you may not
|
33
|
+
# want this behavior, so you can give <tt>:with</tt> as option.
|
30
34
|
#
|
31
35
|
# root.add "config/routes", with: "config/routes.rb"
|
32
36
|
# root["config/routes"].inspect # => ["config/routes.rb"]
|
33
37
|
#
|
34
|
-
# The
|
35
|
-
# eager_load
|
38
|
+
# The #add method accepts the following options as arguments:
|
39
|
+
# +eager_load+, +autoload+, +autoload_once+, and +glob+.
|
36
40
|
#
|
37
|
-
# Finally, the
|
41
|
+
# Finally, the Path[rdoc-ref:Rails::Paths::Path] object also provides a few
|
42
|
+
# helpers:
|
38
43
|
#
|
39
44
|
# root = Root.new "/rails"
|
40
45
|
# root.add "app/controllers"
|
@@ -42,7 +47,7 @@ module Rails
|
|
42
47
|
# root["app/controllers"].expanded # => ["/rails/app/controllers"]
|
43
48
|
# root["app/controllers"].existent # => ["/rails/app/controllers"]
|
44
49
|
#
|
45
|
-
# Check the
|
50
|
+
# Check the Rails::Paths::Path documentation for more information.
|
46
51
|
class Root
|
47
52
|
attr_accessor :path
|
48
53
|
|
@@ -98,7 +103,6 @@ module Rails
|
|
98
103
|
end
|
99
104
|
|
100
105
|
private
|
101
|
-
|
102
106
|
def filter_by(&block)
|
103
107
|
all_paths.find_all(&block).flat_map { |path|
|
104
108
|
paths = path.existent
|
@@ -181,6 +185,14 @@ module Rails
|
|
181
185
|
@paths
|
182
186
|
end
|
183
187
|
|
188
|
+
def paths
|
189
|
+
raise "You need to set a path root" unless @root.path
|
190
|
+
|
191
|
+
map do |p|
|
192
|
+
Pathname.new(@root.path).join(p)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
184
196
|
def extensions # :nodoc:
|
185
197
|
$1.split(",") if @glob =~ /\{([\S]+)\}/
|
186
198
|
end
|
@@ -223,14 +235,11 @@ module Rails
|
|
223
235
|
alias to_a expanded
|
224
236
|
|
225
237
|
private
|
226
|
-
|
227
238
|
def files_in(path)
|
228
|
-
Dir.
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
files.sort
|
233
|
-
end
|
239
|
+
files = Dir.glob(@glob, base: path)
|
240
|
+
files -= @exclude if @exclude
|
241
|
+
files.map! { |file| File.join(path, file) }
|
242
|
+
files.sort
|
234
243
|
end
|
235
244
|
end
|
236
245
|
end
|
data/lib/rails/rack/logger.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "active_support/core_ext/time/conversions"
|
4
|
-
require "active_support/core_ext/object/blank"
|
5
4
|
require "active_support/log_subscriber"
|
6
|
-
require "action_dispatch/http/request"
|
7
5
|
require "rack/body_proxy"
|
8
6
|
|
9
7
|
module Rails
|
@@ -23,23 +21,30 @@ module Rails
|
|
23
21
|
request = ActionDispatch::Request.new(env)
|
24
22
|
|
25
23
|
if logger.respond_to?(:tagged)
|
26
|
-
logger.tagged(compute_tags(request)) { call_app(request, env) }
|
24
|
+
logger.tagged(*compute_tags(request)) { call_app(request, env) }
|
27
25
|
else
|
28
26
|
call_app(request, env)
|
29
27
|
end
|
30
28
|
end
|
31
29
|
|
32
30
|
private
|
33
|
-
|
34
31
|
def call_app(request, env) # :doc:
|
35
32
|
instrumenter = ActiveSupport::Notifications.instrumenter
|
36
|
-
instrumenter.
|
33
|
+
handle = instrumenter.build_handle("request.action_dispatch", { request: request })
|
34
|
+
handle.start
|
35
|
+
|
37
36
|
logger.info { started_request_message(request) }
|
38
|
-
status, headers, body = @app.call(env)
|
39
|
-
body = ::Rack::BodyProxy.new(body
|
40
|
-
|
37
|
+
status, headers, body = response = @app.call(env)
|
38
|
+
body = ::Rack::BodyProxy.new(body, &handle.method(:finish))
|
39
|
+
|
40
|
+
if response.frozen?
|
41
|
+
[status, headers, body]
|
42
|
+
else
|
43
|
+
response[2] = body
|
44
|
+
response
|
45
|
+
end
|
41
46
|
rescue Exception
|
42
|
-
finish
|
47
|
+
handle.finish
|
43
48
|
raise
|
44
49
|
ensure
|
45
50
|
ActiveSupport::LogSubscriber.flush_all!
|
@@ -47,11 +52,11 @@ module Rails
|
|
47
52
|
|
48
53
|
# Started GET "/session/new" for 127.0.0.1 at 2012-09-26 14:51:42 -0700
|
49
54
|
def started_request_message(request) # :doc:
|
50
|
-
'Started %s "%s" for %s at %s'
|
51
|
-
request.
|
55
|
+
sprintf('Started %s "%s" for %s at %s',
|
56
|
+
request.raw_request_method,
|
52
57
|
request.filtered_path,
|
53
58
|
request.remote_ip,
|
54
|
-
Time.now
|
59
|
+
Time.now)
|
55
60
|
end
|
56
61
|
|
57
62
|
def compute_tags(request) # :doc:
|
@@ -67,11 +72,6 @@ module Rails
|
|
67
72
|
end
|
68
73
|
end
|
69
74
|
|
70
|
-
def finish(request)
|
71
|
-
instrumenter = ActiveSupport::Notifications.instrumenter
|
72
|
-
instrumenter.finish "request.action_dispatch", request: request
|
73
|
-
end
|
74
|
-
|
75
75
|
def logger
|
76
76
|
Rails.logger
|
77
77
|
end
|