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

Run bin/yarn via Ruby

Windows cannot directly run shebang scripts, such as `bin/yarn`.
Therefore, run `bin/yarn` via Ruby.

Actually fixes #40942.
Fixes #41123.
This commit is contained in:
Jonathan Hefner 2021-01-21 11:51:15 -06:00
parent 9fcaac6fb9
commit 44d1006de3
2 changed files with 12 additions and 1 deletions

View file

@ -68,7 +68,7 @@ module ActionText
end
def yarn_command(command, config = {})
in_root { run "bin/yarn #{command}", abort_on_failure: true, **config }
in_root { run "#{Thor::Util.ruby_command} bin/yarn #{command}", abort_on_failure: true, **config }
end
end
end

View file

@ -73,6 +73,17 @@ class ActionText::Generators::InstallGeneratorTest < Rails::Generators::TestCase
assert_migration "db/migrate/create_action_text_tables.action_text.rb"
end
test "#yarn_command runs bin/yarn via Ruby" do
ran = nil
run_stub = -> (command, *) { ran = command }
generator.stub(:run, run_stub) do
generator.send(:yarn_command, "foo")
end
assert_match %r"\S bin/yarn foo$", ran
end
private
def run_generator_instance
@yarn_commands = []