mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #41399 from jonathanhefner/always-overwrite-bin-yarn
Overwrite bin/yarn when running app:binstub:yarn
This commit is contained in:
commit
3b9a877c69
2 changed files with 17 additions and 3 deletions
|
@ -107,9 +107,7 @@ module Rails
|
||||||
end
|
end
|
||||||
|
|
||||||
def yarn_when_updating
|
def yarn_when_updating
|
||||||
return if File.exist?("bin/yarn")
|
template "bin/yarn", force: true do |content|
|
||||||
|
|
||||||
template "bin/yarn" do |content|
|
|
||||||
"#{shebang}\n" + content
|
"#{shebang}\n" + content
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -301,6 +301,22 @@ module ApplicationTests
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "app:binstub:yarn generates bin/yarn" do
|
||||||
|
yarn_binstub = File.join(app_path, "bin/yarn")
|
||||||
|
rails "app:binstub:yarn"
|
||||||
|
|
||||||
|
assert_path_exists yarn_binstub
|
||||||
|
assert_match %r/\A#!/, File.read(yarn_binstub)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "app:binstub:yarn overwrites existing bin/yarn" do
|
||||||
|
yarn_binstub = File.join(app_path, "bin/yarn")
|
||||||
|
File.write(yarn_binstub, "existing")
|
||||||
|
rails "app:binstub:yarn"
|
||||||
|
|
||||||
|
assert_match %r/\A#!/, File.read(yarn_binstub)
|
||||||
|
end
|
||||||
|
|
||||||
def test_template_load_initializers
|
def test_template_load_initializers
|
||||||
app_file "config/initializers/dummy.rb", "puts 'Hello, World!'"
|
app_file "config/initializers/dummy.rb", "puts 'Hello, World!'"
|
||||||
app_file "template.rb", ""
|
app_file "template.rb", ""
|
||||||
|
|
Loading…
Reference in a new issue