From dd439bfbda2a39b305b13f00c40d07c6a8c46d8c Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Mon, 31 Jul 2017 14:59:11 +0200 Subject: [PATCH] Use duktape gem as default JS engine on Windows-MINGW and MS-Visual-C builds The fallback javascript engine on Windows is Windows Script Host (JScript). However this engine isn't able to process the default assets, because it supports ES3 only but the coffeescript compiler requires ES5. Fixes #30014 --- railties/lib/rails/generators/app_base.rb | 2 ++ railties/test/generators/app_generator_test.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 760cb2f81e..4899a63917 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -348,6 +348,8 @@ module Rails comment = "See https://github.com/rails/execjs#readme for more supported runtimes" if defined?(JRUBY_VERSION) GemfileEntry.version "therubyrhino", nil, comment + elsif RUBY_PLATFORM =~ /mingw|mswin/ + GemfileEntry.version "duktape", nil, comment else GemfileEntry.new "mini_racer", nil, comment, { platforms: :ruby }, true end diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index ffdee3a6b5..284c200e35 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -521,6 +521,8 @@ class AppGeneratorTest < Rails::Generators::TestCase run_generator if defined?(JRUBY_VERSION) assert_gem "therubyrhino" + elsif RUBY_PLATFORM =~ /mingw|mswin/ + assert_gem "duktape" else assert_file "Gemfile", /# gem 'mini_racer', platforms: :ruby/ end