From c7729ae9af7c1e5b1b146fa59d1de433c4057454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Garagnani?= Date: Tue, 17 Mar 2020 22:02:10 +0100 Subject: [PATCH] Apply suggestions from code review Co-Authored-By: Javier Julio --- CHANGELOG.md | 2 +- docs/0-installation.md | 2 +- lib/generators/active_admin/install/install_generator.rb | 2 +- .../active_admin/install/templates/active_admin.rb.erb | 4 ++-- .../active_admin/webpacker/templates/active_admin.js | 2 +- spec/support/rails_template.rb | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49245677a9ea..85ffdb9d9da5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ ### Enhancements * Extend menu to allow for nested submenus. [#5994] by [@taralbass] -* Add webpacker compatibility with config switch and installation generator. [#5855] by [@sgara] +* Add Webpacker compatibility with opt-in config switch and installation generator. [#5855] by [@sgara] ## 2.6.1 [☰](https://github.com/activeadmin/activeadmin/compare/v2.6.0..v2.6.1) diff --git a/docs/0-installation.md b/docs/0-installation.md index 3168fd90c7f7..07113aa65b6c 100644 --- a/docs/0-installation.md +++ b/docs/0-installation.md @@ -114,7 +114,7 @@ If you're getting the error `wrong number of arguments (6 for 4..5)`, [read #270 ## webpacker -Since rails 6.0, webpacker has become the default asset generator. You can opt into using webpacker for ActiveAdmin assets as well by setting `use_webpacker` at installation time or manually. +For new apps starting with Rails 6.0, Webpacker has become the default asset generator. You can **opt-in to using Webpacker for ActiveAdmin assets** as well by updating your configuration to turn on the `use_webpacker` option, either at installation time or manually. * at active_admin installation: diff --git a/lib/generators/active_admin/install/install_generator.rb b/lib/generators/active_admin/install/install_generator.rb index 9d90dea54503..268c545ee839 100644 --- a/lib/generators/active_admin/install/install_generator.rb +++ b/lib/generators/active_admin/install/install_generator.rb @@ -8,7 +8,7 @@ class InstallGenerator < ActiveRecord::Generators::Base hook_for :users, default: "devise", desc: "Admin user generator to run. Skip with --skip-users" class_option :skip_comments, type: :boolean, default: false, desc: "Skip installation of comments" - class_option :use_webpacker, type: :boolean, default: false, desc: "Use webpacker assets instead of sprockets" + class_option :use_webpacker, type: :boolean, default: false, desc: "Use Webpacker assets instead of Sprockets" source_root File.expand_path('templates', __dir__) diff --git a/lib/generators/active_admin/install/templates/active_admin.rb.erb b/lib/generators/active_admin/install/templates/active_admin.rb.erb index 5d5a054f8ef2..389acac43700 100644 --- a/lib/generators/active_admin/install/templates/active_admin.rb.erb +++ b/lib/generators/active_admin/install/templates/active_admin.rb.erb @@ -328,8 +328,8 @@ ActiveAdmin.setup do |config| # == Webpacker # - # By default, Active Admin uses sprocket's asset pipeline. - # You can switch to webpacker here. + # By default, Active Admin uses Sprocket's asset pipeline. + # You can switch to using Webpacker here. # <% unless @use_webpacker %># <% end %>config.use_webpacker = true end diff --git a/lib/generators/active_admin/webpacker/templates/active_admin.js b/lib/generators/active_admin/webpacker/templates/active_admin.js index 9e6b765bb559..68493d6a7062 100644 --- a/lib/generators/active_admin/webpacker/templates/active_admin.js +++ b/lib/generators/active_admin/webpacker/templates/active_admin.js @@ -1,4 +1,4 @@ -// Load Active Admin's styles into webpacker, +// Load Active Admin's styles into Webpacker, // see `active_admin.scss` for customization. import "../stylesheets/active_admin"; diff --git a/spec/support/rails_template.rb b/spec/support/rails_template.rb index 99f00f6b18ff..a3173c7c6027 100644 --- a/spec/support/rails_template.rb +++ b/spec/support/rails_template.rb @@ -67,7 +67,7 @@ # Setup webpacker if necessary if webpacker_app - rake "webpacker:install" + rails_command "webpacker:install" gsub_file 'config/webpacker.yml', /^(.*)extract_css.*$/, '\1extract_css: true' if ENV['RAILS_ENV'] == 'test' end