aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2018-10-04 13:45:53 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2018-10-09 08:09:10 +0900
commitbd0ca39564bb2fc263c7a74a27d5f063c68b4dd8 (patch)
tree00d0daa8372764a9bc55ed58de2e8a35bb9869a1 /railties/lib
parenta1ee4a9ff9d4a3cb255365310ead0dc7b739c6be (diff)
downloadrails-bd0ca39564bb2fc263c7a74a27d5f063c68b4dd8.tar.gz
rails-bd0ca39564bb2fc263c7a74a27d5f063c68b4dd8.tar.bz2
rails-bd0ca39564bb2fc263c7a74a27d5f063c68b4dd8.zip
Add `skip-webpack-install` option
This option is useful when want to check only the files generated by `rails new`, or if want to do something before `webpacker:install`.
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators/app_base.rb6
-rw-r--r--railties/lib/rails/generators/rails/app/app_generator.rb3
2 files changed, 8 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index 410e53b4c0..2e4797e5bb 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -399,6 +399,10 @@ module Rails
!options[:skip_spring] && !options.dev? && Process.respond_to?(:fork) && !RUBY_PLATFORM.include?("cygwin")
end
+ def webpack_install?
+ !(options[:skip_javascript] || options[:skip_webpack_install])
+ end
+
def depends_on_system_test?
!(options[:skip_system_test] || options[:skip_test] || options[:api])
end
@@ -420,7 +424,7 @@ module Rails
end
def run_webpack
- unless options[:skip_javascript]
+ if webpack_install?
rails_command "webpacker:install"
rails_command "webpacker:install:#{options[:webpack]}" if options[:webpack] && options[:webpack] != "webpack"
end
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb
index cefaffcb20..b118ea989b 100644
--- a/railties/lib/rails/generators/rails/app/app_generator.rb
+++ b/railties/lib/rails/generators/rails/app/app_generator.rb
@@ -261,6 +261,9 @@ module Rails
class_option :webpack, type: :string, default: nil,
desc: "Preconfigure Webpack with a particular framework (options: #{WEBPACKS.join('/')})"
+ class_option :skip_webpack_install, type: :boolean, default: false,
+ desc: "Don't run Webpack install"
+
def initialize(*args)
super