aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--railties/lib/rails/generators/app_base.rb10
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/application.rb.tt1
-rw-r--r--railties/test/generators/app_generator_test.rb15
-rw-r--r--railties/test/generators/shared_generator_tests.rb2
4 files changed, 27 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index 7b30f8b9ca..3778690ef6 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -47,6 +47,9 @@ module Rails
class_option :skip_action_mailbox, type: :boolean, default: false,
desc: "Skip Action Mailbox gem"
+ class_option :skip_action_text, type: :boolean, default: false,
+ desc: "Skip Action Text gem"
+
class_option :skip_active_record, type: :boolean, aliases: "-O", default: false,
desc: "Skip Active Record files"
@@ -204,7 +207,8 @@ module Rails
:skip_action_cable
),
skip_active_storage?,
- skip_action_mailbox?
+ skip_action_mailbox?,
+ skip_action_text?
].flatten.none?
end
@@ -237,6 +241,10 @@ module Rails
options[:skip_action_mailbox] || skip_active_storage?
end
+ def skip_action_text? # :doc:
+ options[:skip_action_text] || skip_active_storage?
+ end
+
class GemfileEntry < Struct.new(:name, :version, :comment, :options, :commented_out)
def initialize(name, version, comment, options = {}, commented_out = false)
super
diff --git a/railties/lib/rails/generators/rails/app/templates/config/application.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/application.rb.tt
index 60016f76f2..1b0ee54071 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/application.rb.tt
+++ b/railties/lib/rails/generators/rails/app/templates/config/application.rb.tt
@@ -12,6 +12,7 @@ require "active_job/railtie"
require "action_controller/railtie"
<%= comment_if :skip_action_mailer %>require "action_mailer/railtie"
<%= comment_if :skip_action_mailbox %>require "action_mailbox/engine"
+<%= comment_if :skip_action_text %>require "action_text/engine"
require "action_view/railtie"
<%= comment_if :skip_action_cable %>require "action_cable/engine"
<%= comment_if :skip_sprockets %>require "sprockets/railtie"
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index f287827f81..47e401c34f 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -450,6 +450,21 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_file "#{application_path}/config/application.rb", /#\s+require\s+["']action_mailbox\/engine["']/
end
+ def test_generator_skips_action_text_when_skip_action_text_is_given
+ run_generator [destination_root, "--skip-action-text"]
+ assert_file "#{application_path}/config/application.rb", /#\s+require\s+["']action_text\/engine["']/
+ end
+
+ def test_generator_skips_action_text_when_skip_active_record_is_given
+ run_generator [destination_root, "--skip-active-record"]
+ assert_file "#{application_path}/config/application.rb", /#\s+require\s+["']action_text\/engine["']/
+ end
+
+ def test_generator_skips_action_text_when_skip_active_storage_is_given
+ run_generator [destination_root, "--skip-active-storage"]
+ assert_file "#{application_path}/config/application.rb", /#\s+require\s+["']action_text\/engine["']/
+ end
+
def test_app_update_does_not_change_config_target_version
run_generator
diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb
index 94f69277f5..670f521a0f 100644
--- a/railties/test/generators/shared_generator_tests.rb
+++ b/railties/test/generators/shared_generator_tests.rb
@@ -128,6 +128,7 @@ module SharedGeneratorTests
"--skip-active-storage",
"--skip-action-mailer",
"--skip-action-mailbox",
+ "--skip-action-text",
"--skip-action-cable",
"--skip-sprockets"
]
@@ -141,6 +142,7 @@ module SharedGeneratorTests
assert_file "#{application_path}/config/application.rb", /^# require\s+["']action_mailer\/railtie["']/
unless generator_class.name == "Rails::Generators::PluginGenerator"
assert_file "#{application_path}/config/application.rb", /^# require\s+["']action_mailbox\/engine["']/
+ assert_file "#{application_path}/config/application.rb", /^# require\s+["']action_text\/engine["']/
end
assert_file "#{application_path}/config/application.rb", /^require\s+["']action_view\/railtie["']/
assert_file "#{application_path}/config/application.rb", /^# require\s+["']action_cable\/engine["']/