1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #45402 from brtrick/bt/add-skip-dev-gems-as-class-option

Set `skip_dev_gems` to be a `class_option`
This commit is contained in:
Jonathan Hefner 2022-06-20 14:20:28 -05:00 committed by GitHub
commit 5a5440ba72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 4 deletions

View file

@ -1,3 +1,8 @@
* Add `--skip-dev-gems` option to app generator to skip adding development
gems (like `web-console`) to the Gemfile.
*Brad Trick*
* Skip Active Storage and Action Mailer if Active Job is skipped.
*Étienne Barrié*

View file

@ -84,6 +84,9 @@ module Rails
class_option :skip_bootsnap, type: :boolean, default: false,
desc: "Skip bootsnap gem"
class_option :skip_dev_gems, type: :boolean, default: false,
desc: "Skip development gems (e.g., web-console)"
class_option :dev, type: :boolean, default: false,
desc: "Set up the #{name} with Gemfile pointing to your Rails checkout"
@ -238,10 +241,6 @@ module Rails
options[:skip_action_text] || skip_active_storage?
end
def skip_dev_gems? # :doc:
options[:skip_dev_gems]
end
def skip_sprockets?
options[:skip_asset_pipeline] || options[:asset_pipeline] != "sprockets"
end

View file

@ -917,6 +917,16 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_file "app/assets/stylesheets/application.postcss.css"
end
def test_dev_gems
run_generator [destination_root, "--no-skip-dev-gems"]
assert_gem "web-console"
end
def test_skip_dev_gems
run_generator [destination_root, "--skip-dev-gems"]
assert_no_gem "web-console"
end
def test_bootsnap
run_generator [destination_root, "--no-skip-bootsnap"]