railties 7.1.6 → 7.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +206 -769
- data/README.rdoc +1 -1
- data/lib/minitest/rails_plugin.rb +6 -3
- data/lib/rails/all.rb +1 -3
- data/lib/rails/api/task.rb +6 -4
- data/lib/rails/application/bootstrap.rb +6 -9
- data/lib/rails/application/configuration.rb +66 -33
- data/lib/rails/application/dummy_config.rb +2 -2
- data/lib/rails/application/finisher.rb +7 -0
- data/lib/rails/application.rb +32 -96
- data/lib/rails/backtrace_cleaner.rb +15 -2
- data/lib/rails/cli.rb +0 -1
- data/lib/rails/command.rb +1 -1
- data/lib/rails/commands/app/update_command.rb +102 -0
- data/lib/rails/commands/boot/boot_command.rb +14 -0
- data/lib/rails/commands/console/console_command.rb +2 -21
- data/lib/rails/commands/console/irb_console.rb +133 -0
- data/lib/rails/commands/credentials/credentials_command.rb +2 -2
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +21 -30
- data/lib/rails/commands/devcontainer/devcontainer_command.rb +39 -0
- data/lib/rails/commands/rake/rake_command.rb +1 -1
- data/lib/rails/commands/runner/runner_command.rb +14 -3
- data/lib/rails/commands/server/server_command.rb +5 -3
- data/lib/rails/configuration.rb +10 -1
- data/lib/rails/console/app.rb +5 -32
- data/lib/rails/console/helpers.rb +5 -16
- data/lib/rails/console/methods.rb +23 -0
- data/lib/rails/engine.rb +7 -7
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators/actions.rb +9 -5
- data/lib/rails/generators/app_base.rb +76 -51
- data/lib/rails/generators/base.rb +5 -1
- data/lib/rails/generators/database.rb +227 -69
- data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +2 -0
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +2 -0
- data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +2 -0
- data/lib/rails/generators/generated_attribute.rb +26 -1
- data/lib/rails/generators/rails/app/app_generator.rb +56 -28
- data/lib/rails/generators/rails/app/templates/Dockerfile.tt +22 -15
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +17 -17
- data/lib/rails/generators/rails/app/templates/app/controllers/application_controller.rb.tt +4 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +8 -1
- data/lib/rails/generators/rails/app/templates/app/views/pwa/manifest.json.erb.tt +22 -0
- data/lib/rails/generators/rails/app/templates/app/views/pwa/service-worker.js +26 -0
- data/lib/rails/generators/rails/app/templates/bin/brakeman.tt +6 -0
- data/lib/rails/generators/rails/app/templates/bin/rubocop.tt +7 -0
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +6 -2
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +7 -0
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +8 -1
- data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +14 -7
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +8 -0
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +8 -5
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.tt +70 -0
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +25 -35
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +6 -0
- data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +5 -0
- data/lib/rails/generators/rails/app/templates/dockerignore.tt +13 -0
- data/lib/rails/generators/rails/app/templates/github/ci.yml.tt +140 -0
- data/lib/rails/generators/rails/app/templates/github/dependabot.yml +12 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +3 -3
- data/lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html +66 -0
- data/lib/rails/generators/rails/app/templates/public/icon.png +0 -0
- data/lib/rails/generators/rails/app/templates/public/icon.svg +3 -0
- data/lib/rails/generators/rails/app/templates/rubocop.yml.tt +8 -0
- data/lib/rails/generators/rails/app/templates/test/application_system_test_case.rb.tt +1 -1
- data/lib/rails/generators/rails/controller/controller_generator.rb +1 -1
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +131 -20
- data/lib/rails/generators/rails/devcontainer/devcontainer_generator.rb +166 -0
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt +3 -0
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/compose.yaml.tt +47 -0
- data/lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt +37 -0
- data/lib/rails/generators/rails/migration/migration_generator.rb +4 -0
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +40 -7
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +5 -1
- data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +2 -0
- data/lib/rails/generators/rails/plugin/templates/bin/rubocop.tt +7 -0
- data/lib/rails/generators/rails/plugin/templates/github/ci.yml.tt +104 -0
- data/lib/rails/generators/rails/plugin/templates/github/dependabot.yml +12 -0
- data/lib/rails/generators/rails/plugin/templates/rubocop.yml.tt +8 -0
- data/lib/rails/generators/rails/plugin/templates/test/application_system_test_case.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +2 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +2 -2
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +6 -4
- data/lib/rails/generators/test_unit/mailer/templates/preview.rb.tt +3 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +15 -1
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +2 -2
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +2 -2
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +2 -0
- data/lib/rails/generators/test_unit/system/templates/application_system_test_case.rb.tt +1 -1
- data/lib/rails/generators/testing/assertions.rb +20 -0
- data/lib/rails/generators/testing/behavior.rb +7 -6
- data/lib/rails/generators.rb +10 -6
- data/lib/rails/health_controller.rb +1 -1
- data/lib/rails/info.rb +2 -2
- data/lib/rails/mailers_controller.rb +14 -1
- data/lib/rails/paths.rb +2 -2
- data/lib/rails/pwa_controller.rb +15 -0
- data/lib/rails/rack/logger.rb +15 -7
- data/lib/rails/railtie/configurable.rb +2 -2
- data/lib/rails/railtie.rb +2 -3
- data/lib/rails/tasks/framework.rake +0 -26
- data/lib/rails/tasks/tmp.rake +1 -1
- data/lib/rails/templates/layouts/application.html.erb +1 -1
- data/lib/rails/templates/rails/mailers/email.html.erb +12 -8
- data/lib/rails/templates/rails/welcome/index.html.erb +4 -2
- data/lib/rails/test_help.rb +2 -4
- data/lib/rails/test_unit/reporter.rb +8 -2
- data/lib/rails/test_unit/runner.rb +30 -2
- data/lib/rails/test_unit/test_parser.rb +48 -0
- data/lib/rails.rb +6 -3
- metadata +40 -30
- data/lib/rails/app_updater.rb +0 -52
- data/lib/rails/commands/secrets/USAGE +0 -61
- data/lib/rails/commands/secrets/secrets_command.rb +0 -47
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +0 -68
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +0 -54
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +0 -70
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +0 -24
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +0 -62
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +0 -53
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt +0 -280
- data/lib/rails/generators/rails/app/templates/public/apple-touch-icon-precomposed.png +0 -0
- data/lib/rails/generators/rails/app/templates/public/apple-touch-icon.png +0 -0
- data/lib/rails/generators/rails/app/templates/public/favicon.ico +0 -0
- data/lib/rails/ruby_version_check.rb +0 -17
- data/lib/rails/secrets.rb +0 -110
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
<body>
|
|
62
62
|
<header>
|
|
63
63
|
<dl>
|
|
64
|
-
<% if
|
|
64
|
+
<% if Array(@email.from) != Array(@email.smtp_envelope_from) %>
|
|
65
65
|
<dt>SMTP-From:</dt>
|
|
66
66
|
<dd id="smtp_from"><%= @email.smtp_envelope_from %></dd>
|
|
67
67
|
<% end %>
|
|
68
68
|
|
|
69
|
-
<% if
|
|
69
|
+
<% if Set[*@email.to, *@email.cc, *@email.bcc] != Set[*@email.smtp_envelope_to] %>
|
|
70
70
|
<dt>SMTP-To:</dt>
|
|
71
|
-
<dd id="smtp_to"><%= @email.smtp_envelope_to %></dd>
|
|
71
|
+
<dd id="smtp_to"><%= @email.smtp_envelope_to.join(", ") %></dd>
|
|
72
72
|
<% end %>
|
|
73
73
|
|
|
74
74
|
<dt>From:</dt>
|
|
@@ -93,17 +93,21 @@
|
|
|
93
93
|
<% end %>
|
|
94
94
|
|
|
95
95
|
<dt>Date:</dt>
|
|
96
|
-
<dd id="date"><%= Time.current.rfc2822 %></dd>
|
|
96
|
+
<dd id="date"><%= @email.header['date'] || Time.current.rfc2822 %></dd>
|
|
97
97
|
|
|
98
98
|
<dt>Subject:</dt>
|
|
99
99
|
<dd><strong id="subject"><%= @email.subject %></strong></dd>
|
|
100
100
|
|
|
101
|
-
<%
|
|
101
|
+
<% if @attachments.any? || @inline_attachments.any? %>
|
|
102
102
|
<dt>Attachments:</dt>
|
|
103
103
|
<dd>
|
|
104
|
-
<% @
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
<% @attachments.each do |filename, attachment| %>
|
|
105
|
+
<%= link_to filename, attachment_url(attachment), download: filename %>
|
|
106
|
+
<% end %>
|
|
107
|
+
|
|
108
|
+
<% if @inline_attachments.any? %>
|
|
109
|
+
(Inline: <% @inline_attachments.each do |filename, attachment| %>
|
|
110
|
+
<%= link_to filename, attachment_url(attachment), download: filename %><% end %>)
|
|
107
111
|
<% end %>
|
|
108
112
|
</dd>
|
|
109
113
|
<% end %>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
<% ruby_on_rails_logo_favicon_data_uri = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIwcHgiIGhlaWdodD0iMzIwcHgiIHZpZXdCb3g9IjAgMCAzMjAgMzIwIiB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgogICAgPHRpdGxlPkljb248L3RpdGxlPgogICAgPGcgaWQ9Ikljb24iIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJSdWJ5LU9uLVJhaWxzLUxvZ28iIHRyYW5zZm9ybT0idHJhbnNsYXRlKDUuMDAwMDAwLCAyMC4wMDAwMDApIiBmaWxsPSIjRDgxRTAwIj4KICAgICAgICAgICAgPHBhdGggZD0iTTIxLjkzMzA3MDYsMjg1IEwxNjguMTc1NDI2LDI4NSBDMTQ3Ljk0MDg1OCwxNTAuNjkxNzA2IDE5Ni44ODIzODMsNjYuMzE0MjkwMiAzMTUsMzEuODY3NzUzNiBDMzE1LDIxLjc4NTEyODQgMzE1LDMxLjg2Nzc1MzYgMzE1LDIxLjc4NTEyODQgQzE2MS4yNTI4MywyNC45MTE2Mjc4IDYzLjU2Mzg1MzMsMTEyLjY0OTkxOCAyMS45MzMwNzA2LDI4NSBaIiBpZD0iUGF0aCIvPgogICAgICAgICAgICA8cG9seWdvbiBpZD0iUGF0aCIgcG9pbnRzPSI0MC40MDgyNjQzIDE4NS45MTU3MSAxMi43MzI2NDk0IDE3NC40MDE2NjMgLTEuNDIxMDg1NDdlLTE0IDIwNS40NDI3MSAyOS41NzExOTY2IDIxNi42NDcxMTUiLz4KICAgICAgICAgICAgPHBvbHlnb24gaWQ9IlBhdGgiIHBvaW50cz0iMTgwLjQ3MzEwMiAyNjguMDczNjQzIDIwNC45MzYwMTYgMjc2LjQxMDk2NiAyMDQuOTM2MDE2IDI1NC41MDg2NzMgMTgwLjQ4OTY0NCAyNDQuMzM4MTA3Ii8+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJQYXRoIiBwb2ludHM9IjEwMC41ODk1MTkgOTcuMjI4NzYwNiA3Ni42ODQwMTU2IDc5LjE2ODcwMjEgNTUuMjQ0MDc5MSAxMDAuMTgzMTA1IDgxLjUxNDMyMzkgMTE3LjQzMzcyNSIvPgogICAgICAgICAgICA8cG9seWdvbiBpZD0iUGF0aCIgcG9pbnRzPSIxODQuNTc1Njc5IDE4NC44OTYyOTUgMjA3Ljk1MjAzIDIwMC4yNDY2MSAyMTEuNzI3NzI5IDE4MS4yMDUyNjYgMTg5Ljg2MzY1MyAxNjQuNjg3NDYiLz4KICAgICAgICAgICAgPHBvbHlnb24gaWQ9IlBhdGgiIHBvaW50cz0iMjYxLjczNDAxIDY1Ljg5NTk0NDYgMjY5LjM1NDIzNCA4Mi4zMjk1NCAyODUuMzE4MjU2IDcyLjcwNDg1OTYgMjc4LjMxMDEyOSA1Ni45ODI5ODk1Ii8+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJQYXRoIiBwb2ludHM9IjI2MS45MTM3IDE2LjE4NDU0NzMgMjU1LjU5ODQ3OSA3LjEwNTQyNzM2ZS0xNSAyMzIuNzk2MDIgMy40ODg5NjMyMyAyNDAuNDYzODczIDIwLjAyNTI3MjUiLz4KICAgICAgICAgICAgPHBvbHlnb24gaWQ9IlBhdGgiIHBvaW50cz0iMjExLjkzNDExOSAxMTEuNTgwNjc1IDIyNi43MjI1NDcgMTI3Ljc5MjYwMSAyMzguMDIzOTI1IDExMy45MDM3MTUgMjIzLjQ2ODM3NSA5Ni41NDY4Njg1Ii8+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJQYXRoIiBwb2ludHM9IjE3OS42ODY4NTggMzguNDk1MjIxOCAxNjQuNjQxOTMxIDIwLjAyNTI3MjUgMTM5Ljg0NzYyIDMyLjU1NTI5OTIgMTU2LjYwMTMyNCA1MC45MjE2NzUzIi8+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=" %>
|
|
2
1
|
<!DOCTYPE html>
|
|
3
2
|
<html>
|
|
4
3
|
<head>
|
|
5
4
|
<title>Ruby on Rails <%= Rails.version %></title>
|
|
6
5
|
<meta charset="utf-8">
|
|
7
6
|
<meta name="viewport" content="width=device-width">
|
|
8
|
-
|
|
7
|
+
|
|
8
|
+
<link rel="icon" href="/icon.png" type="image/png">
|
|
9
|
+
<link rel="apple-touch-icon" href="/icon.png" sizes="512x512">
|
|
9
10
|
|
|
10
11
|
<style type="text/css">
|
|
11
12
|
* {
|
|
@@ -84,6 +85,7 @@
|
|
|
84
85
|
|
|
85
86
|
<ul>
|
|
86
87
|
<li><strong>Rails version:</strong> <%= Rails.version %></li>
|
|
88
|
+
<li><strong>Rack version:</strong> <%= Rack.release %></li>
|
|
87
89
|
<li><strong>Ruby version:</strong> <%= RUBY_DESCRIPTION %></li>
|
|
88
90
|
</ul>
|
|
89
91
|
</body>
|
data/lib/rails/test_help.rb
CHANGED
|
@@ -7,19 +7,17 @@
|
|
|
7
7
|
abort("Abort testing: Your Rails environment is running in production mode!") if Rails.env.production?
|
|
8
8
|
|
|
9
9
|
require "active_support/test_case"
|
|
10
|
-
require "action_controller"
|
|
11
|
-
require "action_controller/test_case"
|
|
12
|
-
require "action_dispatch/testing/integration"
|
|
13
10
|
require "rails/generators/test_case"
|
|
14
|
-
|
|
15
11
|
require "active_support/testing/autorun"
|
|
16
12
|
|
|
17
13
|
require "rails/testing/maintain_test_schema"
|
|
18
14
|
|
|
19
15
|
if defined?(ActiveRecord::Base)
|
|
16
|
+
require "active_record/testing/query_assertions"
|
|
20
17
|
ActiveSupport.on_load(:active_support_test_case) do
|
|
21
18
|
include ActiveRecord::TestDatabases
|
|
22
19
|
include ActiveRecord::TestFixtures
|
|
20
|
+
include ActiveRecord::Assertions::QueryAssertions
|
|
23
21
|
|
|
24
22
|
self.fixture_paths << "#{Rails.root}/test/fixtures/"
|
|
25
23
|
self.file_fixture_path = "#{Rails.root}/test/fixtures/files"
|
|
@@ -8,6 +8,13 @@ module Rails
|
|
|
8
8
|
class_attribute :app_root
|
|
9
9
|
class_attribute :executable, default: "bin/rails test"
|
|
10
10
|
|
|
11
|
+
def prerecord(test_class, test_name)
|
|
12
|
+
super
|
|
13
|
+
if options[:verbose]
|
|
14
|
+
io.print "%s#%s = " % [test_class.name, test_name]
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
11
18
|
def record(result)
|
|
12
19
|
super
|
|
13
20
|
|
|
@@ -69,8 +76,7 @@ module Rails
|
|
|
69
76
|
end
|
|
70
77
|
|
|
71
78
|
def format_line(result)
|
|
72
|
-
|
|
73
|
-
"%s#%s = %.2f s = %s" % [klass, result.name, result.time, result.result_code]
|
|
79
|
+
"%.2f s = %s" % [result.time, result.result_code]
|
|
74
80
|
end
|
|
75
81
|
|
|
76
82
|
def format_rerun_snippet(result)
|
|
@@ -9,6 +9,19 @@ require "rails/test_unit/test_parser"
|
|
|
9
9
|
|
|
10
10
|
module Rails
|
|
11
11
|
module TestUnit
|
|
12
|
+
class InvalidTestError < ArgumentError
|
|
13
|
+
def initialize(path, suggestion)
|
|
14
|
+
super(<<~MESSAGE.rstrip)
|
|
15
|
+
Could not load test file: #{path}.
|
|
16
|
+
#{suggestion}
|
|
17
|
+
MESSAGE
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def backtrace(*args)
|
|
21
|
+
[]
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
12
25
|
class Runner
|
|
13
26
|
TEST_FOLDERS = [:models, :helpers, :channels, :controllers, :mailers, :integration, :jobs, :mailboxes]
|
|
14
27
|
PATH_ARGUMENT_PATTERN = %r"^(?!/.+/$)[.\w]*[/\\]"
|
|
@@ -48,7 +61,22 @@ module Rails
|
|
|
48
61
|
def load_tests(argv)
|
|
49
62
|
patterns = extract_filters(argv)
|
|
50
63
|
tests = list_tests(patterns)
|
|
51
|
-
tests.to_a.each
|
|
64
|
+
tests.to_a.each do |path|
|
|
65
|
+
abs_path = File.expand_path(path)
|
|
66
|
+
require abs_path
|
|
67
|
+
rescue LoadError => exception
|
|
68
|
+
if exception.path == abs_path
|
|
69
|
+
all_tests = list_tests([default_test_glob])
|
|
70
|
+
corrections = DidYouMean::SpellChecker.new(dictionary: all_tests).correct(path)
|
|
71
|
+
|
|
72
|
+
if corrections.empty?
|
|
73
|
+
raise exception
|
|
74
|
+
end
|
|
75
|
+
raise(InvalidTestError.new(path, DidYouMean::Formatter.message_for(corrections)), cause: nil)
|
|
76
|
+
else
|
|
77
|
+
raise
|
|
78
|
+
end
|
|
79
|
+
end
|
|
52
80
|
end
|
|
53
81
|
|
|
54
82
|
def compose_filter(runnable, filter)
|
|
@@ -87,7 +115,7 @@ module Rails
|
|
|
87
115
|
end
|
|
88
116
|
|
|
89
117
|
def default_test_exclude_glob
|
|
90
|
-
ENV["DEFAULT_TEST_EXCLUDE"] || "test/{system,dummy}/**/*_test.rb"
|
|
118
|
+
ENV["DEFAULT_TEST_EXCLUDE"] || "test/{system,dummy,fixtures}/**/*_test.rb"
|
|
91
119
|
end
|
|
92
120
|
|
|
93
121
|
def regexp_filter?(arg)
|
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
begin
|
|
4
|
+
require "prism"
|
|
5
|
+
rescue LoadError
|
|
6
|
+
# If Prism isn't available (because of using an older Ruby version) then we'll
|
|
7
|
+
# define a fallback parser using ripper.
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
if defined?(Prism)
|
|
11
|
+
module Rails
|
|
12
|
+
module TestUnit
|
|
13
|
+
# Parse a test file to extract the line ranges of all tests in both
|
|
14
|
+
# method-style (def test_foo) and declarative-style (test "foo" do)
|
|
15
|
+
module TestParser
|
|
16
|
+
@begins_to_ends = {}
|
|
17
|
+
# Helper to translate a method object into the path and line range where
|
|
18
|
+
# the method was defined.
|
|
19
|
+
def self.definition_for(method)
|
|
20
|
+
filepath, start_line = method.source_location
|
|
21
|
+
@begins_to_ends[filepath] ||= ranges(filepath)
|
|
22
|
+
return unless end_line = @begins_to_ends[filepath][start_line]
|
|
23
|
+
[filepath, start_line..end_line]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
def self.ranges(filepath)
|
|
28
|
+
queue = [Prism.parse_file(filepath).value]
|
|
29
|
+
begins_to_ends = {}
|
|
30
|
+
while (node = queue.shift)
|
|
31
|
+
case node.type
|
|
32
|
+
when :def_node
|
|
33
|
+
begins_to_ends[node.location.start_line] = node.location.end_line
|
|
34
|
+
when :call_node
|
|
35
|
+
begins_to_ends[node.location.start_line] = node.location.end_line
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
queue.concat(node.compact_child_nodes)
|
|
39
|
+
end
|
|
40
|
+
begins_to_ends
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# If we have Prism, then we don't need to define the fallback parser using
|
|
47
|
+
# ripper.
|
|
48
|
+
return
|
|
49
|
+
end
|
|
50
|
+
|
|
3
51
|
require "ripper"
|
|
4
52
|
|
|
5
53
|
module Rails
|
data/lib/rails.rb
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require "rails/ruby_version_check"
|
|
4
|
-
|
|
5
3
|
require "pathname"
|
|
6
4
|
|
|
7
5
|
require "active_support"
|
|
@@ -29,12 +27,16 @@ module Rails
|
|
|
29
27
|
extend ActiveSupport::Autoload
|
|
30
28
|
extend ActiveSupport::Benchmarkable
|
|
31
29
|
|
|
32
|
-
autoload :HealthController
|
|
33
30
|
autoload :Info
|
|
34
31
|
autoload :InfoController
|
|
35
32
|
autoload :MailersController
|
|
36
33
|
autoload :WelcomeController
|
|
37
34
|
|
|
35
|
+
eager_autoload do
|
|
36
|
+
autoload :HealthController
|
|
37
|
+
autoload :PwaController
|
|
38
|
+
end
|
|
39
|
+
|
|
38
40
|
class << self
|
|
39
41
|
@application = @app_class = nil
|
|
40
42
|
|
|
@@ -69,6 +71,7 @@ module Rails
|
|
|
69
71
|
# Rails.env # => "development"
|
|
70
72
|
# Rails.env.development? # => true
|
|
71
73
|
# Rails.env.production? # => false
|
|
74
|
+
# Rails.env.local? # => true true for "development" and "test", false for anything else
|
|
72
75
|
def env
|
|
73
76
|
@_env ||= ActiveSupport::EnvironmentInquirer.new(ENV["RAILS_ENV"].presence || ENV["RACK_ENV"].presence || "development")
|
|
74
77
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: railties
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 7.
|
|
4
|
+
version: 7.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -15,28 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 7.
|
|
18
|
+
version: 7.2.3
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 7.
|
|
25
|
+
version: 7.2.3
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: actionpack
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - '='
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 7.
|
|
32
|
+
version: 7.2.3
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - '='
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 7.
|
|
39
|
+
version: 7.2.3
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: cgi
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -117,16 +117,16 @@ dependencies:
|
|
|
117
117
|
name: irb
|
|
118
118
|
requirement: !ruby/object:Gem::Requirement
|
|
119
119
|
requirements:
|
|
120
|
-
- - "
|
|
120
|
+
- - "~>"
|
|
121
121
|
- !ruby/object:Gem::Version
|
|
122
|
-
version: '
|
|
122
|
+
version: '1.13'
|
|
123
123
|
type: :runtime
|
|
124
124
|
prerelease: false
|
|
125
125
|
version_requirements: !ruby/object:Gem::Requirement
|
|
126
126
|
requirements:
|
|
127
|
-
- - "
|
|
127
|
+
- - "~>"
|
|
128
128
|
- !ruby/object:Gem::Version
|
|
129
|
-
version: '
|
|
129
|
+
version: '1.13'
|
|
130
130
|
- !ruby/object:Gem::Dependency
|
|
131
131
|
name: tsort
|
|
132
132
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -147,14 +147,14 @@ dependencies:
|
|
|
147
147
|
requirements:
|
|
148
148
|
- - '='
|
|
149
149
|
- !ruby/object:Gem::Version
|
|
150
|
-
version: 7.
|
|
150
|
+
version: 7.2.3
|
|
151
151
|
type: :development
|
|
152
152
|
prerelease: false
|
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
|
154
154
|
requirements:
|
|
155
155
|
- - '='
|
|
156
156
|
- !ruby/object:Gem::Version
|
|
157
|
-
version: 7.
|
|
157
|
+
version: 7.2.3
|
|
158
158
|
description: 'Rails internals: application bootup, plugins, generators, and rake tasks.'
|
|
159
159
|
email: david@loudthinking.com
|
|
160
160
|
executables:
|
|
@@ -173,7 +173,6 @@ files:
|
|
|
173
173
|
- lib/rails/api/generator.rb
|
|
174
174
|
- lib/rails/api/task.rb
|
|
175
175
|
- lib/rails/app_loader.rb
|
|
176
|
-
- lib/rails/app_updater.rb
|
|
177
176
|
- lib/rails/application.rb
|
|
178
177
|
- lib/rails/application/bootstrap.rb
|
|
179
178
|
- lib/rails/application/configuration.rb
|
|
@@ -196,8 +195,11 @@ files:
|
|
|
196
195
|
- lib/rails/command/helpers/editor.rb
|
|
197
196
|
- lib/rails/commands.rb
|
|
198
197
|
- lib/rails/commands/about/about_command.rb
|
|
198
|
+
- lib/rails/commands/app/update_command.rb
|
|
199
199
|
- lib/rails/commands/application/application_command.rb
|
|
200
|
+
- lib/rails/commands/boot/boot_command.rb
|
|
200
201
|
- lib/rails/commands/console/console_command.rb
|
|
202
|
+
- lib/rails/commands/console/irb_console.rb
|
|
201
203
|
- lib/rails/commands/credentials/USAGE
|
|
202
204
|
- lib/rails/commands/credentials/credentials_command.rb
|
|
203
205
|
- lib/rails/commands/credentials/credentials_command/diffing.rb
|
|
@@ -205,6 +207,7 @@ files:
|
|
|
205
207
|
- lib/rails/commands/dbconsole/dbconsole_command.rb
|
|
206
208
|
- lib/rails/commands/destroy/destroy_command.rb
|
|
207
209
|
- lib/rails/commands/dev/dev_command.rb
|
|
210
|
+
- lib/rails/commands/devcontainer/devcontainer_command.rb
|
|
208
211
|
- lib/rails/commands/encrypted/USAGE
|
|
209
212
|
- lib/rails/commands/encrypted/encrypted_command.rb
|
|
210
213
|
- lib/rails/commands/gem_help/USAGE
|
|
@@ -223,8 +226,6 @@ files:
|
|
|
223
226
|
- lib/rails/commands/runner/USAGE
|
|
224
227
|
- lib/rails/commands/runner/runner_command.rb
|
|
225
228
|
- lib/rails/commands/secret/secret_command.rb
|
|
226
|
-
- lib/rails/commands/secrets/USAGE
|
|
227
|
-
- lib/rails/commands/secrets/secrets_command.rb
|
|
228
229
|
- lib/rails/commands/server/server_command.rb
|
|
229
230
|
- lib/rails/commands/test/USAGE
|
|
230
231
|
- lib/rails/commands/test/test_command.rb
|
|
@@ -233,6 +234,7 @@ files:
|
|
|
233
234
|
- lib/rails/configuration.rb
|
|
234
235
|
- lib/rails/console/app.rb
|
|
235
236
|
- lib/rails/console/helpers.rb
|
|
237
|
+
- lib/rails/console/methods.rb
|
|
236
238
|
- lib/rails/deprecator.rb
|
|
237
239
|
- lib/rails/dev_caching.rb
|
|
238
240
|
- lib/rails/engine.rb
|
|
@@ -286,22 +288,20 @@ files:
|
|
|
286
288
|
- lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt
|
|
287
289
|
- lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt
|
|
288
290
|
- lib/rails/generators/rails/app/templates/app/views/layouts/mailer.text.erb.tt
|
|
291
|
+
- lib/rails/generators/rails/app/templates/app/views/pwa/manifest.json.erb.tt
|
|
292
|
+
- lib/rails/generators/rails/app/templates/app/views/pwa/service-worker.js
|
|
293
|
+
- lib/rails/generators/rails/app/templates/bin/brakeman.tt
|
|
289
294
|
- lib/rails/generators/rails/app/templates/bin/rails.tt
|
|
290
295
|
- lib/rails/generators/rails/app/templates/bin/rake.tt
|
|
296
|
+
- lib/rails/generators/rails/app/templates/bin/rubocop.tt
|
|
291
297
|
- lib/rails/generators/rails/app/templates/bin/setup.tt
|
|
292
298
|
- lib/rails/generators/rails/app/templates/config.ru.tt
|
|
293
299
|
- lib/rails/generators/rails/app/templates/config/application.rb.tt
|
|
294
300
|
- lib/rails/generators/rails/app/templates/config/boot.rb.tt
|
|
295
301
|
- lib/rails/generators/rails/app/templates/config/cable.yml.tt
|
|
296
|
-
- lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt
|
|
297
|
-
- lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt
|
|
298
|
-
- lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt
|
|
299
|
-
- lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt
|
|
300
302
|
- lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt
|
|
301
|
-
- lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt
|
|
302
303
|
- lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt
|
|
303
304
|
- lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt
|
|
304
|
-
- lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt
|
|
305
305
|
- lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt
|
|
306
306
|
- lib/rails/generators/rails/app/templates/config/environment.rb.tt
|
|
307
307
|
- lib/rails/generators/rails/app/templates/config/environments/development.rb.tt
|
|
@@ -312,7 +312,7 @@ files:
|
|
|
312
312
|
- lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt
|
|
313
313
|
- lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt
|
|
314
314
|
- lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt
|
|
315
|
-
- lib/rails/generators/rails/app/templates/config/initializers/
|
|
315
|
+
- lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_2.rb.tt
|
|
316
316
|
- lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt
|
|
317
317
|
- lib/rails/generators/rails/app/templates/config/locales/en.yml
|
|
318
318
|
- lib/rails/generators/rails/app/templates/config/puma.rb.tt
|
|
@@ -322,15 +322,18 @@ files:
|
|
|
322
322
|
- lib/rails/generators/rails/app/templates/docker-entrypoint.tt
|
|
323
323
|
- lib/rails/generators/rails/app/templates/dockerignore.tt
|
|
324
324
|
- lib/rails/generators/rails/app/templates/gitattributes.tt
|
|
325
|
+
- lib/rails/generators/rails/app/templates/github/ci.yml.tt
|
|
326
|
+
- lib/rails/generators/rails/app/templates/github/dependabot.yml
|
|
325
327
|
- lib/rails/generators/rails/app/templates/gitignore.tt
|
|
326
328
|
- lib/rails/generators/rails/app/templates/node-version.tt
|
|
327
329
|
- lib/rails/generators/rails/app/templates/public/404.html
|
|
330
|
+
- lib/rails/generators/rails/app/templates/public/406-unsupported-browser.html
|
|
328
331
|
- lib/rails/generators/rails/app/templates/public/422.html
|
|
329
332
|
- lib/rails/generators/rails/app/templates/public/500.html
|
|
330
|
-
- lib/rails/generators/rails/app/templates/public/
|
|
331
|
-
- lib/rails/generators/rails/app/templates/public/
|
|
332
|
-
- lib/rails/generators/rails/app/templates/public/favicon.ico
|
|
333
|
+
- lib/rails/generators/rails/app/templates/public/icon.png
|
|
334
|
+
- lib/rails/generators/rails/app/templates/public/icon.svg
|
|
333
335
|
- lib/rails/generators/rails/app/templates/public/robots.txt
|
|
336
|
+
- lib/rails/generators/rails/app/templates/rubocop.yml.tt
|
|
334
337
|
- lib/rails/generators/rails/app/templates/ruby-version.tt
|
|
335
338
|
- lib/rails/generators/rails/app/templates/test/application_system_test_case.rb.tt
|
|
336
339
|
- lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt
|
|
@@ -345,6 +348,10 @@ files:
|
|
|
345
348
|
- lib/rails/generators/rails/credentials/credentials_generator.rb
|
|
346
349
|
- lib/rails/generators/rails/credentials/templates/credentials.yml.tt
|
|
347
350
|
- lib/rails/generators/rails/db/system/change/change_generator.rb
|
|
351
|
+
- lib/rails/generators/rails/devcontainer/devcontainer_generator.rb
|
|
352
|
+
- lib/rails/generators/rails/devcontainer/templates/devcontainer/Dockerfile.tt
|
|
353
|
+
- lib/rails/generators/rails/devcontainer/templates/devcontainer/compose.yaml.tt
|
|
354
|
+
- lib/rails/generators/rails/devcontainer/templates/devcontainer/devcontainer.json.tt
|
|
348
355
|
- lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
|
|
349
356
|
- lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb
|
|
350
357
|
- lib/rails/generators/rails/generator/USAGE
|
|
@@ -375,8 +382,11 @@ files:
|
|
|
375
382
|
- lib/rails/generators/rails/plugin/templates/app/models/%namespaced_name%/application_record.rb.tt
|
|
376
383
|
- lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt
|
|
377
384
|
- lib/rails/generators/rails/plugin/templates/bin/rails.tt
|
|
385
|
+
- lib/rails/generators/rails/plugin/templates/bin/rubocop.tt
|
|
378
386
|
- lib/rails/generators/rails/plugin/templates/bin/test.tt
|
|
379
387
|
- lib/rails/generators/rails/plugin/templates/config/routes.rb.tt
|
|
388
|
+
- lib/rails/generators/rails/plugin/templates/github/ci.yml.tt
|
|
389
|
+
- lib/rails/generators/rails/plugin/templates/github/dependabot.yml
|
|
380
390
|
- lib/rails/generators/rails/plugin/templates/gitignore.tt
|
|
381
391
|
- lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt
|
|
382
392
|
- lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt
|
|
@@ -389,6 +399,7 @@ files:
|
|
|
389
399
|
- lib/rails/generators/rails/plugin/templates/rails/javascripts.js.tt
|
|
390
400
|
- lib/rails/generators/rails/plugin/templates/rails/routes.rb.tt
|
|
391
401
|
- lib/rails/generators/rails/plugin/templates/rails/stylesheets.css
|
|
402
|
+
- lib/rails/generators/rails/plugin/templates/rubocop.yml.tt
|
|
392
403
|
- lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt
|
|
393
404
|
- lib/rails/generators/rails/plugin/templates/test/application_system_test_case.rb.tt
|
|
394
405
|
- lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt
|
|
@@ -445,14 +456,13 @@ files:
|
|
|
445
456
|
- lib/rails/mailers_controller.rb
|
|
446
457
|
- lib/rails/paths.rb
|
|
447
458
|
- lib/rails/plugin/test.rb
|
|
459
|
+
- lib/rails/pwa_controller.rb
|
|
448
460
|
- lib/rails/rack.rb
|
|
449
461
|
- lib/rails/rack/logger.rb
|
|
450
462
|
- lib/rails/rackup/server.rb
|
|
451
463
|
- lib/rails/railtie.rb
|
|
452
464
|
- lib/rails/railtie/configurable.rb
|
|
453
465
|
- lib/rails/railtie/configuration.rb
|
|
454
|
-
- lib/rails/ruby_version_check.rb
|
|
455
|
-
- lib/rails/secrets.rb
|
|
456
466
|
- lib/rails/source_annotation_extractor.rb
|
|
457
467
|
- lib/rails/tasks.rb
|
|
458
468
|
- lib/rails/tasks/engine.rake
|
|
@@ -486,10 +496,10 @@ licenses:
|
|
|
486
496
|
- MIT
|
|
487
497
|
metadata:
|
|
488
498
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
489
|
-
changelog_uri: https://github.com/rails/rails/blob/v7.
|
|
490
|
-
documentation_uri: https://api.rubyonrails.org/v7.
|
|
499
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.2.3/railties/CHANGELOG.md
|
|
500
|
+
documentation_uri: https://api.rubyonrails.org/v7.2.3/
|
|
491
501
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
492
|
-
source_code_uri: https://github.com/rails/rails/tree/v7.
|
|
502
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.2.3/railties
|
|
493
503
|
rubygems_mfa_required: 'true'
|
|
494
504
|
rdoc_options:
|
|
495
505
|
- "--exclude"
|
|
@@ -500,7 +510,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
500
510
|
requirements:
|
|
501
511
|
- - ">="
|
|
502
512
|
- !ruby/object:Gem::Version
|
|
503
|
-
version:
|
|
513
|
+
version: 3.1.0
|
|
504
514
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
505
515
|
requirements:
|
|
506
516
|
- - ">="
|
data/lib/rails/app_updater.rb
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "rails/generators"
|
|
4
|
-
require "rails/generators/rails/app/app_generator"
|
|
5
|
-
|
|
6
|
-
module Rails
|
|
7
|
-
class AppUpdater # :nodoc:
|
|
8
|
-
class << self
|
|
9
|
-
def invoke_from_app_generator(method)
|
|
10
|
-
app_generator.send(method)
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def app_generator
|
|
14
|
-
@app_generator ||= begin
|
|
15
|
-
gen = Rails::Generators::AppGenerator.new ["rails"], generator_options, destination_root: Rails.root
|
|
16
|
-
gen.send(:valid_const?) unless File.exist?(Rails.root.join("config", "application.rb"))
|
|
17
|
-
gen
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
private
|
|
22
|
-
def generator_options
|
|
23
|
-
options = { api: !!Rails.application.config.api_only, update: true }
|
|
24
|
-
options[:name] = Rails.application.class.name.chomp("::Application").underscore
|
|
25
|
-
options[:skip_active_job] = !defined?(ActiveJob::Railtie)
|
|
26
|
-
options[:skip_active_record] = !defined?(ActiveRecord::Railtie)
|
|
27
|
-
options[:skip_active_storage] = !defined?(ActiveStorage::Engine)
|
|
28
|
-
options[:skip_action_mailer] = !defined?(ActionMailer::Railtie)
|
|
29
|
-
options[:skip_action_mailbox] = !defined?(ActionMailbox::Engine)
|
|
30
|
-
options[:skip_action_text] = !defined?(ActionText::Engine)
|
|
31
|
-
options[:skip_action_cable] = !defined?(ActionCable::Engine)
|
|
32
|
-
options[:skip_test] = !defined?(Rails::TestUnitRailtie)
|
|
33
|
-
options[:skip_system_test] = Rails.application.config.generators.system_tests.nil?
|
|
34
|
-
options[:asset_pipeline] = asset_pipeline
|
|
35
|
-
options[:skip_asset_pipeline] = asset_pipeline.nil?
|
|
36
|
-
options[:skip_bootsnap] = !defined?(Bootsnap)
|
|
37
|
-
options
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def asset_pipeline
|
|
41
|
-
case
|
|
42
|
-
when defined?(Sprockets::Railtie)
|
|
43
|
-
"sprockets"
|
|
44
|
-
when defined?(Propshaft::Railtie)
|
|
45
|
-
"propshaft"
|
|
46
|
-
else
|
|
47
|
-
nil
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
Description:
|
|
2
|
-
** DEPRECATED **
|
|
3
|
-
Rails 5.2 has introduced a new `credentials` API that replaces Rails secrets.
|
|
4
|
-
Please use the Rails `credentials` commands instead.
|
|
5
|
-
Run `bin/rails credentials:help` for more information.
|
|
6
|
-
|
|
7
|
-
The Rails `secrets` commands helps encrypting secrets to slim a production
|
|
8
|
-
environment's `ENV` hash. It's also useful for atomic deploys: no need to
|
|
9
|
-
coordinate key changes to get everything working as the keys are shipped
|
|
10
|
-
with the code.
|
|
11
|
-
|
|
12
|
-
Setup:
|
|
13
|
-
Run `<%= executable(:setup) %>` to opt in and generate the `config/secrets.yml.key`
|
|
14
|
-
and `config/secrets.yml.enc` files.
|
|
15
|
-
|
|
16
|
-
The latter contains all the keys to be encrypted while the former holds the
|
|
17
|
-
encryption key.
|
|
18
|
-
|
|
19
|
-
Don't lose the key! Put it in a password manager your team can access.
|
|
20
|
-
Should you lose it no one, including you, will be able to access any encrypted
|
|
21
|
-
secrets.
|
|
22
|
-
Don't commit the key! Add `config/secrets.yml.key` to your source control's
|
|
23
|
-
ignore file. If you use Git, Rails handles this for you.
|
|
24
|
-
|
|
25
|
-
Rails also looks for the key in `ENV["RAILS_MASTER_KEY"]` if that's easier to
|
|
26
|
-
manage.
|
|
27
|
-
|
|
28
|
-
You could prepend that to your server's start command like this:
|
|
29
|
-
|
|
30
|
-
RAILS_MASTER_KEY="im-the-master-now-hahaha" bin/rails server
|
|
31
|
-
|
|
32
|
-
The `config/secrets.yml.enc` has much the same format as `config/secrets.yml`:
|
|
33
|
-
|
|
34
|
-
production:
|
|
35
|
-
secret_key_base: so-secret-very-hidden-wow
|
|
36
|
-
payment_processing_gateway_key: much-safe-very-gaedwey-wow
|
|
37
|
-
|
|
38
|
-
But that's where the similarities between `secrets.yml` and `secrets.yml.enc`
|
|
39
|
-
end, e.g. no keys from `secrets.yml` will be moved to `secrets.yml.enc` and
|
|
40
|
-
be encrypted.
|
|
41
|
-
|
|
42
|
-
A `shared:` top level key is also supported such that any keys there is merged
|
|
43
|
-
into the other environments.
|
|
44
|
-
|
|
45
|
-
Additionally, Rails won't read encrypted secrets out of the box even if you have
|
|
46
|
-
the key. Add this:
|
|
47
|
-
|
|
48
|
-
config.read_encrypted_secrets = true
|
|
49
|
-
|
|
50
|
-
to the environment you'd like to read encrypted secrets. `<%= executable(:setup) %>`
|
|
51
|
-
inserts this into the production environment by default.
|
|
52
|
-
|
|
53
|
-
Editing Secrets:
|
|
54
|
-
After `<%= executable(:setup) %>`, run `<%= executable(:edit) %>`.
|
|
55
|
-
|
|
56
|
-
That command opens a temporary file in `$VISUAL` or `$EDITOR` with the decrypted
|
|
57
|
-
contents of `config/secrets.yml.enc` to edit the encrypted secrets.
|
|
58
|
-
|
|
59
|
-
When the temporary file is next saved the contents are encrypted and written to
|
|
60
|
-
`config/secrets.yml.enc` while the file itself is destroyed to prevent secrets
|
|
61
|
-
from leaking.
|