Skip to content

Commit 4b68e6d

Browse files
authored
Merge pull request rails#35523 from y-yagi/build_assets_automatically_when_need
Build assets automatically if necessary
2 parents a62683f + a942e31 commit 4b68e6d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

railties/test/isolation/abstract_unit.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,14 @@ class ActiveSupport::TestCase
488488
f.puts "require 'rails/all'"
489489
end
490490

491+
unless File.exist?("#{RAILS_FRAMEWORK_ROOT}/actionview/lib/assets/compiled/rails-ujs.js")
492+
Dir.chdir("#{RAILS_FRAMEWORK_ROOT}/actionview") { `yarn build` }
493+
end
494+
491495
assets_path = "#{RAILS_FRAMEWORK_ROOT}/railties/test/isolation/assets"
496+
unless Dir.exist?("#{assets_path}/node_modules")
497+
Dir.chdir(assets_path) { `yarn install` }
498+
end
492499
FileUtils.cp("#{assets_path}/package.json", "#{app_template_path}/package.json")
493500
FileUtils.cp("#{assets_path}/config/webpacker.yml", "#{app_template_path}/config/webpacker.yml")
494501
FileUtils.cp_r("#{assets_path}/config/webpack", "#{app_template_path}/config/webpack")

0 commit comments

Comments
 (0)