1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

execute yarn executable using current ruby interpreter

This change is required to support windows. It explicitly runs the bin/yarn file using the ruby executable that's running the rake task.
This commit is contained in:
Joshua LeBlanc 2021-02-24 18:28:11 -04:00
parent e2e34eaf85
commit 5c8805034f

View file

@ -10,13 +10,13 @@ namespace :yarn do
end
yarn_flags =
if `"#{Rails.root}/bin/yarn" --version`.start_with?("1")
if `#{RbConfig.ruby} "#{Rails.root}/bin/yarn" --version`.start_with?("1")
"--no-progress --frozen-lockfile"
else
"--immutable"
end
system({ "NODE_ENV" => node_env }, "\"#{Rails.root}/bin/yarn\" install #{yarn_flags}")
system({ "NODE_ENV" => node_env }, "#{RbConfig.ruby} \"#{Rails.root}/bin/yarn\" install #{yarn_flags}")
rescue Errno::ENOENT
$stderr.puts "bin/yarn was not found."
$stderr.puts "Please run `bundle exec rails app:update:bin` to create it."