diff options
author | Yuji Yaginuma <yuuji.yaginuma@gmail.com> | 2016-12-09 12:07:40 +0900 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2016-12-08 19:07:40 -0800 |
commit | fbd33b911acd5a4487f37dc1df2aad439c090bfa (patch) | |
tree | e1765bcb2395cd9ca456194e14e8028a822238dd /railties/lib/rails/generators/rails | |
parent | 81608cda9c0e3a3e70dc189481f68129ed74b8ba (diff) | |
download | rails-fbd33b911acd5a4487f37dc1df2aad439c090bfa.tar.gz rails-fbd33b911acd5a4487f37dc1df2aad439c090bfa.tar.bz2 rails-fbd33b911acd5a4487f37dc1df2aad439c090bfa.zip |
specify `skip_yarn` option in API-only Application (#27309)
Diffstat (limited to 'railties/lib/rails/generators/rails')
-rw-r--r-- | railties/lib/rails/generators/rails/app/app_generator.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 20bc45fee8..a8586d56dd 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -186,9 +186,11 @@ module Rails raise Error, "Invalid value for --database option. Supported for preconfiguration are: #{DATABASES.join(", ")}." end - # Force sprockets to be skipped when generating API only apps. + # Force sprockets and yarn to be skipped when generating API only apps. # Can't modify options hash as it's frozen by default. - self.options = options.merge(skip_sprockets: true, skip_javascript: true).freeze if options[:api] + if options[:api] + self.options = options.merge(skip_sprockets: true, skip_javascript: true, skip_yarn: true).freeze + end end public_task :set_default_accessors! @@ -346,6 +348,10 @@ module Rails end end + def delete_bin_yarn_if_api_option + remove_file "bin/yarn" if options[:api] + end + def finish_template build(:leftovers) end |