railties 6.1.7.8 → 7.0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +219 -320
- data/RDOC_MAIN.rdoc +16 -16
- data/README.rdoc +1 -2
- data/lib/minitest/rails_plugin.rb +1 -1
- data/lib/rails/all.rb +0 -1
- data/lib/rails/app_updater.rb +9 -6
- data/lib/rails/application/bootstrap.rb +24 -5
- data/lib/rails/application/configuration.rb +95 -33
- data/lib/rails/application/default_middleware_stack.rb +22 -3
- data/lib/rails/application/finisher.rb +53 -95
- data/lib/rails/application/routes_reloader.rb +8 -0
- data/lib/rails/application.rb +74 -101
- data/lib/rails/application_controller.rb +3 -3
- data/lib/rails/autoloaders/inflector.rb +21 -0
- data/lib/rails/autoloaders.rb +42 -42
- data/lib/rails/code_statistics.rb +2 -2
- data/lib/rails/code_statistics_calculator.rb +10 -1
- data/lib/rails/command/base.rb +26 -12
- data/lib/rails/command/behavior.rb +1 -1
- data/lib/rails/command/environment_argument.rb +1 -1
- data/lib/rails/command.rb +9 -6
- data/lib/rails/commands/console/console_command.rb +4 -0
- data/lib/rails/commands/credentials/USAGE +4 -2
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +26 -16
- data/lib/rails/commands/credentials/credentials_command.rb +7 -3
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +10 -11
- data/lib/rails/commands/help/USAGE +3 -2
- data/lib/rails/commands/runner/runner_command.rb +3 -2
- data/lib/rails/commands/server/server_command.rb +7 -5
- data/lib/rails/configuration.rb +18 -23
- data/lib/rails/console/helpers.rb +2 -2
- data/lib/rails/engine/configuration.rb +3 -3
- data/lib/rails/engine.rb +31 -37
- data/lib/rails/gem_version.rb +5 -5
- data/lib/rails/generators/actions/create_migration.rb +2 -4
- data/lib/rails/generators/actions.rb +229 -62
- data/lib/rails/generators/app_base.rb +155 -130
- data/lib/rails/generators/app_name.rb +1 -1
- data/lib/rails/generators/base.rb +12 -16
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +2 -0
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +8 -8
- 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 -1
- data/lib/rails/generators/generated_attribute.rb +45 -9
- data/lib/rails/generators/migration.rb +2 -6
- data/lib/rails/generators/model_helpers.rb +1 -1
- data/lib/rails/generators/named_base.rb +13 -13
- data/lib/rails/generators/rails/app/app_generator.rb +70 -91
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +44 -52
- 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 +3 -9
- data/lib/rails/generators/rails/app/templates/bin/rails.tt +1 -4
- data/lib/rails/generators/rails/app/templates/bin/rake.tt +0 -3
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +9 -14
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +0 -1
- data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +3 -3
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +5 -5
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +7 -13
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +12 -39
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +7 -12
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +1 -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 +2 -2
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +3 -1
- 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_0.rb.tt +143 -0
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +3 -3
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +4 -1
- data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +5 -5
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/gitattributes.tt +0 -5
- data/lib/rails/generators/rails/app/templates/gitignore.tt +3 -1
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +1 -1
- data/lib/rails/generators/rails/controller/controller_generator.rb +1 -2
- data/lib/rails/generators/rails/controller/templates/controller.rb.tt +0 -4
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +1 -1
- data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +76 -27
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +7 -3
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +9 -31
- data/lib/rails/generators/rails/plugin/templates/README.md.tt +1 -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 -6
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +0 -5
- 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/rails/boot.rb.tt +2 -2
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +2 -7
- data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +0 -19
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +1 -5
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +6 -10
- data/lib/rails/generators/resource_helpers.rb +2 -2
- data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +3 -3
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +5 -5
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +7 -7
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +9 -11
- data/lib/rails/generators/testing/behaviour.rb +3 -4
- data/lib/rails/generators.rb +17 -24
- data/lib/rails/info.rb +1 -1
- data/lib/rails/info_controller.rb +1 -3
- data/lib/rails/initializable.rb +1 -1
- data/lib/rails/mailers_controller.rb +2 -4
- data/lib/rails/paths.rb +1 -1
- data/lib/rails/rack/logger.rb +7 -9
- data/lib/rails/railtie/configuration.rb +1 -2
- data/lib/rails/railtie.rb +36 -13
- data/lib/rails/ruby_version_check.rb +3 -3
- data/lib/rails/source_annotation_extractor.rb +1 -1
- data/lib/rails/tasks/framework.rake +7 -9
- data/lib/rails/tasks/statistics.rake +3 -1
- data/lib/rails/tasks/tmp.rake +8 -1
- data/lib/rails/tasks/yarn.rake +8 -9
- data/lib/rails/tasks/zeitwerk.rake +2 -10
- data/lib/rails/templates/layouts/application.html.erb +15 -0
- data/lib/rails/templates/rails/mailers/email.html.erb +13 -11
- data/lib/rails/templates/rails/welcome/index.html.erb +64 -48
- data/lib/rails/test_help.rb +4 -0
- data/lib/rails/test_unit/railtie.rb +0 -4
- data/lib/rails/test_unit/runner.rb +16 -9
- data/lib/rails/test_unit/testing.rake +4 -9
- data/lib/rails/version.rb +1 -1
- data/lib/rails/welcome_controller.rb +1 -0
- data/lib/rails.rb +13 -2
- metadata +33 -37
- data/lib/rails/command/spellchecker.rb +0 -57
- 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/spring.tt +0 -13
- data/lib/rails/generators/rails/app/templates/bin/yarn.tt +0 -16
- 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 -8
- 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_1.rb.tt +0 -67
- 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 -16
- 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/scaffold/templates/scaffold.css +0 -80
data/lib/rails/paths.rb
CHANGED
@@ -12,7 +12,7 @@ module Rails
|
|
12
12
|
# root.add "app/controllers", eager_load: true
|
13
13
|
#
|
14
14
|
# The above command creates a new root object and adds "app/controllers" as a path.
|
15
|
-
# This means we can get a
|
15
|
+
# This means we can get a Rails::Paths::Path object back like below:
|
16
16
|
#
|
17
17
|
# path = root["app/controllers"]
|
18
18
|
# path.eager_load? # => true
|
data/lib/rails/rack/logger.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require "active_support/core_ext/time/conversions"
|
4
4
|
require "active_support/core_ext/object/blank"
|
5
5
|
require "active_support/log_subscriber"
|
6
|
-
require "action_dispatch/http/request"
|
7
6
|
require "rack/body_proxy"
|
8
7
|
|
9
8
|
module Rails
|
@@ -32,13 +31,17 @@ module Rails
|
|
32
31
|
private
|
33
32
|
def call_app(request, env) # :doc:
|
34
33
|
instrumenter = ActiveSupport::Notifications.instrumenter
|
35
|
-
instrumenter.start "request.action_dispatch", request: request
|
34
|
+
instrumenter_state = instrumenter.start "request.action_dispatch", request: request
|
35
|
+
instrumenter_finish = -> () {
|
36
|
+
instrumenter.finish_with_state(instrumenter_state, "request.action_dispatch", request: request)
|
37
|
+
}
|
38
|
+
|
36
39
|
logger.info { started_request_message(request) }
|
37
40
|
status, headers, body = @app.call(env)
|
38
|
-
body = ::Rack::BodyProxy.new(body
|
41
|
+
body = ::Rack::BodyProxy.new(body, &instrumenter_finish)
|
39
42
|
[status, headers, body]
|
40
43
|
rescue Exception
|
41
|
-
|
44
|
+
instrumenter_finish.call
|
42
45
|
raise
|
43
46
|
ensure
|
44
47
|
ActiveSupport::LogSubscriber.flush_all!
|
@@ -66,11 +69,6 @@ module Rails
|
|
66
69
|
end
|
67
70
|
end
|
68
71
|
|
69
|
-
def finish(request)
|
70
|
-
instrumenter = ActiveSupport::Notifications.instrumenter
|
71
|
-
instrumenter.finish "request.action_dispatch", request: request
|
72
|
-
end
|
73
|
-
|
74
72
|
def logger
|
75
73
|
Rails.logger
|
76
74
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "rails/configuration"
|
4
|
-
require "active_support/core_ext/symbol/starts_ends_with"
|
5
4
|
|
6
5
|
module Rails
|
7
6
|
class Railtie
|
@@ -11,7 +10,7 @@ module Rails
|
|
11
10
|
end
|
12
11
|
|
13
12
|
# Expose the eager_load_namespaces at "module" level for convenience.
|
14
|
-
def self.eager_load_namespaces
|
13
|
+
def self.eager_load_namespaces # :nodoc:
|
15
14
|
@@eager_load_namespaces ||= []
|
16
15
|
end
|
17
16
|
|
data/lib/rails/railtie.rb
CHANGED
@@ -24,7 +24,7 @@ module Rails
|
|
24
24
|
# * creating initializers
|
25
25
|
# * configuring a Rails framework for the application, like setting a generator
|
26
26
|
# * adding <tt>config.*</tt> keys to the environment
|
27
|
-
# * setting up a subscriber with
|
27
|
+
# * setting up a subscriber with ActiveSupport::Notifications
|
28
28
|
# * adding Rake tasks
|
29
29
|
#
|
30
30
|
# == Creating a Railtie
|
@@ -129,7 +129,7 @@ module Rails
|
|
129
129
|
# == Application and Engine
|
130
130
|
#
|
131
131
|
# An engine is nothing more than a railtie with some initializers already set. And since
|
132
|
-
#
|
132
|
+
# Rails::Application is an engine, the same configuration described here can be
|
133
133
|
# used in both.
|
134
134
|
#
|
135
135
|
# Be sure to look at the documentation of those specific classes for more information.
|
@@ -146,7 +146,7 @@ module Rails
|
|
146
146
|
delegate :config, to: :instance
|
147
147
|
|
148
148
|
def subclasses
|
149
|
-
super.reject(&:abstract_railtie?)
|
149
|
+
super.reject(&:abstract_railtie?).sort
|
150
150
|
end
|
151
151
|
|
152
152
|
def rake_tasks(&blk)
|
@@ -191,25 +191,44 @@ module Rails
|
|
191
191
|
instance.configure(&block)
|
192
192
|
end
|
193
193
|
|
194
|
+
def <=>(other) # :nodoc:
|
195
|
+
load_index <=> other.load_index
|
196
|
+
end
|
197
|
+
|
198
|
+
def inherited(subclass)
|
199
|
+
subclass.increment_load_index
|
200
|
+
super
|
201
|
+
end
|
202
|
+
|
203
|
+
protected
|
204
|
+
attr_reader :load_index
|
205
|
+
|
206
|
+
def increment_load_index
|
207
|
+
@@load_counter ||= 0
|
208
|
+
@load_index = (@@load_counter += 1)
|
209
|
+
end
|
210
|
+
|
194
211
|
private
|
195
212
|
def generate_railtie_name(string)
|
196
213
|
ActiveSupport::Inflector.underscore(string).tr("/", "_")
|
197
214
|
end
|
198
215
|
|
199
216
|
def respond_to_missing?(name, _)
|
217
|
+
return super if abstract_railtie?
|
218
|
+
|
200
219
|
instance.respond_to?(name) || super
|
201
220
|
end
|
202
221
|
|
203
222
|
# If the class method does not have a method, then send the method call
|
204
223
|
# to the Railtie instance.
|
205
224
|
def method_missing(name, *args, &block)
|
206
|
-
if instance.respond_to?(name)
|
225
|
+
if !abstract_railtie? && instance.respond_to?(name)
|
207
226
|
instance.public_send(name, *args, &block)
|
208
227
|
else
|
209
228
|
super
|
210
229
|
end
|
211
230
|
end
|
212
|
-
ruby2_keywords(:method_missing)
|
231
|
+
ruby2_keywords(:method_missing)
|
213
232
|
|
214
233
|
# receives an instance variable identifier, set the variable value if is
|
215
234
|
# blank and append given block to value, which will be used later in
|
@@ -224,13 +243,17 @@ module Rails
|
|
224
243
|
|
225
244
|
delegate :railtie_name, to: :class
|
226
245
|
|
227
|
-
def initialize
|
246
|
+
def initialize # :nodoc:
|
228
247
|
if self.class.abstract_railtie?
|
229
248
|
raise "#{self.class.name} is abstract, you cannot instantiate it directly."
|
230
249
|
end
|
231
250
|
end
|
232
251
|
|
233
|
-
def
|
252
|
+
def inspect # :nodoc:
|
253
|
+
"#<#{self.class.name}>"
|
254
|
+
end
|
255
|
+
|
256
|
+
def configure(&block) # :nodoc:
|
234
257
|
instance_eval(&block)
|
235
258
|
end
|
236
259
|
|
@@ -241,29 +264,29 @@ module Rails
|
|
241
264
|
@config ||= Railtie::Configuration.new
|
242
265
|
end
|
243
266
|
|
244
|
-
def railtie_namespace
|
267
|
+
def railtie_namespace # :nodoc:
|
245
268
|
@railtie_namespace ||= self.class.module_parents.detect { |n| n.respond_to?(:railtie_namespace) }
|
246
269
|
end
|
247
270
|
|
248
271
|
protected
|
249
|
-
def run_console_blocks(app)
|
272
|
+
def run_console_blocks(app) # :nodoc:
|
250
273
|
each_registered_block(:console) { |block| block.call(app) }
|
251
274
|
end
|
252
275
|
|
253
|
-
def run_generators_blocks(app)
|
276
|
+
def run_generators_blocks(app) # :nodoc:
|
254
277
|
each_registered_block(:generators) { |block| block.call(app) }
|
255
278
|
end
|
256
279
|
|
257
|
-
def run_runner_blocks(app)
|
280
|
+
def run_runner_blocks(app) # :nodoc:
|
258
281
|
each_registered_block(:runner) { |block| block.call(app) }
|
259
282
|
end
|
260
283
|
|
261
|
-
def run_tasks_blocks(app)
|
284
|
+
def run_tasks_blocks(app) # :nodoc:
|
262
285
|
extend Rake::DSL
|
263
286
|
each_registered_block(:rake_tasks) { |block| instance_exec(app, &block) }
|
264
287
|
end
|
265
288
|
|
266
|
-
def run_server_blocks(app)
|
289
|
+
def run_server_blocks(app) # :nodoc:
|
267
290
|
each_registered_block(:server) { |block| block.call(app) }
|
268
291
|
end
|
269
292
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.
|
3
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.7.0") && RUBY_ENGINE == "ruby"
|
4
4
|
desc = defined?(RUBY_DESCRIPTION) ? RUBY_DESCRIPTION : "ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE})"
|
5
5
|
abort <<-end_message
|
6
6
|
|
7
|
-
Rails
|
7
|
+
Rails 7 requires Ruby 2.7.0 or newer.
|
8
8
|
|
9
9
|
You're running
|
10
10
|
#{desc}
|
11
11
|
|
12
|
-
Please upgrade to Ruby 2.
|
12
|
+
Please upgrade to Ruby 2.7.0 or newer to continue.
|
13
13
|
|
14
14
|
end_message
|
15
15
|
end
|
@@ -70,7 +70,7 @@ module Rails
|
|
70
70
|
#
|
71
71
|
# If +options+ has a <tt>:tag</tt> flag, it will be passed to each annotation's +to_s+.
|
72
72
|
#
|
73
|
-
# See
|
73
|
+
# See SourceAnnotationExtractor#find_in for a list of file extensions that will be taken into account.
|
74
74
|
#
|
75
75
|
# This class method is the single entry point for the <tt>rails notes</tt> command.
|
76
76
|
def self.enumerate(tag = nil, options = {})
|
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
namespace :app do
|
4
4
|
desc "Update configs and some other initially generated files (or use just update:configs or update:bin)"
|
5
|
-
task update: [ "update:configs", "update:bin", "update:active_storage", "update:upgrade_guide_info" ]
|
5
|
+
task update: [ "update:configs", "update:bin", "update:db", "update:active_storage", "update:upgrade_guide_info" ]
|
6
6
|
|
7
7
|
desc "Applies the template supplied by LOCATION=(/path/to/template) or URL"
|
8
8
|
task template: :environment do
|
9
9
|
template = ENV["LOCATION"]
|
10
10
|
raise "No LOCATION value given. Please set LOCATION either as path to a file or a URL" if template.blank?
|
11
|
-
template = File.expand_path(template) unless %r{\A[A-Za-z][A-Za-z0-9
|
11
|
+
template = File.expand_path(template) unless %r{\A[A-Za-z][A-Za-z0-9+\-.]*://}.match?(template)
|
12
12
|
require "rails/generators"
|
13
13
|
require "rails/generators/rails/app/app_generator"
|
14
14
|
generator = Rails::Generators::AppGenerator.new [Rails.root], {}, { destination_root: Rails.root }
|
@@ -22,7 +22,7 @@ namespace :app do
|
|
22
22
|
project_templates = "#{Rails.root}/lib/templates"
|
23
23
|
|
24
24
|
default_templates = { "erb" => %w{controller mailer scaffold},
|
25
|
-
"rails" => %w{controller helper scaffold_controller
|
25
|
+
"rails" => %w{controller helper scaffold_controller} }
|
26
26
|
|
27
27
|
default_templates.each do |type, names|
|
28
28
|
local_template_type_dir = File.join(project_templates, type)
|
@@ -51,6 +51,10 @@ namespace :app do
|
|
51
51
|
Rails::AppUpdater.invoke_from_app_generator :update_bin_files
|
52
52
|
end
|
53
53
|
|
54
|
+
task :db do
|
55
|
+
Rails::AppUpdater.invoke_from_app_generator :update_db_schema
|
56
|
+
end
|
57
|
+
|
54
58
|
task :active_storage do
|
55
59
|
Rails::AppUpdater.invoke_from_app_generator :update_active_storage
|
56
60
|
end
|
@@ -59,10 +63,4 @@ namespace :app do
|
|
59
63
|
Rails::AppUpdater.invoke_from_app_generator :display_upgrade_guide_info
|
60
64
|
end
|
61
65
|
end
|
62
|
-
|
63
|
-
namespace :binstub do
|
64
|
-
task :yarn do
|
65
|
-
Rails::AppUpdater.invoke_from_app_generator :update_bin_yarn
|
66
|
-
end
|
67
|
-
end
|
68
66
|
end
|
@@ -11,17 +11,19 @@ STATS_DIRECTORIES ||= [
|
|
11
11
|
%w(Mailers app/mailers),
|
12
12
|
%w(Mailboxes app/mailboxes),
|
13
13
|
%w(Channels app/channels),
|
14
|
+
%w(Views app/views),
|
14
15
|
%w(JavaScripts app/assets/javascripts),
|
16
|
+
%w(Stylesheets app/assets/stylesheets),
|
15
17
|
%w(JavaScript app/javascript),
|
16
18
|
%w(Libraries lib/),
|
17
19
|
%w(APIs app/apis),
|
18
20
|
%w(Controller\ tests test/controllers),
|
19
21
|
%w(Helper\ tests test/helpers),
|
22
|
+
%w(Job\ tests test/jobs),
|
20
23
|
%w(Model\ tests test/models),
|
21
24
|
%w(Mailer\ tests test/mailers),
|
22
25
|
%w(Mailbox\ tests test/mailboxes),
|
23
26
|
%w(Channel\ tests test/channels),
|
24
|
-
%w(Job\ tests test/jobs),
|
25
27
|
%w(Integration\ tests test/integration),
|
26
28
|
%w(System\ tests test/system),
|
27
29
|
].collect do |name, dir|
|
data/lib/rails/tasks/tmp.rake
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
namespace :tmp do
|
4
4
|
desc "Clear cache, socket and screenshot files from tmp/ (narrow w/ tmp:cache:clear, tmp:sockets:clear, tmp:screenshots:clear)"
|
5
|
-
task clear: ["tmp:cache:clear", "tmp:sockets:clear", "tmp:screenshots:clear"]
|
5
|
+
task clear: ["tmp:cache:clear", "tmp:sockets:clear", "tmp:screenshots:clear", "tmp:storage:clear"]
|
6
6
|
|
7
7
|
tmp_dirs = [ "tmp/cache",
|
8
8
|
"tmp/sockets",
|
@@ -41,4 +41,11 @@ namespace :tmp do
|
|
41
41
|
rm Dir["tmp/screenshots/[^.]*"], verbose: false
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
namespace :storage do
|
46
|
+
# desc "Clear all files and directories in tmp/storage"
|
47
|
+
task :clear do
|
48
|
+
rm_rf Dir["tmp/storage/[^.]*"], verbose: false
|
49
|
+
end
|
50
|
+
end
|
44
51
|
end
|
data/lib/rails/tasks/yarn.rake
CHANGED
@@ -10,21 +10,20 @@ namespace :yarn do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
yarn_flags =
|
13
|
-
if
|
13
|
+
if `yarn --version`.start_with?("1")
|
14
14
|
"--no-progress --frozen-lockfile"
|
15
15
|
else
|
16
16
|
"--immutable"
|
17
17
|
end
|
18
18
|
|
19
|
-
system(
|
19
|
+
system(
|
20
|
+
{ "NODE_ENV" => node_env },
|
21
|
+
"yarn install #{yarn_flags}",
|
22
|
+
exception: true
|
23
|
+
)
|
20
24
|
rescue Errno::ENOENT
|
21
|
-
$stderr.puts "
|
22
|
-
$stderr.puts "
|
25
|
+
$stderr.puts "yarn install failed to execute."
|
26
|
+
$stderr.puts "Ensure yarn is installed and `yarn --version` runs without errors."
|
23
27
|
exit 1
|
24
28
|
end
|
25
29
|
end
|
26
|
-
|
27
|
-
# Run Yarn prior to Sprockets assets precompilation, so dependencies are available for use.
|
28
|
-
if Rake::Task.task_defined?("assets:precompile") && File.exist?(Rails.root.join("bin", "yarn"))
|
29
|
-
Rake::Task["assets:precompile"].enhance [ "yarn:install" ]
|
30
|
-
end
|
@@ -1,11 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
ensure_zeitwerk_mode = ->() do
|
4
|
-
unless Rails.autoloaders.zeitwerk_enabled?
|
5
|
-
abort "Please, enable :zeitwerk mode in config/application.rb and try again."
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
3
|
eager_load = ->() do
|
10
4
|
puts "Hold on, I am eager loading the application."
|
11
5
|
Zeitwerk::Loader.eager_load_all
|
@@ -41,8 +35,6 @@ end
|
|
41
35
|
namespace :zeitwerk do
|
42
36
|
desc "Checks project structure for Zeitwerk compatibility"
|
43
37
|
task check: :environment do
|
44
|
-
ensure_zeitwerk_mode[]
|
45
|
-
|
46
38
|
begin
|
47
39
|
eager_load[]
|
48
40
|
rescue NameError => e
|
@@ -54,11 +46,11 @@ namespace :zeitwerk do
|
|
54
46
|
end
|
55
47
|
|
56
48
|
require "active_support/core_ext/object/try"
|
57
|
-
eager_load_paths = Rails.configuration.eager_load_namespaces.
|
49
|
+
eager_load_paths = Rails.configuration.eager_load_namespaces.filter_map do |eln|
|
58
50
|
# Quick regression fix for 6.0.3 to support namespaces that do not have
|
59
51
|
# eager load paths, like the recently added i18n. I'll rewrite this task.
|
60
52
|
eln.try(:config).try(:eager_load_paths)
|
61
|
-
end.
|
53
|
+
end.flatten
|
62
54
|
|
63
55
|
not_checked = ActiveSupport::Dependencies.autoload_paths - eager_load_paths
|
64
56
|
not_checked.select! { |dir| Dir.exist?(dir) }
|
@@ -25,6 +25,21 @@
|
|
25
25
|
|
26
26
|
h2 { padding-left: 10px; }
|
27
27
|
|
28
|
+
@media (prefers-color-scheme: dark) {
|
29
|
+
body {
|
30
|
+
background-color: #222;
|
31
|
+
color: #ececec;
|
32
|
+
}
|
33
|
+
|
34
|
+
pre {
|
35
|
+
background-color: #333;
|
36
|
+
}
|
37
|
+
|
38
|
+
a { color: #fff; }
|
39
|
+
a:visited { color: #999; }
|
40
|
+
a:hover { color: #000; background-color: #fff; }
|
41
|
+
}
|
42
|
+
|
28
43
|
<%= yield :style %>
|
29
44
|
</style>
|
30
45
|
</head>
|
@@ -56,35 +56,35 @@
|
|
56
56
|
<dl>
|
57
57
|
<% if @email.respond_to?(:smtp_envelope_from) && Array(@email.from) != Array(@email.smtp_envelope_from) %>
|
58
58
|
<dt>SMTP-From:</dt>
|
59
|
-
<dd><%= @email.smtp_envelope_from %></dd>
|
59
|
+
<dd id="smtp_from"><%= @email.smtp_envelope_from %></dd>
|
60
60
|
<% end %>
|
61
61
|
|
62
62
|
<% if @email.respond_to?(:smtp_envelope_to) && @email.to != @email.smtp_envelope_to %>
|
63
63
|
<dt>SMTP-To:</dt>
|
64
|
-
<dd><%= @email.smtp_envelope_to %></dd>
|
64
|
+
<dd id="smtp_to"><%= @email.smtp_envelope_to %></dd>
|
65
65
|
<% end %>
|
66
66
|
|
67
67
|
<dt>From:</dt>
|
68
|
-
<dd><%= @email.header['from'] %></dd>
|
68
|
+
<dd id="from"><%= @email.header['from'] %></dd>
|
69
69
|
|
70
70
|
<% if @email.reply_to %>
|
71
71
|
<dt>Reply-To:</dt>
|
72
|
-
<dd><%= @email.header['reply-to'] %></dd>
|
72
|
+
<dd id="reply_to"><%= @email.header['reply-to'] %></dd>
|
73
73
|
<% end %>
|
74
74
|
|
75
75
|
<dt>To:</dt>
|
76
|
-
<dd><%= @email.header['to'] %></dd>
|
76
|
+
<dd id="to"><%= @email.header['to'] %></dd>
|
77
77
|
|
78
78
|
<% if @email.cc %>
|
79
79
|
<dt>CC:</dt>
|
80
|
-
<dd><%= @email.header['cc'] %></dd>
|
80
|
+
<dd id="cc"><%= @email.header['cc'] %></dd>
|
81
81
|
<% end %>
|
82
82
|
|
83
83
|
<dt>Date:</dt>
|
84
|
-
<dd><%= Time.current.rfc2822 %></dd>
|
84
|
+
<dd id="date"><%= Time.current.rfc2822 %></dd>
|
85
85
|
|
86
86
|
<dt>Subject:</dt>
|
87
|
-
<dd><strong><%= @email.subject %></strong></dd>
|
87
|
+
<dd><strong id="subject"><%= @email.subject %></strong></dd>
|
88
88
|
|
89
89
|
<% unless @email.attachments.nil? || @email.attachments.empty? %>
|
90
90
|
<dt>Attachments:</dt>
|
@@ -97,15 +97,17 @@
|
|
97
97
|
<% end %>
|
98
98
|
|
99
99
|
<dt>Format:</dt>
|
100
|
-
<% if @email.
|
100
|
+
<% if @email.html_part && @email.text_part %>
|
101
101
|
<dd>
|
102
102
|
<select id="part" onchange="refreshBody(false);">
|
103
103
|
<option <%= request.format == Mime[:html] ? 'selected' : '' %> value="<%= part_query('text/html') %>">View as HTML email</option>
|
104
104
|
<option <%= request.format == Mime[:text] ? 'selected' : '' %> value="<%= part_query('text/plain') %>">View as plain-text email</option>
|
105
105
|
</select>
|
106
106
|
</dd>
|
107
|
+
<% elsif @part %>
|
108
|
+
<dd id="mime_type" data-mime-type="<%= part_query(@part.mime_type) %>"><%= @part.mime_type == 'text/html' ? 'HTML email' : 'plain-text email' %></dd>
|
107
109
|
<% else %>
|
108
|
-
<dd id="mime_type" data-mime-type="
|
110
|
+
<dd id="mime_type" data-mime-type=""></dd>
|
109
111
|
<% end %>
|
110
112
|
|
111
113
|
<% if I18n.available_locales.count > 1 %>
|
@@ -122,7 +124,7 @@
|
|
122
124
|
</header>
|
123
125
|
|
124
126
|
<% if @part && @part.mime_type %>
|
125
|
-
<iframe
|
127
|
+
<iframe name="messageBody" src="?<%= part_query(@part.mime_type) %>"></iframe>
|
126
128
|
<% else %>
|
127
129
|
<p>
|
128
130
|
You are trying to preview an email that does not have any content.
|