railties 6.0.0.beta2 → 6.0.2.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +150 -7
- data/RDOC_MAIN.rdoc +3 -3
- data/README.rdoc +1 -1
- data/lib/rails/api/task.rb +1 -0
- data/lib/rails/application.rb +23 -5
- data/lib/rails/application/bootstrap.rb +2 -10
- data/lib/rails/application/configuration.rb +45 -1
- data/lib/rails/application/default_middleware_stack.rb +1 -0
- data/lib/rails/application/dummy_erb_compiler.rb +18 -0
- data/lib/rails/application/finisher.rb +44 -1
- data/lib/rails/autoloaders.rb +14 -2
- data/lib/rails/command/base.rb +4 -0
- data/lib/rails/command/environment_argument.rb +7 -4
- data/lib/rails/commands/console/console_command.rb +6 -0
- data/lib/rails/commands/credentials/USAGE +1 -1
- data/lib/rails/commands/credentials/credentials_command.rb +17 -3
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +19 -7
- data/lib/rails/commands/dev/dev_command.rb +4 -2
- data/lib/rails/commands/encrypted/USAGE +28 -0
- data/lib/rails/commands/encrypted/encrypted_command.rb +1 -0
- data/lib/rails/commands/initializers/initializers_command.rb +7 -0
- data/lib/rails/commands/notes/notes_command.rb +1 -1
- data/lib/rails/commands/runner/runner_command.rb +7 -3
- data/lib/rails/commands/server/server_command.rb +8 -6
- data/lib/rails/engine.rb +41 -42
- data/lib/rails/engine/configuration.rb +3 -2
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators.rb +2 -0
- data/lib/rails/generators/app_base.rb +5 -5
- data/lib/rails/generators/app_name.rb +2 -2
- data/lib/rails/generators/base.rb +4 -0
- data/lib/rails/generators/database.rb +1 -1
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +6 -3
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +8 -0
- data/lib/rails/generators/generated_attribute.rb +36 -10
- data/lib/rails/generators/named_base.rb +1 -1
- data/lib/rails/generators/rails/app/app_generator.rb +1 -0
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +4 -4
- data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +8 -0
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +3 -2
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +2 -0
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +2 -0
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +10 -4
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +3 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt +12 -0
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +3 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +1 -0
- data/lib/rails/generators/rails/app/templates/package.json.tt +3 -3
- data/lib/rails/generators/rails/app/templates/public/robots.txt +1 -1
- data/lib/rails/generators/rails/app/templates/ruby-version.tt +1 -1
- data/lib/rails/generators/rails/assets/assets_generator.rb +7 -0
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +12 -2
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +0 -15
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +1 -0
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +14 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +1 -1
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.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 +7 -2
- data/lib/rails/info.rb +1 -1
- data/lib/rails/mailers_controller.rb +6 -3
- data/lib/rails/source_annotation_extractor.rb +19 -6
- data/lib/rails/tasks.rb +1 -0
- data/lib/rails/tasks/zeitwerk.rake +66 -0
- metadata +18 -13
- data/lib/rails/generators/rails/app/templates/bin/update.tt +0 -33
@@ -13,3 +13,11 @@ require("@rails/activestorage").start()
|
|
13
13
|
<%- unless options[:skip_action_cable] -%>
|
14
14
|
require("channels")
|
15
15
|
<%- end -%>
|
16
|
+
|
17
|
+
|
18
|
+
// Uncomment to copy all static images under ../images to the output folder and reference
|
19
|
+
// them with the image_pack_tag helper in views (e.g <%%= image_pack_tag 'rails.png' %>)
|
20
|
+
// or the `imagePath` JavaScript helper below.
|
21
|
+
//
|
22
|
+
// const images = require.context('../images', true)
|
23
|
+
// const imagePath = (name) => images(name, true)
|
@@ -8,7 +8,8 @@ def system!(*args)
|
|
8
8
|
end
|
9
9
|
|
10
10
|
FileUtils.chdir APP_ROOT do
|
11
|
-
# This script is a
|
11
|
+
# This script is a way to setup or update your development environment automatically.
|
12
|
+
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
|
12
13
|
# Add necessary setup steps to this file.
|
13
14
|
|
14
15
|
puts '== Installing dependencies =='
|
@@ -27,7 +28,7 @@ FileUtils.chdir APP_ROOT do
|
|
27
28
|
# end
|
28
29
|
|
29
30
|
puts "\n== Preparing database =="
|
30
|
-
system! 'bin/rails db:
|
31
|
+
system! 'bin/rails db:prepare'
|
31
32
|
<% end -%>
|
32
33
|
|
33
34
|
puts "\n== Removing old logs and tempfiles =="
|
@@ -15,9 +15,11 @@ Rails.application.configure do
|
|
15
15
|
# Enable/disable caching. By default caching is disabled.
|
16
16
|
# Run rails dev:cache to toggle caching.
|
17
17
|
if Rails.root.join('tmp', 'caching-dev.txt').exist?
|
18
|
+
<%- unless options.api? -%>
|
18
19
|
config.action_controller.perform_caching = true
|
19
20
|
config.action_controller.enable_fragment_cache_logging = true
|
20
21
|
|
22
|
+
<%- end -%>
|
21
23
|
config.cache_store = :memory_store
|
22
24
|
config.public_file_server.headers = {
|
23
25
|
'Cache-Control' => "public, max-age=#{2.days.to_i}"
|
@@ -12,7 +12,9 @@ Rails.application.configure do
|
|
12
12
|
|
13
13
|
# Full error reports are disabled and caching is turned on.
|
14
14
|
config.consider_all_requests_local = false
|
15
|
+
<%- unless options.api? -%>
|
15
16
|
config.action_controller.perform_caching = true
|
17
|
+
<%- end -%>
|
16
18
|
|
17
19
|
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
18
20
|
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
@@ -1,11 +1,17 @@
|
|
1
|
+
# The test environment is used exclusively to run your application's
|
2
|
+
# test suite. You never need to work with it otherwise. Remember that
|
3
|
+
# your test database is "scratch space" for the test suite and is wiped
|
4
|
+
# and recreated between test runs. Don't rely on the data there!
|
5
|
+
|
1
6
|
Rails.application.configure do
|
2
7
|
# Settings specified here will take precedence over those in config/application.rb.
|
3
8
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
9
|
+
<%-# Spring executes the reloaders when files change. %>
|
10
|
+
<%- if spring_install? -%>
|
11
|
+
config.cache_classes = false
|
12
|
+
<%- else -%>
|
8
13
|
config.cache_classes = true
|
14
|
+
<%- end -%>
|
9
15
|
|
10
16
|
# Do not eager load code on boot. This avoids loading your whole application
|
11
17
|
# just for the purpose of running a single test. If you are using a tool that
|
data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt
CHANGED
@@ -23,6 +23,9 @@
|
|
23
23
|
# If you are using UJS then enable automatic nonce generation
|
24
24
|
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
25
25
|
|
26
|
+
# Set the nonce only to specific directives
|
27
|
+
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
|
28
|
+
|
26
29
|
# Report CSP violations to a specified URI
|
27
30
|
# For further information see the following documentation:
|
28
31
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt
CHANGED
@@ -16,6 +16,9 @@
|
|
16
16
|
# It's best enabled when your entire app is migrated and stable on 6.0.
|
17
17
|
# Rails.application.config.action_dispatch.use_cookies_with_metadata = true
|
18
18
|
|
19
|
+
# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.
|
20
|
+
# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false
|
21
|
+
|
19
22
|
# Return false instead of self when enqueuing is aborted from a callback.
|
20
23
|
# Rails.application.config.active_job.return_false_on_aborted_enqueue = true
|
21
24
|
|
@@ -23,6 +26,10 @@
|
|
23
26
|
# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis
|
24
27
|
# Rails.application.config.active_storage.queues.purge = :active_storage_purge
|
25
28
|
|
29
|
+
# When assigning to a collection of attachments declared via `has_many_attached`, replace existing
|
30
|
+
# attachments instead of appending. Use #attach to add new attachments without replacing existing ones.
|
31
|
+
# Rails.application.config.active_storage.replace_on_assign_to_many = true
|
32
|
+
|
26
33
|
# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.
|
27
34
|
#
|
28
35
|
# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),
|
@@ -31,3 +38,8 @@
|
|
31
38
|
# MailDeliveryJob to ensure all delivery jobs are processed properly.
|
32
39
|
# Make sure your entire app is migrated and stable on 6.0 before using this setting.
|
33
40
|
# Rails.application.config.action_mailer.delivery_job = "ActionMailer::MailDeliveryJob"
|
41
|
+
|
42
|
+
# Enable the same cache key to be reused when the object being cached of type
|
43
|
+
# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)
|
44
|
+
# of the relation's cache key into the cache version to support recycling cache key.
|
45
|
+
# Rails.application.config.active_record.collection_cache_versioning = true
|
@@ -16,6 +16,9 @@ port ENV.fetch("PORT") { 3000 }
|
|
16
16
|
#
|
17
17
|
environment ENV.fetch("RAILS_ENV") { "development" }
|
18
18
|
|
19
|
+
# Specifies the `pidfile` that Puma will use.
|
20
|
+
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
|
21
|
+
|
19
22
|
# Specifies the number of `workers` to boot in clustered mode.
|
20
23
|
# Workers are forked web server processes. If using threads and workers together
|
21
24
|
# the concurrency of the application would be max `threads` * `workers`.
|
@@ -2,10 +2,10 @@
|
|
2
2
|
"name": "<%= app_name %>",
|
3
3
|
"private": true,
|
4
4
|
"dependencies": {
|
5
|
-
"@rails/ujs": "^6.0.0
|
5
|
+
"@rails/ujs": "^6.0.0"<% unless options[:skip_turbolinks] %>,
|
6
6
|
"turbolinks": "^5.2.0"<% end -%><% unless skip_active_storage? %>,
|
7
|
-
"@rails/activestorage": "^6.0.0
|
8
|
-
"@rails/actioncable": "^6.0.0
|
7
|
+
"@rails/activestorage": "^6.0.0"<% end -%><% unless options[:skip_action_cable] %>,
|
8
|
+
"@rails/actioncable": "^6.0.0"<% end %>
|
9
9
|
},
|
10
10
|
"version": "0.1.0"
|
11
11
|
}
|
@@ -1 +1 @@
|
|
1
|
-
# See
|
1
|
+
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
|
@@ -1 +1 @@
|
|
1
|
-
<%= ENV["RBENV_VERSION"] || ENV["rvm_ruby_string"] || "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}"
|
1
|
+
<%= ENV["RBENV_VERSION"] || ENV["rvm_ruby_string"] || "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}" %>
|
@@ -3,7 +3,10 @@
|
|
3
3
|
module Rails
|
4
4
|
module Generators
|
5
5
|
class AssetsGenerator < NamedBase # :nodoc:
|
6
|
+
class_option :javascripts, type: :boolean, desc: "Generate JavaScripts"
|
6
7
|
class_option :stylesheets, type: :boolean, desc: "Generate Stylesheets"
|
8
|
+
|
9
|
+
class_option :javascript_engine, desc: "Engine for JavaScripts"
|
7
10
|
class_option :stylesheet_engine, desc: "Engine for Stylesheets"
|
8
11
|
|
9
12
|
private
|
@@ -11,6 +14,10 @@ module Rails
|
|
11
14
|
file_name
|
12
15
|
end
|
13
16
|
|
17
|
+
hook_for :javascript_engine do |javascript_engine|
|
18
|
+
invoke javascript_engine, [name] if options[:javascripts]
|
19
|
+
end
|
20
|
+
|
14
21
|
hook_for :stylesheet_engine do |stylesheet_engine|
|
15
22
|
invoke stylesheet_engine, [name] if options[:stylesheets]
|
16
23
|
end
|
@@ -35,8 +35,9 @@ module Rails
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def edit_gemfile
|
38
|
-
|
39
|
-
gsub_file("Gemfile", all_database_gems_regex,
|
38
|
+
name, version = gem_for_database
|
39
|
+
gsub_file("Gemfile", all_database_gems_regex, name)
|
40
|
+
gsub_file("Gemfile", gem_entry_regex_for(name), gem_entry_for(name, *version))
|
40
41
|
end
|
41
42
|
|
42
43
|
private
|
@@ -48,6 +49,15 @@ module Rails
|
|
48
49
|
all_database_gem_names = all_database_gems.map(&:first)
|
49
50
|
/(\b#{all_database_gem_names.join('\b|\b')}\b)/
|
50
51
|
end
|
52
|
+
|
53
|
+
def gem_entry_regex_for(gem_name)
|
54
|
+
/^gem.*\b#{gem_name}\b.*/
|
55
|
+
end
|
56
|
+
|
57
|
+
def gem_entry_for(*gem_name_and_version)
|
58
|
+
gem_name_and_version.map! { |segment| "'#{segment}'" }
|
59
|
+
"gem #{gem_name_and_version.join(", ")}"
|
60
|
+
end
|
51
61
|
end
|
52
62
|
end
|
53
63
|
end
|
@@ -144,17 +144,6 @@ task default: :test
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
-
def javascripts
|
148
|
-
return if options.skip_javascript?
|
149
|
-
|
150
|
-
if mountable?
|
151
|
-
template "rails/javascripts.js",
|
152
|
-
"app/assets/javascripts/#{namespaced_name}/application.js"
|
153
|
-
elsif full?
|
154
|
-
empty_directory_with_keep_file "app/assets/javascripts/#{namespaced_name}"
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
147
|
def bin(force = false)
|
159
148
|
bin_file = engine? ? "bin/rails.tt" : "bin/test.tt"
|
160
149
|
template bin_file, force: force do |content|
|
@@ -236,10 +225,6 @@ task default: :test
|
|
236
225
|
build(:stylesheets) unless api?
|
237
226
|
end
|
238
227
|
|
239
|
-
def create_javascript_files
|
240
|
-
build(:javascripts) unless api?
|
241
|
-
end
|
242
|
-
|
243
228
|
def create_bin_files
|
244
229
|
build(:bin)
|
245
230
|
end
|
@@ -32,6 +32,20 @@ module Rails
|
|
32
32
|
hook_for :helper, as: :scaffold do |invoked|
|
33
33
|
invoke invoked, [ controller_name ]
|
34
34
|
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def permitted_params
|
39
|
+
attachments, others = attributes_names.partition { |name| attachments?(name) }
|
40
|
+
params = others.map { |name| ":#{name}" }
|
41
|
+
params += attachments.map { |name| "#{name}: []" }
|
42
|
+
params.join(", ")
|
43
|
+
end
|
44
|
+
|
45
|
+
def attachments?(name)
|
46
|
+
attribute = attributes.find { |attr| attr.name == name }
|
47
|
+
attribute&.attachments?
|
48
|
+
end
|
35
49
|
end
|
36
50
|
end
|
37
51
|
end
|
@@ -54,7 +54,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
54
54
|
<%- if attributes_names.empty? -%>
|
55
55
|
params.fetch(:<%= singular_table_name %>, {})
|
56
56
|
<%- else -%>
|
57
|
-
params.require(:<%= singular_table_name %>).permit(<%=
|
57
|
+
params.require(:<%= singular_table_name %>).permit(<%= permitted_params %>)
|
58
58
|
<%- end -%>
|
59
59
|
end
|
60
60
|
end
|
@@ -61,7 +61,7 @@ class <%= controller_class_name %>Controller < ApplicationController
|
|
61
61
|
<%- if attributes_names.empty? -%>
|
62
62
|
params.fetch(:<%= singular_table_name %>, {})
|
63
63
|
<%- else -%>
|
64
|
-
params.require(:<%= singular_table_name %>).permit(<%=
|
64
|
+
params.require(:<%= singular_table_name %>).permit(<%= permitted_params %>)
|
65
65
|
<%- end -%>
|
66
66
|
end
|
67
67
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Read about fixtures at
|
1
|
+
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
2
|
<% unless attributes.empty? -%>
|
3
3
|
<% %w(one two).each do |name| %>
|
4
4
|
<%= name %>:
|
@@ -7,7 +7,7 @@
|
|
7
7
|
password_digest: <%%= BCrypt::Password.create('secret') %>
|
8
8
|
<%- elsif attribute.reference? -%>
|
9
9
|
<%= yaml_key_value(attribute.column_name.sub(/_id$/, ''), attribute.default || name) %>
|
10
|
-
<%-
|
10
|
+
<%- elsif !attribute.virtual? -%>
|
11
11
|
<%= yaml_key_value(attribute.column_name, attribute.default) %>
|
12
12
|
<%- end -%>
|
13
13
|
<%- if attribute.polymorphic? -%>
|
@@ -49,16 +49,21 @@ module TestUnit # :nodoc:
|
|
49
49
|
attributes_names.map do |name|
|
50
50
|
if %w(password password_confirmation).include?(name) && attributes.any?(&:password_digest?)
|
51
51
|
["#{name}", "'secret'"]
|
52
|
-
|
52
|
+
elsif !virtual?(name)
|
53
53
|
["#{name}", "@#{singular_table_name}.#{name}"]
|
54
54
|
end
|
55
|
-
end.sort.to_h
|
55
|
+
end.compact.sort.to_h
|
56
56
|
end
|
57
57
|
|
58
58
|
def boolean?(name)
|
59
59
|
attribute = attributes.find { |attr| attr.name == name }
|
60
60
|
attribute&.type == :boolean
|
61
61
|
end
|
62
|
+
|
63
|
+
def virtual?(name)
|
64
|
+
attribute = attributes.find { |attr| attr.name == name }
|
65
|
+
attribute&.virtual?
|
66
|
+
end
|
62
67
|
end
|
63
68
|
end
|
64
69
|
end
|
data/lib/rails/info.rb
CHANGED
@@ -5,8 +5,9 @@ require "rails/application_controller"
|
|
5
5
|
class Rails::MailersController < Rails::ApplicationController # :nodoc:
|
6
6
|
prepend_view_path ActionDispatch::DebugView::RESCUES_TEMPLATE_PATH
|
7
7
|
|
8
|
+
around_action :set_locale, only: :preview
|
9
|
+
before_action :find_preview, only: :preview
|
8
10
|
before_action :require_local!, unless: :show_previews?
|
9
|
-
before_action :find_preview, :set_locale, only: :preview
|
10
11
|
|
11
12
|
helper_method :part_query, :locale_query
|
12
13
|
|
@@ -38,7 +39,7 @@ class Rails::MailersController < Rails::ApplicationController # :nodoc:
|
|
38
39
|
end
|
39
40
|
else
|
40
41
|
@part = find_preferred_part(request.format, Mime[:html], Mime[:text])
|
41
|
-
render action: "email", layout: false, formats:
|
42
|
+
render action: "email", layout: false, formats: [:html]
|
42
43
|
end
|
43
44
|
else
|
44
45
|
raise AbstractController::ActionNotFound, "Email '#{@email_action}' not found in #{@preview.name}"
|
@@ -92,6 +93,8 @@ class Rails::MailersController < Rails::ApplicationController # :nodoc:
|
|
92
93
|
end
|
93
94
|
|
94
95
|
def set_locale
|
95
|
-
I18n.
|
96
|
+
I18n.with_locale(params[:locale] || I18n.default_locale) do
|
97
|
+
yield
|
98
|
+
end
|
96
99
|
end
|
97
100
|
end
|
@@ -2,11 +2,6 @@
|
|
2
2
|
|
3
3
|
require "active_support/deprecation"
|
4
4
|
|
5
|
-
# Remove this deprecated class in the next minor version
|
6
|
-
#:nodoc:
|
7
|
-
SourceAnnotationExtractor = ActiveSupport::Deprecation::DeprecatedConstantProxy.
|
8
|
-
new("SourceAnnotationExtractor", "Rails::SourceAnnotationExtractor")
|
9
|
-
|
10
5
|
module Rails
|
11
6
|
# Implements the logic behind <tt>Rails::Command::NotesCommand</tt>. See <tt>rails notes --help</tt> for usage information.
|
12
7
|
#
|
@@ -29,6 +24,16 @@ module Rails
|
|
29
24
|
directories.push(*dirs)
|
30
25
|
end
|
31
26
|
|
27
|
+
def self.tags
|
28
|
+
@@tags ||= %w(OPTIMIZE FIXME TODO)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Registers additional tags
|
32
|
+
# Rails::SourceAnnotationExtractor::Annotation.register_tags("TESTME", "DEPRECATEME")
|
33
|
+
def self.register_tags(*additional_tags)
|
34
|
+
tags.push(*additional_tags)
|
35
|
+
end
|
36
|
+
|
32
37
|
def self.extensions
|
33
38
|
@@extensions ||= {}
|
34
39
|
end
|
@@ -66,6 +71,8 @@ module Rails
|
|
66
71
|
# Prints all annotations with tag +tag+ under the root directories +app+,
|
67
72
|
# +config+, +db+, +lib+, and +test+ (recursively).
|
68
73
|
#
|
74
|
+
# If +tag+ is <tt>nil</tt>, annotations with either default or registered tags are printed.
|
75
|
+
#
|
69
76
|
# Specific directories can be explicitly set using the <tt>:dirs</tt> key in +options+.
|
70
77
|
#
|
71
78
|
# Rails::SourceAnnotationExtractor.enumerate 'TODO|FIXME', dirs: %w(app lib), tag: true
|
@@ -75,7 +82,8 @@ module Rails
|
|
75
82
|
# See <tt>#find_in</tt> for a list of file extensions that will be taken into account.
|
76
83
|
#
|
77
84
|
# This class method is the single entry point for the `rails notes` command.
|
78
|
-
def self.enumerate(tag, options = {})
|
85
|
+
def self.enumerate(tag = nil, options = {})
|
86
|
+
tag ||= Annotation.tags.join("|")
|
79
87
|
extractor = new(tag)
|
80
88
|
dirs = options.delete(:dirs) || Annotation.directories
|
81
89
|
extractor.display(extractor.find(dirs), options)
|
@@ -147,3 +155,8 @@ module Rails
|
|
147
155
|
end
|
148
156
|
end
|
149
157
|
end
|
158
|
+
|
159
|
+
# Remove this deprecated class in the next minor version
|
160
|
+
#:nodoc:
|
161
|
+
SourceAnnotationExtractor = ActiveSupport::Deprecation::DeprecatedConstantProxy.
|
162
|
+
new("SourceAnnotationExtractor", "Rails::SourceAnnotationExtractor")
|